X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=3147b78280a585cd1a2efbbaca2451a7ef2fa95f;hb=645bea13cb204108fd520010afbba25d0d6a8693;hp=4c9f2a2103e32a18c2c14dc257669300ecbe4d6f;hpb=27a2c2c80d7854f75f8910802880f9a8e6764a45;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index 4c9f2a21..3147b782 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -112,6 +112,13 @@ unset ALTERNATE_EDITOR # for reproducibility unset EMAIL +unset NAME + +test_require_emacs () { + test_require_external_prereq emacs + test_require_external_prereq ${TEST_EMACSCLIENT} + test_require_external_prereq dtach +} add_gnupg_home () { @@ -591,6 +598,9 @@ test_emacs_expect_t () { exec 1>&6 2>&7 # Restore stdout and stderr inside_subtest= + # test_emacs may update missing external prerequisites + test_check_missing_external_prereqs_ "$test_subtest_name" && return + # Report success/failure. result=$(cat OUTPUT) if [ "$result" = t ] @@ -700,7 +710,7 @@ notmuch_built_with_sanitize () sed 's/^built_with[.]\(.*\)=.*$/built_with.\1=something/' } -notmuch_passwd_sanitize() +notmuch_passwd_sanitize () { ${NOTMUCH_PYTHON} -c' import os, sys, pwd, socket @@ -708,10 +718,15 @@ import os, sys, pwd, socket pw = pwd.getpwuid(os.getuid()) user = pw.pw_name name = pw.pw_gecos.partition(",")[0] -fqdn = socket.getfqdn() +fqdn = socket.getaddrinfo(socket.gethostname(), 0, 0, socket.SOCK_STREAM, 0, socket.AI_CANONNAME)[0][3] for l in sys.stdin: - l = l.replace(user, "USERNAME").replace(fqdn, "FQDN").replace(".(none)","").replace(name, "USER_FULL_NAME") + if user: + l = l.replace(user, "USERNAME") + if fqdn: + l = l.replace(fqdn, "FQDN").replace(".(none)","") + if name: + l = l.replace(name, "USER_FULL_NAME") sys.stdout.write(l) ' } @@ -913,7 +928,7 @@ test_expect_success () { test_run_ "$1" run_ret="$?" # test_run_ may update missing external prerequisites - test_check_missing_external_prereqs_ "$@" || + test_check_missing_external_prereqs_ "$test_subtest_name" || if [ "$run_ret" = 0 -a "$eval_ret" = 0 ] then test_ok_ @@ -937,7 +952,7 @@ test_expect_code () { test_run_ "$2" run_ret="$?" # test_run_ may update missing external prerequisites, - test_check_missing_external_prereqs_ "$@" || + test_check_missing_external_prereqs_ "$test_subtest_name" || if [ "$run_ret" = 0 -a "$eval_ret" = "$1" ] then test_ok_ @@ -977,7 +992,7 @@ test_must_fail () { # - cmp's output is not nearly as easy to read as diff -u # - not all diff versions understand "-u" -test_cmp() { +test_cmp () { $GIT_TEST_CMP "$@" } @@ -1102,17 +1117,13 @@ test_emacs () { ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval "(notmuch-test-progn $*)" } -test_python() { +test_python () { # Note: if there is need to print debug information from python program, # use stdout = os.fdopen(6, 'w') or stderr = os.fdopen(7, 'w') PYTHONPATH="$NOTMUCH_SRCDIR/bindings/python${PYTHONPATH:+:$PYTHONPATH}" \ $NOTMUCH_PYTHON -B - > OUTPUT } -test_ruby() { - MAIL_DIR=$MAIL_DIR $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT -} - test_C () { local exec_file test_file exec_file="test${test_count}"