convenience script all-tests to run all available tests and store result
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Sun, 1 Nov 2015 09:53:03 +0000 (10:53 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Sun, 1 Nov 2015 09:59:27 +0000 (10:59 +0100)
Makefile
all-tests [new file with mode: 0755]

index 1d47ef4..ed7f32d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,9 @@ test-one: all
        PYTHONPATH="$(PYPATH)" $(PYTHON) $(file) $(case)
 endif
 
+
+all-tests: test-app test-node
+
 test-app:
        $(MAKE) test-one file=test/resources/linux/application.py case=$(case)
 test-node:
diff --git a/all-tests b/all-tests
new file mode 100755 (executable)
index 0000000..0aa6370
--- /dev/null
+++ b/all-tests
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# helper script to run some predefined set of tests
+# store results in a file that contains the git hash
+# and also shows differences if any
+#
+
+targets="test-node test-app"
+
+hash=$(git log -n 1 | head -1 | sed -e 's,commit ,,' -e 's,\(........\).*,\1,')
+
+# compute output file name
+output='all-tests.$hash'
+
+# if there is any pending change, use another name
+is_pristine=""
+git diff HEAD | cmp --quiet - /dev/zero && is_pristine=true
+[ -n "is_pristine" ] || output="$output-pending"
+
+function all_tests () {
+    echo all-tests : begin at; date
+    begin=$(date +%s)
+    echo ========================================
+    echo status
+    echo ========================================
+    echo ===== Current hash $hash
+    echo ===== Current branch
+    git branch
+    echo ===== Uncommitted changes
+    git diff HEAD
+    echo ========================================
+    echo tests
+    echo ========================================
+    make all-tests
+    echo ========================================
+    end=$(date +%s)
+    echo all-tests : end at; date; echo total duration $(($end-$begin)) seconds
+}
+
+all-tests >& $output
+retcod=$?
+
+# analyze this output for success or not
+success=$output.success
+failure=$output.failed
+
+[ "$retcod" != 0 ] && { touch $failure; exit; }
+grep -q '^FAIL' $output && { touch $failure; exit; }
+touch $success; exit
+