t: stop announcing prereqs

We have a couple of cases where our tests end up announcing that a certain prerequisite is or isn't fulfilled. While this is supposed to help the developer it has the downside that it breaks the TAP format. We could convert these cases to just have a "#" prefix, but it feels rather unlikely that these are generally useful in the first place. We already do announce why a specific test is being skipped, so we should try to use this mechanism to the best extent possible. Stop announcing these prereqs to fix the TAP format. Where possible, convert the tests to rely on the prerequisites themselves to announce why a test ran or didn't ran. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jun 2, 2025 at 08:44 UTC faac9d46e0e2e87d87b0b4e2b9afbf68deaf234d
5 files changed +14 -43
t/t0050-filesystem.sh
+6 -24
@@ -10,53 +10,35 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10 auml=$(printf '\303\244')
11 aumlcdiar=$(printf '\141\314\210')
12
13 -if test_have_prereq CASE_INSENSITIVE_FS
14 -then
15 - say "will test on a case insensitive filesystem"
16 - test_case=test_expect_failure
17 -else
18 - test_case=test_expect_success
19 -fi
20 -
13 if test_have_prereq UTF8_NFD_TO_NFC
14 then
23 - say "will test on a unicode corrupting filesystem"
15 test_unicode=test_expect_failure
16 else
17 test_unicode=test_expect_success
18 fi
19
29 -test_have_prereq SYMLINKS ||
30 - say "will test on a filesystem lacking symbolic links"
31 -
32 -if test_have_prereq CASE_INSENSITIVE_FS
33 -then
34 -test_expect_success "detection of case insensitive filesystem during repo init" '
20 +test_expect_success CASE_INSENSITIVE_FS "detection of case insensitive filesystem during repo init" '
21 test $(git config --bool core.ignorecase) = true
22 '
37 -else
38 -test_expect_success "detection of case insensitive filesystem during repo init" '
23 +
24 +test_expect_success !CASE_INSENSITIVE_FS "detection of case insensitive filesystem during repo init" '
25 {
26 test_must_fail git config --bool core.ignorecase >/dev/null ||
27 test $(git config --bool core.ignorecase) = false
28 }
29 '
44 -fi
30
46 -if test_have_prereq SYMLINKS
47 -then
48 -test_expect_success "detection of filesystem w/o symlink support during repo init" '
31 +test_expect_success SYMLINKS "detection of filesystem w/o symlink support during repo init" '
32 {
33 test_must_fail git config --bool core.symlinks ||
34 test "$(git config --bool core.symlinks)" = true
35 }
36 '
54 -else
55 -test_expect_success "detection of filesystem w/o symlink support during repo init" '
37 +
38 +test_expect_success !SYMLINKS "detection of filesystem w/o symlink support during repo init" '
39 v=$(git config --bool core.symlinks) &&
40 test "$v" = false
41 '
59 -fi
42
43 test_expect_success "setup case tests" '
44 git config core.ignorecase true &&
t/t3600-rm.sh
-5
@@ -17,11 +17,6 @@ test_expect_success 'Initialize test directory' '
17 git commit -m "add normal files"
18 '
19
20 -if test_have_prereq !FUNNYNAMES
21 -then
22 - say 'Your filesystem does not allow tabs in filenames.'
23 -fi
24 -
20 test_expect_success FUNNYNAMES 'add files with funny names' '
21 touch -- "tab embedded" "newline${LF}embedded" &&
22 git add -- "tab embedded" "newline${LF}embedded" &&
t/t4000-diff-format.sh
+1 -1
@@ -36,7 +36,7 @@ test_expect_success 'git diff-files -p after editing work tree.' '
36 # that's as far as it comes
37 if [ "$(git config --get core.filemode)" = false ]
38 then
39 - say 'filemode disabled on the filesystem'
39 + skip_all='filemode disabled on the filesystem'
40 test_done
41 fi
42
t/t9500-gitweb-standalone-no-errors.sh
+7 -9
@@ -700,19 +700,17 @@ test_expect_success \
700 # ----------------------------------------------------------------------
701 # syntax highlighting
702
703 +test_lazy_prereq HIGHLIGHT '
704 + highlight_version=$(highlight --version </dev/null 2>/dev/null) &&
705 + test -n "$highlight_version"
706 +'
707
704 -highlight_version=$(highlight --version </dev/null 2>/dev/null)
705 -if [ $? -eq 127 ]; then
706 - say "Skipping syntax highlighting tests: 'highlight' not found"
707 -elif test -z "$highlight_version"; then
708 - say "Skipping syntax highlighting tests: incorrect 'highlight' found"
709 -else
710 - test_set_prereq HIGHLIGHT
708 +test_expect_success HIGHLIGHT '
709 cat >>gitweb_config.perl <<-\EOF
710 our $highlight_bin = "highlight";
713 - $feature{'highlight'}{'override'} = 1;
711 + $feature{"highlight"}{"override"} = 1;
712 EOF
715 -fi
713 +'
714
715 test_expect_success HIGHLIGHT \
716 'syntax highlighting (no highlight, unknown syntax)' \
t/t9903-bash-prompt.sh
-4
@@ -66,10 +66,6 @@ test_expect_success 'prompt - unborn branch' '
66 test_cmp expected "$actual"
67 '
68
69 -if test_have_prereq !FUNNYNAMES; then
70 - say 'Your filesystem does not allow newlines in filenames.'
71 -fi
72 -
69 test_expect_success FUNNYNAMES 'prompt - with newline in path' '
70 repo_with_newline="repo
71 with