summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-01-18 22:39:22 +0100
committerMattias Andrée <maandree@kth.se>2022-01-18 22:39:22 +0100
commit0369f6a80f549fa538dc099918b5a176689048dc (patch)
treebca4fdf4c8e636e14c2d1621816ba5cd7eab3fcb
parenttest: add missing quotes, allow : in extra options, use printf instead of echo, print to stderr and not stdout, and some style changes (diff)
downloadmakel-0369f6a80f549fa538dc099918b5a176689048dc.tar.gz
makel-0369f6a80f549fa538dc099918b5a176689048dc.tar.bz2
makel-0369f6a80f549fa538dc099918b5a176689048dc.tar.xz
-m test: fail if there is an error during execution or at end if there one or more of the tests failed
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rwxr-xr-xtest4
1 files changed, 4 insertions, 0 deletions
diff --git a/test b/test
index 5b10901..4f0d22e 100755
--- a/test
+++ b/test
@@ -3,6 +3,7 @@
# Every test file must start with a line formatted as follows:
# #:<exit code>:<additional makel command line options>
+set -e
exec >&2
nfails=0
@@ -12,8 +13,10 @@ for f in tests/*.mk; do
expected=$(printf '%s' "$header" | cut -d : -f 2)
options="$(printf '%s' "$header" | cut -d : -f 3-)"
+ set +e
./makel -f "$f" $options >/dev/null 2>/dev/null
got=$?
+ set -e
if test $got -lt $expected; then
printf '%s: %s\n' "$f" "defect was not detected (expected ${expected}, got ${got})"
@@ -27,4 +30,5 @@ done
if test $nfails -gt 0; then
printf '%s\n' '----------'
printf '%s\n' "${nfails} tests returned different exit codes than expected."
+ exit 1
fi