diff options
author | Tomi Ollila <tomi.ollila@iki.fi> | 2013-01-21 05:01:46 +0200 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2013-02-18 20:17:17 -0400 |
commit | 0d8d11d3383af3e9c38d818d97a04886f3521d58 (patch) | |
tree | 1724e832f9f843a0a75baa982816890328baf99d /test | |
parent | 3a15602d8e069d469965721f4d526a26da38887b (diff) |
test/test-lib.sh: separate signaled exit
When execution of tests is interrupted by signal coming outside of the
test system itself, output just one line "interrupted by signal <num>"
message to standard output. This distinguishes the case from internal
exit and reduces noise.
Diffstat (limited to 'test')
-rw-r--r-- | test/test-lib.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh index 210e2060..ffab1bb5 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -194,9 +194,15 @@ test_fixed=0 test_broken=0 test_success=0 -die () { +_die_common () { code=$? + trap - EXIT + set +ex rm -rf "$TEST_TMPDIR" +} + +die () { + _die_common if test -n "$GIT_EXIT_OK" then exit $code @@ -210,10 +216,17 @@ die () { fi } +die_signal () { + _die_common + echo >&5 "FATAL: $0: interrupted by signal" $((code - 128)) + exit $code +} + GIT_EXIT_OK= # Note: TEST_TMPDIR *NOT* exported! TEST_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/notmuch-test-$$.XXXXXX") trap 'die' EXIT +trap 'die_signal' HUP INT TERM test_decode_color () { sed -e 's/.\[1m/<WHITE>/g' \ |