From 0369f6a80f549fa538dc099918b5a176689048dc Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 18 Jan 2022 22:39:22 +0100 Subject: -m test: fail if there is an error during execution or at end if there one or more of the tests failed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- test | 4 ++++ 1 file changed, 4 insertions(+) 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: # #:: +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 -- cgit v1.2.3-70-g09d2