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

[PATCH 2/3] test-lib: Print missing prerequisites in test output

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Aug 6, 2010, 21:19 UTC
Message-ID
<1281129565-26124-3-git-send-email-avarab@gmail.com>
In-Reply-To
<1281129565-26124-1-git-send-email-avarab@gmail.com>

Change the test output to print needed prerequisites as part of the TAP. This makes it easy to see at a glance why a test was skipped. Before:

    ok 7 # skip <message>
    ok 9 # skip <message>
After:
    ok 7 # skip <message> (prereqs: DONTHAVEIT)
    ok 9 # skip <message> (prereqs: HAVEIT,DONTHAVEIT)

This'll also be useful for smoke testing output, where the developer reading the output may not be familiar with the system where tests are being skipped.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/test-lib.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 8701923..4e0a1c3 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -403,7 +403,7 @@ test_skip () {
 	case "$to_skip" in
 	t)
 		say_color skip >&3 "skipping test: $@"
-		say_color skip "ok $test_count # skip $1"
+		say_color skip "ok $test_count # skip $1 (prereqs: $prereq)"
 		: true
 		;;
 	*)
-- 
1.7.1
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 7 of 8 in “tests: Better prerequisite handling & documentation”
  1. 0/3 tests: Better prerequisite handling & documentationÆvar Arnfjörð Bjarmason, Aug 6, 2010
  2. 1/3 test-lib: Add support for multiple test prerequisitesÆvar Arnfjörð Bjarmason, Aug 6, 2010
  3. Jonathan NiederAug 8, 2010
  4. Jonathan NiederAug 8, 2010
  5. Johannes SixtAug 8, 2010
  6. Ævar Arnfjörð BjarmasonAug 8, 2010
  7. 2/3 test-lib: Print missing prerequisites in test outputÆvar Arnfjörð Bjarmason, Aug 6, 2010
  8. 3/3 t/README: Document the predefined test prerequisitesÆvar Arnfjörð Bjarmason, Aug 6, 2010

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.