diff options
author | Mattias Andrée <maandree@kth.se> | 2022-01-18 22:54:05 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-01-18 22:54:37 +0100 |
commit | 893ac5d220d699a1681e12617eaeb0781f356bba (patch) | |
tree | 58209182876e73e316b79831eb2dc696e73af66d /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) | |
download | makel-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 '')
-rwxr-xr-x | test | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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 |