]> git.cworth.org Git - obsolete/notmuch-old/blobdiff - contrib/notmuch-pick/run-tests.sh
Merge tag 'debian/0.15.1-1' into squeeze-backports
[obsolete/notmuch-old] / contrib / notmuch-pick / run-tests.sh
diff --git a/contrib/notmuch-pick/run-tests.sh b/contrib/notmuch-pick/run-tests.sh
new file mode 100755 (executable)
index 0000000..7ddc9cc
--- /dev/null
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+
+set -eu
+
+fail() {
+    echo ERROR $1
+    exit 1
+}
+
+TESTS="emacs-pick emacs-pick-sync"
+TESTFILES="$TESTS pick.expected-output"
+
+export PICK_DIR="`cd \`dirname "$0"\` && pwd`"
+PICK_TEST_DIR="$PICK_DIR/test"
+
+
+for f in $TESTFILES
+do
+    test -f "$PICK_TEST_DIR/$f" || test -d "$PICK_TEST_DIR/$f" || fail "$PICK_TEST_DIR/$f does not exist"
+done
+
+cd "$PICK_DIR/../../test"
+
+test -x ../notmuch || fail "`cd .. && pwd`/notmuch has not been built"
+
+for f in $TESTFILES
+do
+    if test -f "$f"
+    then
+       fail "$f exists"
+    fi
+done
+
+trap "rm -f $TESTFILES" 0
+
+for f in $TESTFILES
+do
+    ln -s "$PICK_TEST_DIR/$f" .
+done
+
+#don't exec -- traps would not run.
+for f in $TESTS
+do
+    echo $f
+    ./$f
+done