]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t: stop announcing prereqs
authorPatrick Steinhardt <ps@pks.im>
Mon, 2 Jun 2025 06:44:41 +0000 (08:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Jun 2025 14:51:41 +0000 (07:51 -0700)
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>
t/t0050-filesystem.sh
t/t3600-rm.sh
t/t4000-diff-format.sh
t/t9500-gitweb-standalone-no-errors.sh
t/t9903-bash-prompt.sh

index 5c9dc90d0b096d9f104caedeb035b50b919b6811..ca8568067d31d6e743c74917ed5dd156c526aa1b 100755 (executable)
@@ -10,53 +10,35 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 auml=$(printf '\303\244')
 aumlcdiar=$(printf '\141\314\210')
 
-if test_have_prereq CASE_INSENSITIVE_FS
-then
-       say "will test on a case insensitive filesystem"
-       test_case=test_expect_failure
-else
-       test_case=test_expect_success
-fi
-
 if test_have_prereq UTF8_NFD_TO_NFC
 then
-       say "will test on a unicode corrupting filesystem"
        test_unicode=test_expect_failure
 else
        test_unicode=test_expect_success
 fi
 
-test_have_prereq SYMLINKS ||
-       say "will test on a filesystem lacking symbolic links"
-
-if test_have_prereq CASE_INSENSITIVE_FS
-then
-test_expect_success "detection of case insensitive filesystem during repo init" '
+test_expect_success CASE_INSENSITIVE_FS "detection of case insensitive filesystem during repo init" '
        test $(git config --bool core.ignorecase) = true
 '
-else
-test_expect_success "detection of case insensitive filesystem during repo init" '
+
+test_expect_success !CASE_INSENSITIVE_FS "detection of case insensitive filesystem during repo init" '
        {
                test_must_fail git config --bool core.ignorecase >/dev/null ||
                        test $(git config --bool core.ignorecase) = false
        }
 '
-fi
 
-if test_have_prereq SYMLINKS
-then
-test_expect_success "detection of filesystem w/o symlink support during repo init" '
+test_expect_success SYMLINKS "detection of filesystem w/o symlink support during repo init" '
        {
                test_must_fail git config --bool core.symlinks ||
                test "$(git config --bool core.symlinks)" = true
        }
 '
-else
-test_expect_success "detection of filesystem w/o symlink support during repo init" '
+
+test_expect_success !SYMLINKS "detection of filesystem w/o symlink support during repo init" '
        v=$(git config --bool core.symlinks) &&
        test "$v" = false
 '
-fi
 
 test_expect_success "setup case tests" '
        git config core.ignorecase true &&
index 98259e2adaa9dba9fa6bbcb79e50948e69a6b9e6..1f16e6b52285bce57251951da88a02da1d44a3e7 100755 (executable)
@@ -17,11 +17,6 @@ test_expect_success 'Initialize test directory' '
        git commit -m "add normal files"
 '
 
-if test_have_prereq !FUNNYNAMES
-then
-       say 'Your filesystem does not allow tabs in filenames.'
-fi
-
 test_expect_success FUNNYNAMES 'add files with funny names' '
        touch -- "tab   embedded" "newline${LF}embedded" &&
        git add -- "tab embedded" "newline${LF}embedded" &&
index a51f881b1c9ee0751c845510049fafac35dc00b1..32b14e3a714b0b390a3ef9611af14960124c94ce 100755 (executable)
@@ -36,7 +36,7 @@ test_expect_success 'git diff-files -p after editing work tree.' '
 # that's as far as it comes
 if [ "$(git config --get core.filemode)" = false ]
 then
-       say 'filemode disabled on the filesystem'
+       skip_all='filemode disabled on the filesystem'
        test_done
 fi
 
index 7679780fb87b4f14e9c0f5a22708b1e8925a4d53..578d6c8b329358b6c7b4688376df8ee5f174365c 100755 (executable)
@@ -700,19 +700,17 @@ test_expect_success \
 # ----------------------------------------------------------------------
 # syntax highlighting
 
+test_lazy_prereq HIGHLIGHT '
+       highlight_version=$(highlight --version </dev/null 2>/dev/null) &&
+       test -n "$highlight_version"
+'
 
-highlight_version=$(highlight --version </dev/null 2>/dev/null)
-if [ $? -eq 127 ]; then
-       say "Skipping syntax highlighting tests: 'highlight' not found"
-elif test -z "$highlight_version"; then
-       say "Skipping syntax highlighting tests: incorrect 'highlight' found"
-else
-       test_set_prereq HIGHLIGHT
+test_expect_success HIGHLIGHT '
        cat >>gitweb_config.perl <<-\EOF
        our $highlight_bin = "highlight";
-       $feature{'highlight'}{'override'} = 1;
+       $feature{"highlight"}{"override"} = 1;
        EOF
-fi
+'
 
 test_expect_success HIGHLIGHT \
        'syntax highlighting (no highlight, unknown syntax)' \
index d667dda654e2de7f32d5f7d065f6eac59ca9fdbf..637a6f13a6d9b3b0b82744c254eb37d9b76905c5 100755 (executable)
@@ -66,10 +66,6 @@ test_expect_success 'prompt - unborn branch' '
        test_cmp expected "$actual"
 '
 
-if test_have_prereq !FUNNYNAMES; then
-       say 'Your filesystem does not allow newlines in filenames.'
-fi
-
 test_expect_success FUNNYNAMES 'prompt - with newline in path' '
     repo_with_newline="repo
 with