]> pd.if.org Git - zpackage/blobdiff - t/tap.sh
have ctap prove read from stdin
[zpackage] / t / tap.sh
index 59df961a207547397e0719816096d61fe67f6de8..1811f5dde48aacbf9ed9945d9a15eb8596d40ba9 100755 (executable)
--- 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))