From: Jeff King Date: Tue, 27 Oct 2026 17:36:45 GMT Subject: [PATCH 4/8] test-lib: allow an external program to supply TAP output Message-ID: <20261027173645.GD136740@coredump.intra.peff.net> In-Reply-To: <20261027173205.GA97799@coredump.intra.peff.net> A program which produces its own TAP output can't use test-lib.sh, because our TAP header and test counts conflict. We used to support this with test_external, but dropped it in 5beca49a0b (test-lib: simplify by removing test_external, 2022-07-28). That interface let you mix shell tests with external TAP, which required special handling for the test counts. But we can bring back a much simpler variant: tell test-lib.sh up front that it will be a thin wrapper for an external TAP generator, and let it stay out of the way. Now you might ask what is the point of using test-lib.sh at all if it's not going to generate any output. And the point is: it does other useful setup, like handling logging, setting certain environment variables, and so on. The next commit will wrap the clar unit-tests which will bring some real-world benefits. The only changes we need here are avoiding the TAP header and the plan count. Note that if we skip the whole script via GIT_SKIP_TESTS, though, we still have to emit a count (since we wouldn't run the external command at all). Signed-off-by: Jeff King --- t/test-lib.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/t/test-lib.sh b/t/test-lib.sh index 3d001b91da..3754db0ea7 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1277,8 +1277,11 @@ test_done () { # Maybe print SKIP message test -z "$skip_all" || skip_all="# SKIP $skip_all" - case "$test_count" in - 0) + case "$test_external,$skip_all,$test_count" in + t,,*) + : nothing + ;; + *,*,0) say "1..$test_count${skip_all:+ $skip_all}" ;; *) @@ -1534,7 +1537,7 @@ then BAIL_OUT 'You need to build test-tool; Run "make t/helper/test-tool" in the source (toplevel) directory' fi -if test -n "$HARNESS_ACTIVE" +if test -n "$HARNESS_ACTIVE" && test -z "$test_external" then say "TAP version 13" say "pragma +strict" -- 2.56.0.559.g7c1a1d8168