X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Ftest-lib.sh;h=e4729a61cd8ec634847eabca8fa37609cf7b7bde;hp=d8e159437ca9b8fa159e2a776260adc36025e86a;hb=1db3244bf1b271633976cb74952367e530d27d3d;hpb=5a69aa14748162429c43ad5ff3d8b35779fff0d4 diff --git a/test/test-lib.sh b/test/test-lib.sh index d8e15943..e4729a61 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -93,15 +93,6 @@ unset GREP_OPTIONS # For emacsclient unset ALTERNATE_EDITOR -# Convenience -# -# A regexp to match 5 and 40 hexdigits -_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' -_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05" - -_x04='[0-9a-f][0-9a-f][0-9a-f][0-9a-f]' -_x32="$_x04$_x04$_x04$_x04$_x04$_x04$_x04$_x04" - # Each test should start with something like this, after copyright notices: # # test_description='Description of this test... @@ -230,19 +221,10 @@ test_fixed=0 test_broken=0 test_success=0 - -_shutdown_gpg_agent () { - if [ ${NOTMUCH_HAVE_GPGCONF_SOCKETDIR} = 1 ]; then - gpgconf --kill gpg-agent - gpgconf --remove-socketdir - fi -} - _exit_common () { code=$? trap - EXIT set +ex - _shutdown_gpg_agent rm -rf "$TEST_TMPDIR" } @@ -280,6 +262,8 @@ die () { GIT_EXIT_OK= # Note: TEST_TMPDIR *NOT* exported! TEST_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/notmuch-test-$$.XXXXXX") +# Put GNUPGHOME in TMPDIR to avoid problems with long paths. +export GNUPGHOME="${TEST_TMPDIR}/gnupg" trap 'trap_exit' EXIT trap 'trap_signal' HUP INT TERM @@ -858,12 +842,12 @@ test_ok_ () { } test_failure_ () { + print_test_description if test "$test_subtest_known_broken_" = "t"; then test_known_broken_failure_ "$@" return fi test_failure=$(($test_failure + 1)) - print_test_description test_failure_message_ "FAIL" "$test_subtest_name" "$@" test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; } return 1 @@ -873,7 +857,9 @@ test_failure_message_ () { say_color error "%-6s" "$1" echo " $2" shift 2 - echo "$@" | sed -e 's/^/ /' + if [ "$#" != "0" ]; then + echo "$@" | sed -e 's/^/ /' + fi if test "$verbose" != "t"; then cat test.output; fi } @@ -887,7 +873,11 @@ test_known_broken_ok_ () { test_known_broken_failure_ () { test_reset_state_ test_broken=$(($test_broken+1)) - test_failure_message_ "BROKEN" "$test_subtest_name" "$@" + if [ -z "$NOTMUCH_TEST_QUIET" ]; then + test_failure_message_ "BROKEN" "$test_subtest_name" "$@" + else + test_failure_message_ "BROKEN" "$test_subtest_name" + fi return 1 } @@ -1286,11 +1276,6 @@ test_init_ () { . ./test-lib-common.sh || exit 1 -# we need the setting of GNUPGHOME in test-lib-common.sh -if [ ${NOTMUCH_HAVE_GPGCONF_SOCKETDIR} = 1 ]; then - gpgconf --create-socketdir -fi - emacs_generate_script