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.
This commit is contained in:
Tomi Ollila 2013-01-21 05:01:46 +02:00 committed by David Bremner
parent 3a15602d8e
commit 0d8d11d338

View file

@ -194,9 +194,15 @@ test_fixed=0
test_broken=0 test_broken=0
test_success=0 test_success=0
die () { _die_common () {
code=$? code=$?
trap - EXIT
set +ex
rm -rf "$TEST_TMPDIR" rm -rf "$TEST_TMPDIR"
}
die () {
_die_common
if test -n "$GIT_EXIT_OK" if test -n "$GIT_EXIT_OK"
then then
exit $code exit $code
@ -210,10 +216,17 @@ die () {
fi fi
} }
die_signal () {
_die_common
echo >&5 "FATAL: $0: interrupted by signal" $((code - 128))
exit $code
}
GIT_EXIT_OK= GIT_EXIT_OK=
# Note: TEST_TMPDIR *NOT* exported! # Note: TEST_TMPDIR *NOT* exported!
TEST_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/notmuch-test-$$.XXXXXX") TEST_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/notmuch-test-$$.XXXXXX")
trap 'die' EXIT trap 'die' EXIT
trap 'die_signal' HUP INT TERM
test_decode_color () { test_decode_color () {
sed -e 's/.\[1m/<WHITE>/g' \ sed -e 's/.\[1m/<WHITE>/g' \