{"thread":{"id":"63757","subject":"[PATCH] t1006: fix broken TAP format","startedAt":"2025-07-08T10:19:09Z","lastAt":"2025-07-08T10:19:09Z","messageCount":1,"participants":["Patrick Steinhardt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"521525","messageId":"20250708-b4-pks-t1006-fix-tap-format-v1-1-c3f837448364@pks.im","threadId":"63757","inReplyTo":null,"subject":"[PATCH] t1006: fix broken TAP format","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-07-08T10:18:58Z","receivedAt":"2025-07-08T10:19:09Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"When running t1006 via Meson we receive an error about invalid TAP\nformat:\n\n    $ meson test t1006-cat-file\n    1/1 t1006-cat-file        OK              3.86s   420 subtests passed\n\n    stdout: 147: UNKNOWN: c308ae01840d8e620ad554ee5d77fe114dc2d912:path with spaces\n    stdout: 159: UNKNOWN: 3625298bf5e7c464a7d0e38ea80c2a5b5904d9a3e5b2b025b67f360e09b68dc7:path with spaces\n    ERROR: Unknown TAP output lines for a supported TAP version.\n    This is probably a bug in the test; if they are not TAP syntax, prefix them with a #\n\n    Ok:                1\n    Fail:              0\n\nWhile Meson copes with it alright, it's still annoying to see these\nerrors on every test run.\n\nThe root cause of the broken format is a call to grep(1) that gets\nexecuted outside of a test case, which has been added recently via\n9fd38038b9c (t1006: update 'run_tests' to test generic object\nspecifiers, 2025-06-02). This call is done to determine whether a\nsubsequent test case is expected to succeed or fail, so it makes sense\nto have it execute outside of a test case. But whenever we do that, we\nmust be extra careful to not generate any output that breaks the TAP\nformat.\n\nFix the issue by adding '-q' to the command so that it doesn't print\nany matching lines.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\nHi,\n\nthis issue has been bugging me for a couple days, so I decided to\nfinally fix it :) With this fix all tests that aren't skipped on my\nmachine conform to the TAP format.\n\nPatrick\n---\n t/t1006-cat-file.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh\nindex f123ef1e360..1f61b666a7d 100755\n--- a/t/t1006-cat-file.sh\n+++ b/t/t1006-cat-file.sh\n@@ -197,7 +197,7 @@ $content\"\n     # FIXME: %(rest) is incompatible with object names that include whitespace,\n     # e.g. HEAD:path/to/a/file with spaces. Use the resolved OID as input to\n     # test this instead of the raw object name.\n-    if echo \"$object_name\" | grep \" \"; then\n+    if echo \"$object_name\" | grep -q \" \"; then\n \ttest_rest=test_expect_failure\n     else\n \ttest_rest=test_expect_success\n\n---\nbase-commit: 41905d60226a0346b22f0d0d99428c746a5a3b14\nchange-id: 20250708-b4-pks-t1006-fix-tap-format-2ab169c782a0\n\n"}]}