]> git.ipfire.org Git - thirdparty/git.git/blame - t/t0005-signals.sh
l10n: fr v2.23.0 round 2
[thirdparty/git.git] / t / t0005-signals.sh
CommitLineData
4a16d072
JK
1#!/bin/sh
2
3test_description='signals work as we expect'
4. ./test-lib.sh
5
6cat >expect <<EOF
7three
8two
9one
10EOF
11
12test_expect_success 'sigchain works' '
e154a6f3 13 { test-tool sigchain >actual; ret=$?; } &&
9b67c994
JK
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.
18 test_match_signal 15 "$ret" ||
19 test "$ret" = 3
20 } &&
4a16d072
JK
21 test_cmp expect actual
22'
23
04422c74 24test_expect_success !MINGW 'signals are propagated using shell convention' '
e828908a
JK
25 # we use exec here to avoid any sub-shell interpretation
26 # of the exit code
e154a6f3 27 git config alias.sigterm "!exec test-tool sigchain" &&
e828908a
JK
28 test_expect_code 143 git sigterm
29'
30
7559a1be
PR
31large_git () {
32 for i in $(test_seq 1 100)
33 do
34 git diff --cached --binary || return
35 done
36}
37
38test_expect_success 'create blob' '
c680668d 39 test-tool genrandom foo 16384 >file &&
7559a1be
PR
40 git add file
41'
42
4e6d207c 43test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '
635ce72f 44 OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
6f5f9d74 45 test_match_signal 13 "$OUT"
7559a1be
PR
46'
47
4e6d207c 48test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '
635ce72f 49 OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 ) &&
6f5f9d74 50 test_match_signal 13 "$OUT"
7559a1be
PR
51'
52
4a16d072 53test_done