Skip to content

Commit

Permalink
t0005: use SIGTERM for sigchain test
Browse files Browse the repository at this point in the history
The signal tests consists of checking that each of our
handlers is executed, and that the test program was killed
by the final signal. We arbitrarily used SIGINT as the kill
signal.

However, some platforms (notably Solaris) will default
SIGINT to SIG_IGN if there is no controlling terminal. In
that case, we don't end up killing the program with the
final signal and the test fails.

This is a problem since the test script should not depend
on outside factors; let's use SIGTERM instead, which should
behave consistently.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
peff authored and gitster committed Jan 30, 2009
1 parent a3da882 commit 0ea8039
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion t/t0005-signals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ EOF
test_expect_success 'sigchain works' '
test-sigchain >actual
case "$?" in
130) true ;; # POSIX w/ SIGINT=2
143) true ;; # POSIX w/ SIGTERM=15
3) true ;; # Windows
*) false ;;
esac &&
Expand Down
8 changes: 4 additions & 4 deletions test-sigchain.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ X(three)
#undef X

int main(int argc, char **argv) {
sigchain_push(SIGINT, one);
sigchain_push(SIGINT, two);
sigchain_push(SIGINT, three);
raise(SIGINT);
sigchain_push(SIGTERM, one);
sigchain_push(SIGTERM, two);
sigchain_push(SIGTERM, three);
raise(SIGTERM);
return 0;
}

0 comments on commit 0ea8039

Please sign in to comment.