X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=d3a8c58e97b92eb5382341860fb0e493aa8209b2;hb=fae15296eca133c53e17e379e2efc839e4c1907e;hp=210e2060987ea8b70751a26eba923e8e7bf8ab0d;hpb=3a15602d8e069d469965721f4d526a26da38887b;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index 210e2060..d3a8c58e 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -22,6 +22,9 @@ if [ ${BASH_VERSINFO[0]} -lt 4 ]; then exit 1 fi +# Make sure echo builtin does not expand backslash-escape sequences by default. +shopt -u xpg_echo + # if --tee was passed, write the output not only to the terminal, but # additionally to the file test-results/$BASENAME.out, too. case "$GIT_TEST_TEE_STARTED, $* " in @@ -194,9 +197,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 +219,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//g' \