note="$@"
program=$1
shift
- $program "$@"
+ $program "$@" >> test.out 2>&1
if [ $? -ne 0 ]; then
printf 'not ';
fi
}
require() {
- note="$@"
+ note="$*"
program=$1
shift
- $program "$@"
- if [ $? -ne 0 ]; then
- printf "bail out! fail[$?]: $@\n"
- exit 255;
- fi
+ $program "$@" >> test.out 2>&1
+ rv=$?
tn=$((tn + 1))
+ if [ $rv -ne 0 ]; then
+ printf 'not ok %d - %s %s\n' $tn $program "$*"
+ bailout "exit status $rv";
+ fi
printf 'ok %d - %s %s\n' $tn $program "$*"
}
+bailout() {
+ diag "$@"
+ printf "bail out!\n";
+ exit 255;
+}
+
shownote() {
if [ "$note" != "" ]; then
printf '# %s\n' "$note"
printf '# %s\n' "$@"
}
+diagfile() {
+ sed -e 's/^/# /' $1
+}
+
+diagstdin() {
+ sed -e 's/^/# /'
+}
+
okexit() {
exitwith 0 "$*"
}