1#!/bin/sh
23
test_description='signals work as we expect'
4. ./test-lib.sh
56
cat >expect <<EOF
7three
8two
9one
10EOF
1112
test_expect_success 'sigchain works' '
13{ test-tool sigchain >actual; ret=$?; } &&
14{
15# Signal death by raise() on Windows acts like exit(3),
16# regardless of the signal number. So we must allow that
17# as well as the normal signal check.
18test_match_signal 15 "$ret" ||
19test "$ret" = 3
20} &&
21test_cmp expect actual
22'
2324
test_expect_success !MINGW 'signals are propagated using shell convention' '
25# we use exec here to avoid any sub-shell interpretation
26# of the exit code
27git config alias.sigterm "!exec test-tool sigchain" &&
28test_expect_code 143 git sigterm
29'
3031
large_git () {
32for i in $(test_seq 1 100)
33do
34git diff --cached --binary || return
35done
36}
3738
test_expect_success 'create blob' '
39test-tool genrandom foo 16384 >file &&
40git add file
41'
4243
test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '
44OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
45test_match_signal 13 "$OUT"
46'
4748
test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '
49OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 ) &&
50test_match_signal 13 "$OUT"
51'
5253
test_done