summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-01-18 22:54:05 +0100
committerMattias Andrée <maandree@kth.se>2022-01-18 22:54:37 +0100
commit893ac5d220d699a1681e12617eaeb0781f356bba (patch)
tree58209182876e73e316b79831eb2dc696e73af66d /test
parent-m test: fail if there is an error during execution or at end if there one or more of the tests failed (diff)
downloadmakel-893ac5d220d699a1681e12617eaeb0781f356bba.tar.gz
makel-893ac5d220d699a1681e12617eaeb0781f356bba.tar.bz2
makel-893ac5d220d699a1681e12617eaeb0781f356bba.tar.xz
test: print symbol names to exit codes
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'test')
-rwxr-xr-xtest15
1 files changed, 13 insertions, 2 deletions
diff --git a/test b/test
index 4f0d22e..9bf58c8 100755
--- a/test
+++ b/test
@@ -6,6 +6,14 @@
set -e
exec >&2
+exit2str () {
+ if test $1 = 0; then
+ printf '%s\n' 'all good'
+ else
+ sed -n 's/^ *#define *EXIT_\([^ ]*\) *'"$1"' *$/ (\1)/p' < common.h | tr '[A-Z]' '[a-z]'
+ fi
+}
+
nfails=0
for f in tests/*.mk; do
@@ -18,11 +26,14 @@ for f in tests/*.mk; do
got=$?
set -e
+ expstr="$(exit2str $expected)"
+ gotstr="$(exit2str $got)"
+
if test $got -lt $expected; then
- printf '%s: %s\n' "$f" "defect was not detected (expected ${expected}, got ${got})"
+ printf '%s: %s\n' "$f" "defect was not detected (expected ${expected}${expstr}, got ${got}${gotstr})"
: $(( nfails++ ))
elif test $got -gt $expected; then
- printf '%s: %s\n' "$f" "found more serious defects than expected (expected ${expected}, got ${got})"
+ printf '%s: %s\n' "$f" "found more serious defects than expected (expected ${expected}${expstr}, got ${got}${gotstr})"
: $(( nfails++ ))
fi
done