]> git.ozlabs.org Git - ponghero.git/blobdiff - ccan/ccan_tools/libtap/tests/test.t
Prepare for release: rename to ponghero and pull in ccan.
[ponghero.git] / ccan / ccan_tools / libtap / tests / test.t
diff --git a/ccan/ccan_tools/libtap/tests/test.t b/ccan/ccan_tools/libtap/tests/test.t
new file mode 100644 (file)
index 0000000..abd176c
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+echo '1..2'
+
+make 2>&1 > /dev/null || exit 1
+
+# Comment this out if you care about exact formatting
+rationalize()
+{
+    tr -s ' ' | sed -e 's/ tests / test /' -e "s/ test '[^']*'/ test ()/" -e "s/ test (.*)/ test ()/" -e 's, Second plan at \./test.pl line.*,,' -e 's,Failed test in ./test.pl at line .*,Failed test (),'
+}
+
+perl ./test.pl 2>&1 | rationalize | grep -v '^# \+in ./test.pl at line'> test.pl.out
+perlstatus=$?
+
+./test 2>&1 | rationalize > test.c.out
+cstatus=$?
+
+ret=0
+diff -u test.pl.out test.c.out
+
+if [ $? -eq 0 ]; then
+       echo 'ok 1 - output is identical'
+else
+       echo 'not ok 1 - output is identical'
+       ret=1
+fi
+
+if [ $perlstatus -eq $cstatus ]; then
+       echo 'ok 2 - status code'
+else
+       echo 'not ok 2 - status code'
+       echo "# perlstatus = $perlstatus"
+       echo "#    cstatus = $cstatus"
+       ret=1
+fi
+
+exit $ret