X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test%2Ftest-lib-common.sh;h=4d14e0b3b18e506b445e7e9c38b45a545382ded0;hb=73f3081160fb80345f3953cbdeba340975375325;hp=ebbf4cdfa6fd2e727f78d651fdf31dcb8c3ead7d;hpb=d21e72c9f95d1d052360976302a2f9cfcc1556a5;p=notmuch diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh index ebbf4cdf..4d14e0b3 100644 --- a/test/test-lib-common.sh +++ b/test/test-lib-common.sh @@ -29,6 +29,20 @@ if [[ -z "$NOTMUCH_SRCDIR" ]] || [[ -z "$NOTMUCH_BUILDDIR" ]]; then exit 1 fi +# Explicitly require external prerequisite. Useful when binary is +# called indirectly (e.g. from emacs). +# Returns success if dependency is available, failure otherwise. +test_require_external_prereq () { + local binary + binary="$1" + if [[ ${test_missing_external_prereq_["${binary}"]} == t ]]; then + # dependency is missing, call the replacement function to note it + eval "$binary" + else + true + fi +} + backup_database () { test_name=$(basename $0 .sh) rm -rf $TMP_DIRECTORY/notmuch-dir-backup."$test_name" @@ -309,6 +323,10 @@ rm -rf "$TMP_DIRECTORY" || { exit 1 } +# Provide a guess at a usable Python, to support running tests without +# running configure first. +NOTMUCH_PYTHON=${NOTMUCH_PYTHON-python3} + # A temporary home directory is needed by at least: # - emacs/"Sending a message via (fake) SMTP" # - emacs/"Reply within emacs"