X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Ftest-lib.sh;h=98203b9bc1655bd016e0f1a52ad490ed4f9deffb;hp=bb32e97b2af747b35a2db1d82b44d6cc8333d244;hb=14c0862baca77882f74fecdafbacb717bccdcfbb;hpb=e0e8586fc72763571f9eafeb831c7bc79a15273d diff --git a/test/test-lib.sh b/test/test-lib.sh index bb32e97b..98203b9b 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -230,19 +230,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 +271,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 @@ -745,7 +738,7 @@ notmuch_json_show_sanitize () -e 's|"id": "[^"]*",|"id": "XXXXX",|g' \ -e 's|"Date": "Fri, 05 Jan 2001 [^"]*0000"|"Date": "GENERATED_DATE"|g' \ -e 's|"filename": "signature.asc",||g' \ - -e 's|"filename": "/[^"]*",|"filename": "YYYYY",|g' \ + -e 's|"filename": \["/[^"]*"\],|"filename": \["YYYYY"\],|g' \ -e 's|"timestamp": 97.......|"timestamp": 42|g' \ -e 's|"content-length": [1-9][0-9]*|"content-length": "NONZERO"|g' } @@ -858,12 +851,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 +866,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 +882,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 +1285,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