X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test%2Ftest-lib-common.sh;h=18fa29c0dd86d3b7eb8ab5c3b69bd7f9a35cf89a;hb=5ea5a5557d9ad4cef67e61a83bb81abd44dc7f76;hp=ebbf4cdfa6fd2e727f78d651fdf31dcb8c3ead7d;hpb=4b0c6fb2f1ba989fee554cb8fa2612046d6414a8;p=notmuch diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh index ebbf4cdf..18fa29c0 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"