X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=t%2Ftap.sh;h=1811f5dde48aacbf9ed9945d9a15eb8596d40ba9;hb=ddeb616cccad9c19467be36be9415cbb82a836ce;hp=59df961a207547397e0719816096d61fe67f6de8;hpb=458ecde52cbb587e9db52f4ae16fcd76002feb61;p=zpackage diff --git a/t/tap.sh b/t/tap.sh index 59df961..1811f5d 100755 --- a/t/tap.sh +++ b/t/tap.sh @@ -7,7 +7,7 @@ tryrun() { note="$@" program=$1 shift - $program "$@" + $program "$@" >> test.out 2>&1 if [ $? -ne 0 ]; then printf 'not '; fi @@ -19,9 +19,11 @@ require() { note="$@" program=$1 shift - $program "$@" - if [ $? -ne 0 ]; then - printf "bail out! fail[$?]: $@\n" + $program "$@" >> test.out 2>&1 + rv=$? + if [ $rv -ne 0 ]; then + diag "bailing on $((tn + 1)) $program $*" + printf "bail out! fail[$rv]: $@\n" exit 255; fi tn=$((tn + 1)) @@ -35,6 +37,10 @@ shownote() { fi } +diag() { + printf '# %s\n' "$@" +} + okexit() { exitwith 0 "$*" } @@ -56,7 +62,7 @@ exitwith() { note= if [ $rv -ne $1 ]; then printf 'not '; - note=$(printf '# got "%d" expected "%d"' "$1" "$2") + note=$(printf '# got "%d" expected "%d"' "$rv" "$1") fi shift tn=$((tn + 1))