X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan_tools%2Flibtap%2Ftests%2Ftest.t;fp=ccan_tools%2Flibtap%2Ftests%2Ftest.t;h=abd176c5797057f70be7feb4cffb798c5ddc4b30;hb=7bbd49fdb03503688dd34ab860e0e02e852ed267;hp=0000000000000000000000000000000000000000;hpb=fdfcdafbfa7957b6ca393bb4000fbaad3813a61a;p=ccan diff --git a/ccan_tools/libtap/tests/test.t b/ccan_tools/libtap/tests/test.t new file mode 100644 index 00000000..abd176c5 --- /dev/null +++ b/ccan_tools/libtap/tests/test.t @@ -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