t7501: add tests for --include and --only
[git/gitster.git] / t / t0005-signals.sh
blobeba75a2490ce7e0918e6a981d42ec8f5d9fd9b2d
1 #!/bin/sh
3 test_description='signals work as we expect'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 cat >expect <<EOF
9 three
10 two
11 one
12 EOF
14 test_expect_success 'sigchain works' '
15 { test-tool sigchain >actual; ret=$?; } &&
17 # Signal death by raise() on Windows acts like exit(3),
18 # regardless of the signal number. So we must allow that
19 # as well as the normal signal check.
20 test_match_signal 15 "$ret" ||
21 test "$ret" = 3
22 } &&
23 test_cmp expect actual
26 test_expect_success !MINGW 'signals are propagated using shell convention' '
27 # we use exec here to avoid any sub-shell interpretation
28 # of the exit code
29 git config alias.sigterm "!exec test-tool sigchain" &&
30 test_expect_code 143 git sigterm
33 large_git () {
34 for i in $(test_seq 1 100)
36 git diff --cached --binary || return
37 done
40 test_expect_success 'create blob' '
41 test-tool genrandom foo 16384 >file &&
42 git add file
45 test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '
46 OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
47 test_match_signal 13 "$OUT"
50 test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '
51 OUT=$( ((trap "" PIPE && large_git; echo $? 1>&3) | :) 3>&1 ) &&
52 test_match_signal 13 "$OUT"
55 test_done