1#!/bin/sh23test_description='signals work as we expect'4. ./test-lib.sh56cat >expect <<EOF7three8two9one10EOF1112test_expect_success 'sigchain works' '13{ test-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 that17# as well as the normal signal check.18test_match_signal 15 "$ret" ||19test "$ret" = 320} &&21test_cmp expect actual22'2324test_expect_success !MINGW 'signals are propagated using shell convention' '25# we use exec here to avoid any sub-shell interpretation26# of the exit code27git config alias.sigterm "!exec test-sigchain" &&28test_expect_code 143 git sigterm29'3031large_git () {32for i in $(test_seq 1 100)33do34git diff --cached --binary || return35done36}3738test_expect_success 'create blob' '39test-genrandom foo 16384 >file &&40git add file41'4243test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '44OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&45test_match_signal 13 "$OUT"46'4748test_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'5253test_done