@matheusbsbs / matheus-bagliano / commits / 0ea8039644
Fork 0

t0005: use SIGTERM for sigchain test

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>

Jeff King committed Jan 30, 2009 at 03:21 UTC 0ea8039644968e53d79a8dfbf739c87af4261d46
2 files changed +5 -5
t/t0005-signals.sh
+1 -1
@@ -12,7 +12,7 @@ EOF
12 test_expect_success 'sigchain works' '
13 test-sigchain >actual
14 case "$?" in
15 - 130) true ;; # POSIX w/ SIGINT=2
15 + 143) true ;; # POSIX w/ SIGTERM=15
16 3) true ;; # Windows
17 *) false ;;
18 esac &&
test-sigchain.c
+4 -4
@@ -14,9 +14,9 @@ X(three)
14 #undef X
15
16 int main(int argc, char **argv) {
17 - sigchain_push(SIGINT, one);
18 - sigchain_push(SIGINT, two);
19 - sigchain_push(SIGINT, three);
20 - raise(SIGINT);
17 + sigchain_push(SIGTERM, one);
18 + sigchain_push(SIGTERM, two);
19 + sigchain_push(SIGTERM, three);
20 + raise(SIGTERM);
21 return 0;
22 }