[PATCH v2 3/3] test: fix die() in test-lib-common.sh

Tomi Ollila tomi.ollila at iki.fi
Sat May 28 05:39:30 PDT 2016


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.
---
 test/test-lib-common.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index ba4a8e112084..bc2322162fd5 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"
-- 
2.8.2



More information about the notmuch mailing list