aboutsummaryrefslogtreecommitdiff
path: root/test/test-lib-common.sh
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-02-12 16:27:35 -0400
committerDavid Bremner <david@tethera.net>2022-02-25 08:38:03 -0400
commitb21fa0e43371b8281b9aa8ea532088800bb37712 (patch)
treea90f190f5fc3974c3b7308e26760f777c8c6f67e /test/test-lib-common.sh
parentc4c6045058456ea0fb057f7690b91077f1b527b8 (diff)
perf-test: allow running test_emacs from performance test suite.
test_require_external prereq has to move to test-lib-common.sh, and the new shell functions print_emacs_header and time_emacs are provided. The somewhat indirect way of printing the output is to avoid the extra "" present on string values from emacsclient.
Diffstat (limited to 'test/test-lib-common.sh')
-rw-r--r--test/test-lib-common.sh14
1 files changed, 14 insertions, 0 deletions
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"