04422c74c8
The test case depends on that test-sigchain can commit suicide by a call to raise(SIGTERM) in a way that run-command.c::wait_or_whine() can detect as death through a signal. There are no POSIX signals on Windows, and a sufficiently close emulation is not available in the Microsoft C runtime (and probably not even possible). The particular deficiency is that when a signal is raise()d whose SIG_DFL action will cause process death (SIGTERM in this case), the implementation of raise() in msvcrt just calls exit(3). We could check for exit code 3 in addition to 143, but that would miss the point of the test entirely. Hence, just skip it on Windows. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
31 lines
584 B
Bash
Executable File
31 lines
584 B
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='signals work as we expect'
|
|
. ./test-lib.sh
|
|
|
|
cat >expect <<EOF
|
|
three
|
|
two
|
|
one
|
|
EOF
|
|
|
|
test_expect_success 'sigchain works' '
|
|
test-sigchain >actual
|
|
case "$?" in
|
|
143) true ;; # POSIX w/ SIGTERM=15
|
|
271) true ;; # ksh w/ SIGTERM=15
|
|
3) true ;; # Windows
|
|
*) false ;;
|
|
esac &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success !MINGW 'signals are propagated using shell convention' '
|
|
# we use exec here to avoid any sub-shell interpretation
|
|
# of the exit code
|
|
git config alias.sigterm "!exec test-sigchain" &&
|
|
test_expect_code 143 git sigterm
|
|
'
|
|
|
|
test_done
|