diff options
author | Mattias Andrée <maandree@kth.se> | 2022-01-18 22:39:22 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-01-18 22:39:22 +0100 |
commit | 0369f6a80f549fa538dc099918b5a176689048dc (patch) | |
tree | bca4fdf4c8e636e14c2d1621816ba5cd7eab3fcb | |
parent | test: add missing quotes, allow : in extra options, use printf instead of echo, print to stderr and not stdout, and some style changes (diff) | |
download | makel-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>
Diffstat (limited to '')
-rwxr-xr-x | test | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 |