TAPify the ancient-diffs report.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 22 Mar 2023 03:25:43 +0000 (23:25 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 22 Mar 2023 04:05:58 +0000 (00:05 -0400)
tests/Makefile
tests/tapdiffer

index 347b0f9b31a22fb479212cb110673a437027e4ac..f2addb991dbc0e1fa6dfb1407417227c9aa04705 100644 (file)
@@ -136,8 +136,8 @@ count:
 
 ancient: $(SGAMES)
        @if [ -f ../advent430 ]; then cp ../advent430 ../adventure.data .; else echo "advent430 nonexistent"; exit 1; fi
-       @for x in *.log; do stem=$${x%.log}; echo $${stem}; ./advent430 <$${stem}.log | ./oldfilter >$${stem}.ochk; done 
-       @for x in *.log; do stem=$${x%.log}; ./newfilter <$${stem}.chk | diff -ubZ $${stem}.ochk -; done
+       @-for x in *.log; do stem=$${x%.log}; echo $${stem}; ./advent430 <$${stem}.log | ./oldfilter >$${stem}.ochk; done
+       @-(for x in *.log; do stem=$${x%.log}; legend=$$(sed -n '/^## /s///p' <$$x 2>/dev/null || echo "(no description)"); ./newfilter <$${stem}.chk | tapdiffer -w "$${legend}" $${stem}.ochk; done; echo 1..$(words $(shell ls *.log))) | tapview
        @rm *.ochk advent430 adventure.data
 
 # end
index 3ddd6296bdd9c47ad4b26613ef8b86a09f016d41..f48bcc336ed5437e687f75364adb8ccb12ff4a1d 100755 (executable)
@@ -8,12 +8,20 @@
 # A nonempty diff is shipped as a TAP YAML block following "not ok" 
 # unless QUIET=1 in the environment.
 #
+if [ "$1" = "-w" ]
+then
+    diffopts=-ubZ
+    shift
+else
+    diffopts=-u
+fi
+
 legend=$1
 checkfile=$2
 
 trap 'rm /tmp/tapdiff$$' EXIT HUP INT QUIT TERM
 
-if diff --text -u ${checkfile} - >/tmp/tapdiff$$
+if diff --text "${diffopts}" ${checkfile} - >/tmp/tapdiff$$
 then
        echo "ok - ${legend}"
 else