aboutsummaryrefslogtreecommitdiff
path: root/test/test-lib-common.sh
diff options
context:
space:
mode:
authorTomi Ollila <tomi.ollila@iki.fi>2016-05-28 15:39:30 +0300
committerDavid Bremner <david@tethera.net>2016-06-11 13:03:44 -0300
commit36492f20a71906413d9922dbad5e18571059f57a (patch)
tree3ad6e8785b884d7d25bff9c6f83a337a5396544f /test/test-lib-common.sh
parentd53b417d1f5935a924b0f0127e64750c8448ac3a (diff)
test: fix die() in test-lib-common.sh
In scripts that include test-lib-common.sh but not test-lib.sh the die() implementation needs to be a bit different due to fd redirection differences. test-lib-common.sh implements die() only if it was not implemented already.
Diffstat (limited to 'test/test-lib-common.sh')
-rw-r--r--test/test-lib-common.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index fe92cdd3..0fdeeb72 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -18,6 +18,12 @@
# This file contains common code to be used by both the regular
# (correctness) tests and the performance tests.
+# test-lib.sh defines die() which echoes to nonstandard fd where
+# output was redirected earlier in that file. If test-lib.sh is not
+# loaded, neither this redirection nor die() function were defined.
+#
+type die >/dev/null 2>&1 || die () { echo "$@" >&2; exit 1; }
+
find_notmuch_path ()
{
dir="$1"