From a006bdd2724a262acdd5b79596526d069114a336 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 21 Mar 2023 23:25:43 -0400 Subject: [PATCH] TAPify the ancient-diffs report. --- tests/Makefile | 4 ++-- tests/tapdiffer | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index 347b0f9..f2addb9 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -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 diff --git a/tests/tapdiffer b/tests/tapdiffer index 3ddd629..f48bcc3 100755 --- a/tests/tapdiffer +++ b/tests/tapdiffer @@ -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 -- 2.31.1