Skip to content

Commit 23e21a5

Browse files
pks-tgitster
authored andcommitted
t: introduce PERL_TEST_HELPERS prerequisite
In the early days of Git, Perl was used quite prominently throughout the project. This has changed significantly as almost all of the executables we ship nowadays have eventually been rewritten in C. Only a handful of subsystems remain that require Perl: - gitweb, a read-only web interface. - A couple of scripts that allow importing repositories from GNU Arch, CVS and Subversion. - git-send-email(1), which can be used to send mails. - git-request-pull(1), which is used to request somebody to pull from a URL by sending an email. - git-filter-branch(1), which uses Perl with the `--state-branch` option. This command is typically recommended against nowadays in favor of git-filter-repo(1). - Our Perl bindings for Git. - The netrc Git credential helper. None of these subsystems can really be considered to be part of the "core" of Git, and an installation without them is fully functional. It is more likely than not that an end user wouldn't even notice that any features are missing if those tools weren't installed. But while Perl nowadays very much is an optional dependency of Git, there is a significant limitation when Perl isn't available: developers cannot run our test suite. Preceding commits have started to lift this restriction by removing the strict dependency on Perl in many central parts of the test library. But there are still many tests that rely on small Perl helpers to do various different things. Introduce a new PERL_TEST_HELPERS prerequisite that guards all tests that require Perl. This prerequisite is explicitly different than the preexisting PERL prerequisite: - PERL records whether or not features depending on the Perl interpreter are built. - PERL_TEST_HELPERS records whether or not a Perl interpreter is available for our tests. By having these two separate prerequisites we can thus distinguish between tests that inherently depend on Perl because the underlying feature does, and those tests that depend on Perl because the test itself is using Perl. Adapt all tests to set the PERL_TEST_HELPERS prerequisite as needed. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 21386ed commit 23e21a5

File tree

71 files changed

+281
-93
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+281
-93
lines changed

t/t0008-ignores.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ test_description=check-ignore
55
TEST_CREATE_REPO_NO_TEMPLATE=1
66
. ./test-lib.sh
77

8+
if ! test_have_prereq PERL_TEST_HELPERS
9+
then
10+
skip_all='skipping ignores tests; Perl not available'
11+
test_done
12+
fi
13+
814
init_vars () {
915
global_excludes="global-excludes"
1016
}

t/t0021-conversion.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ test_expect_success 'required process filter should be used only for "clean" ope
619619
)
620620
'
621621

622-
test_expect_success 'required process filter should process multiple packets' '
622+
test_expect_success PERL_TEST_HELPERS 'required process filter should process multiple packets' '
623623
test_config_global filter.protocol.process "test-tool rot13-filter --log=debug.log clean smudge" &&
624624
test_config_global filter.protocol.required true &&
625625
@@ -684,7 +684,7 @@ test_expect_success 'required process filter should process multiple packets' '
684684
)
685685
'
686686

687-
test_expect_success 'required process filter with clean error should fail' '
687+
test_expect_success PERL_TEST_HELPERS 'required process filter with clean error should fail' '
688688
test_config_global filter.protocol.process "test-tool rot13-filter --log=debug.log clean smudge" &&
689689
test_config_global filter.protocol.required true &&
690690
rm -rf repo &&

t/t0210-trace2-normal.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ test_description='test trace2 facility (normal target)'
44

55
. ./test-lib.sh
66

7+
if ! test_have_prereq PERL_TEST_HELPERS
8+
then
9+
skip_all='skipping trace2 tests; Perl not available'
10+
test_done
11+
fi
12+
713
# Turn off any inherited trace2 settings for this test.
814
sane_unset GIT_TRACE2 GIT_TRACE2_PERF GIT_TRACE2_EVENT
915
sane_unset GIT_TRACE2_BRIEF

t/t0211-trace2-perf.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ test_description='test trace2 facility (perf target)'
44

55
. ./test-lib.sh
66

7+
if ! test_have_prereq PERL_TEST_HELPERS
8+
then
9+
skip_all='skipping trace2 tests; Perl not available'
10+
test_done
11+
fi
12+
713
# Turn off any inherited trace2 settings for this test.
814
sane_unset GIT_TRACE2 GIT_TRACE2_PERF GIT_TRACE2_EVENT
915
sane_unset GIT_TRACE2_PERF_BRIEF

t/t0610-reftable-basics.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ test_expect_success 'basic: commit and list refs' '
643643
test_cmp actual expect
644644
'
645645

646-
test_expect_success 'basic: can write large commit message' '
646+
test_expect_success PERL_TEST_HELPERS 'basic: can write large commit message' '
647647
test_when_finished "rm -rf repo" &&
648648
git init repo &&
649649
perl -e "

t/t0613-reftable-write-options.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ test_expect_success 'small block size leads to multiple ref blocks' '
139139
)
140140
'
141141

142-
test_expect_success 'small block size fails with large reflog message' '
142+
test_expect_success PERL_TEST_HELPERS 'small block size fails with large reflog message' '
143143
test_when_finished "rm -rf repo" &&
144144
git init repo &&
145145
(

t/t1006-cat-file.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ extract_batch_output () {
12701270
' "$@"
12711271
}
12721272

1273-
test_expect_success 'cat-file --batch-all-objects --batch ignores replace' '
1273+
test_expect_success PERL_TEST_HELPERS 'cat-file --batch-all-objects --batch ignores replace' '
12741274
git cat-file --batch-all-objects --batch >actual.raw &&
12751275
extract_batch_output $orig <actual.raw >actual &&
12761276
{

t/t1007-hash-object.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,23 +205,23 @@ test_expect_success 'too-short tree' '
205205
grep "too-short tree object" err
206206
'
207207

208-
test_expect_success 'malformed mode in tree' '
208+
test_expect_success PERL_TEST_HELPERS 'malformed mode in tree' '
209209
hex_oid=$(echo foo | git hash-object --stdin -w) &&
210210
bin_oid=$(echo $hex_oid | hex2oct) &&
211211
printf "9100644 \0$bin_oid" >tree-with-malformed-mode &&
212212
test_must_fail git hash-object -t tree tree-with-malformed-mode 2>err &&
213213
grep "malformed mode in tree entry" err
214214
'
215215

216-
test_expect_success 'empty filename in tree' '
216+
test_expect_success PERL_TEST_HELPERS 'empty filename in tree' '
217217
hex_oid=$(echo foo | git hash-object --stdin -w) &&
218218
bin_oid=$(echo $hex_oid | hex2oct) &&
219219
printf "100644 \0$bin_oid" >tree-with-empty-filename &&
220220
test_must_fail git hash-object -t tree tree-with-empty-filename 2>err &&
221221
grep "empty filename in tree entry" err
222222
'
223223

224-
test_expect_success 'duplicate filename in tree' '
224+
test_expect_success PERL_TEST_HELPERS 'duplicate filename in tree' '
225225
hex_oid=$(echo foo | git hash-object --stdin -w) &&
226226
bin_oid=$(echo $hex_oid | hex2oct) &&
227227
{

t/t1010-mktree.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ test_expect_success 'ls-tree piped to mktree (2)' '
4141
test_cmp tree.withsub actual
4242
'
4343

44-
test_expect_success 'ls-tree output in wrong order given to mktree (1)' '
44+
test_expect_success PERL_TEST_HELPERS 'ls-tree output in wrong order given to mktree (1)' '
4545
perl -e "print reverse <>" <top |
4646
git mktree >actual &&
4747
test_cmp tree actual
4848
'
4949

50-
test_expect_success 'ls-tree output in wrong order given to mktree (2)' '
50+
test_expect_success PERL_TEST_HELPERS 'ls-tree output in wrong order given to mktree (2)' '
5151
perl -e "print reverse <>" <top.withsub |
5252
git mktree >actual &&
5353
test_cmp tree.withsub actual

t/t1450-fsck.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ test_expect_success 'unparseable tree object' '
346346
test_grep ! "fatal: empty filename in tree entry" out
347347
'
348348

349-
test_expect_success 'tree entry with type mismatch' '
349+
test_expect_success PERL_TEST_HELPERS 'tree entry with type mismatch' '
350350
test_when_finished "remove_object \$blob" &&
351351
test_when_finished "remove_object \$tree" &&
352352
test_when_finished "remove_object \$commit" &&
@@ -364,7 +364,7 @@ test_expect_success 'tree entry with type mismatch' '
364364
test_grep ! "dangling blob" out
365365
'
366366

367-
test_expect_success 'tree entry with bogus mode' '
367+
test_expect_success PERL_TEST_HELPERS 'tree entry with bogus mode' '
368368
test_when_finished "remove_object \$blob" &&
369369
test_when_finished "remove_object \$tree" &&
370370
blob=$(echo blob | git hash-object -w --stdin) &&
@@ -984,7 +984,7 @@ corrupt_index_checksum () {
984984

985985
# Corrupt the checksum on the index and then
986986
# verify that only fsck notices.
987-
test_expect_success 'detect corrupt index file in fsck' '
987+
test_expect_success PERL_TEST_HELPERS 'detect corrupt index file in fsck' '
988988
cp .git/index .git/index.backup &&
989989
test_when_finished "mv .git/index.backup .git/index" &&
990990
corrupt_index_checksum &&

0 commit comments

Comments
 (0)