Switch normal regression testing to TAP output.

This commit is contained in:
Eric S. Raymond 2022-04-13 03:13:53 -04:00
parent 129136b51e
commit d235313e97
3 changed files with 223 additions and 17 deletions

31
tests/tapdiffer Executable file
View file

@ -0,0 +1,31 @@
#! /bin/sh
#
# tapdiffer - Render diff between input and checkfile as a TAP report
#
# Usage: tapdiffer LEGEND CHECKFILE
#
# Output is a TAP report, ok if the diff is empty and not ok otherwise.
# A nonempty diff is shipped as a TAP YAML block following "not ok"
# unless QUIET=1 in the environment.
#
legend=$1
checkfile=$2
trap 'rm /tmp/tapdiff$$' EXIT HUP INT QUIT TERM
if diff --text -u ${checkfile} - >/tmp/tapdiff$$
then
echo "ok - ${legend}"
exit 0
else
echo "not ok - ${checkfile}: ${legend}"
if [ ! "${QUIET}" = 1 ]
then
echo " --- |"
sed </tmp/tapdiff$$ -e 's/^/ /'
echo " ..."
fi
exit 1
fi
# end