git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t1006: fix broken TAP format

From
Patrick Steinhardt <ps@pks.im>
Date
Jul 8, 2025, 10:18 UTC
Message-ID
<20250708-b4-pks-t1006-fix-tap-format-v1-1-c3f837448364@pks.im>

When running t1006 via Meson we receive an error about invalid TAP format:

    $ meson test t1006-cat-file
    1/1 t1006-cat-file        OK              3.86s   420 subtests passed
    stdout: 147: UNKNOWN: c308ae01840d8e620ad554ee5d77fe114dc2d912:path with spaces
    stdout: 159: UNKNOWN: 3625298bf5e7c464a7d0e38ea80c2a5b5904d9a3e5b2b025b67f360e09b68dc7:path with spaces
    ERROR: Unknown TAP output lines for a supported TAP version.
    This is probably a bug in the test; if they are not TAP syntax, prefix them with a #
    Ok:                1
    Fail:              0

While Meson copes with it alright, it's still annoying to see these errors on every test run.

The root cause of the broken format is a call to grep(1) that gets executed outside of a test case, which has been added recently via 9fd38038b9c (t1006: update 'run_tests' to test generic object specifiers, 2025-06-02). This call is done to determine whether a subsequent test case is expected to succeed or fail, so it makes sense to have it execute outside of a test case. But whenever we do that, we must be extra careful to not generate any output that breaks the TAP format.

Fix the issue by adding '-q' to the command so that it doesn't print any matching lines.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Hi,

this issue has been bugging me for a couple days, so I decided to finally fix it :) With this fix all tests that aren't skipped on my machine conform to the TAP format.

Patrick
---
 t/t1006-cat-file.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index f123ef1e360..1f61b666a7d 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -197,7 +197,7 @@ $content"
     # FIXME: %(rest) is incompatible with object names that include whitespace,
     # e.g. HEAD:path/to/a/file with spaces. Use the resolved OID as input to
     # test this instead of the raw object name.
-    if echo "$object_name" | grep " "; then
+    if echo "$object_name" | grep -q " "; then
 	test_rest=test_expect_failure
     else
 	test_rest=test_expect_success

---
base-commit: 41905d60226a0346b22f0d0d99428c746a5a3b14
change-id: 20250708-b4-pks-t1006-fix-tap-format-2ab169c782a0
Message 1 of 1 in “t1006: fix broken TAP format”
  1. t1006: fix broken TAP formatPatrick Steinhardt, Jul 8, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.