summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2019-12-18 16:26:26 +0200
committerAdrian Thurston <thurston@colm.net>2019-12-18 16:26:26 +0200
commitfdc9ccb6f104b720a1966ebfe1003f9c8f7939e8 (patch)
tree85d09bc1fde92dcaaf1e62593ba268fb2871a0ce /test
parentbbc59ba03d04a133e4b0c84470568fb7c338ada5 (diff)
downloadcolm-fdc9ccb6f104b720a1966ebfe1003f9c8f7939e8.tar.gz
testing: propagate internal and test case failures to exit status
Diffstat (limited to 'test')
-rwxr-xr-xtest/runtests1
-rwxr-xr-xtest/timed29
2 files changed, 24 insertions, 6 deletions
diff --git a/test/runtests b/test/runtests
index 62447636..7c075b25 100755
--- a/test/runtests
+++ b/test/runtests
@@ -1,4 +1,3 @@
#!/bin/bash
time bash $(dirname $0)/timed "$@"
-
diff --git a/test/timed b/test/timed
index 3ff76ee7..c48dbdb9 100755
--- a/test/timed
+++ b/test/timed
@@ -31,15 +31,34 @@ for D in $DIRS; do
cd $OLDPWD
done
-echo ---- cases
-find $WORKING -name '*.sh' -not -size 0 | wc -l
+CASES=`find $WORKING -name '*.sh' -not -size 0 | wc -l`
+FAILURES=`find $WORKING -name '*.diff' -not -size 0 | wc -l`
+echo ---- cases
+echo $CASES
echo ---- failures
-find $WORKING -name '*.diff' -not -size 0 | wc -l
+echo $FAILURES
+
+INTERNAL_ERRORS=""
if [ -s $GENTEST_LOG ]; then
- echo ---- errors
+ echo ---- internal errors
cat $GENTEST_LOG
fi
-rm $GENTEST_LOG
+if test -s $GENTEST_LOG; then
+ INTERNAL_ERRORS="yes"
+fi
+
+rm -f $GENTEST_LOG
+
+#
+# Exit with 1 if runtests experienced some internal error. Exit with 2 if a
+# test failed. Otherwise 0.
+#
+
+if [ "$INTERNAL_ERRORS" = yes ]; then
+ exit 1;
+elif [ "$FAILURES" != "0" ]; then
+ exit 2
+fi