--- /dev/null
+#!/bin/sh
+
+tn=0
+planned=0
+
+tryrun() {
+ note="$@"
+ program=$1
+ shift
+ $program "$@"
+ if [ $? -ne 0 ]; then
+ printf 'not ';
+ fi
+ tn=$((tn + 1))
+ printf 'ok %d - %s %s\n' $tn $program "$*"
+}
+
+shownote() {
+ if [ "$note" != "" ]; then
+ printf '# %s\n' "$note"
+ fi
+}
+
+okexit() {
+ exitwith 0 "$*"
+}
+
+failsok() {
+ note=
+ if [ $? -eq 0 ]; then
+ printf 'not ';
+ note=$(printf '# got "%d" expected "%d"' "$1" "0")
+ fi
+ tn=$((tn + 1))
+ printf 'ok %d - %s\n' $tn "$*"
+ shownote
+}
+
+exitwith() {
+ note=
+ if [ $? -ne $1 ]; then
+ printf 'not ';
+ note=$(printf '# got "%d" expected "%d"' "$1" "$2")
+ fi
+ shift
+ tn=$((tn + 1))
+ printf 'ok %d - %s\n' $tn "$*"
+ shownote
+}
+
+okstreq() {
+ note=
+ if [ "$1" != "$2" ]; then
+ printf 'not ';
+ note=$(printf 'got "%s" expected "%s"' "$1" "$2")
+ fi
+
+ shift;shift;
+ tn=$((tn + 1))
+ printf 'ok %d - %s\n' $tn "$*"
+ shownote
+}
+
+plan() {
+ planned=$1
+ printf '1..%d\n' $planned
+}
+
+finish() {
+ if [ $planned -eq 0 ]; then
+ printf '1..%d\n' $tn
+ fi
+}