Skip to content

Commit 7a7b602

Browse files
pks-tgitster
authored andcommitted
t5703: refactor test to not depend on Perl
We use Perl due to two different reasons in t5703: - To filter advertised capabilities. - To set up a CGI script with HTTPD. Refactor the first category to use `test_grep` instead. Refactoring the second category would be a bit more involved, so instead we add the PERL_TEST_HELPERS prerequisite to those individual tests now. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 88bef8d commit 7a7b602

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

t/t5703-upload-pack-ref-in-want.sh

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ test_description='upload-pack ref-in-want'
44

55
. ./test-lib.sh
66

7-
if ! test_have_prereq PERL_TEST_HELPERS
8-
then
9-
skip_all='skipping upload-pack ref-in-want tests; Perl not available'
10-
test_done
11-
fi
12-
137
get_actual_refs () {
148
sed -n -e '/wanted-refs/,/0001/{
159
/wanted-refs/d
@@ -89,18 +83,15 @@ test_expect_success 'setup repository' '
8983

9084
test_expect_success 'config controls ref-in-want advertisement' '
9185
test-tool serve-v2 --advertise-capabilities >out &&
92-
perl -ne "/ref-in-want/ and print" out >out.filter &&
93-
test_must_be_empty out.filter &&
86+
test_grep ! "ref-in-want" out &&
9487
9588
git config uploadpack.allowRefInWant false &&
9689
test-tool serve-v2 --advertise-capabilities >out &&
97-
perl -ne "/ref-in-want/ and print" out >out.filter &&
98-
test_must_be_empty out.filter &&
90+
test_grep ! "ref-in-want" out &&
9991
10092
git config uploadpack.allowRefInWant true &&
10193
test-tool serve-v2 --advertise-capabilities >out &&
102-
perl -ne "/ref-in-want/ and print" out >out.filter &&
103-
test_file_not_empty out.filter
94+
test_grep "ref-in-want" out
10495
'
10596

10697
test_expect_success 'invalid want-ref line' '
@@ -486,7 +477,7 @@ inconsistency () {
486477
EOF
487478
}
488479

489-
test_expect_success 'server is initially ahead - no ref in want' '
480+
test_expect_success PERL_TEST_HELPERS 'server is initially ahead - no ref in want' '
490481
git -C "$REPO" config uploadpack.allowRefInWant false &&
491482
rm -rf local &&
492483
cp -r "$LOCAL_PRISTINE" local &&
@@ -495,7 +486,7 @@ test_expect_success 'server is initially ahead - no ref in want' '
495486
test_grep "fatal: remote error: upload-pack: not our ref" err
496487
'
497488

498-
test_expect_success 'server is initially ahead - ref in want' '
489+
test_expect_success PERL_TEST_HELPERS 'server is initially ahead - ref in want' '
499490
git -C "$REPO" config uploadpack.allowRefInWant true &&
500491
rm -rf local &&
501492
cp -r "$LOCAL_PRISTINE" local &&
@@ -507,7 +498,7 @@ test_expect_success 'server is initially ahead - ref in want' '
507498
test_cmp expected actual
508499
'
509500

510-
test_expect_success 'server is initially behind - no ref in want' '
501+
test_expect_success PERL_TEST_HELPERS 'server is initially behind - no ref in want' '
511502
git -C "$REPO" config uploadpack.allowRefInWant false &&
512503
rm -rf local &&
513504
cp -r "$LOCAL_PRISTINE" local &&
@@ -519,7 +510,7 @@ test_expect_success 'server is initially behind - no ref in want' '
519510
test_cmp expected actual
520511
'
521512

522-
test_expect_success 'server is initially behind - ref in want' '
513+
test_expect_success PERL_TEST_HELPERS 'server is initially behind - ref in want' '
523514
git -C "$REPO" config uploadpack.allowRefInWant true &&
524515
rm -rf local &&
525516
cp -r "$LOCAL_PRISTINE" local &&
@@ -531,7 +522,7 @@ test_expect_success 'server is initially behind - ref in want' '
531522
test_cmp expected actual
532523
'
533524

534-
test_expect_success 'server loses a ref - ref in want' '
525+
test_expect_success PERL_TEST_HELPERS 'server loses a ref - ref in want' '
535526
git -C "$REPO" config uploadpack.allowRefInWant true &&
536527
rm -rf local &&
537528
cp -r "$LOCAL_PRISTINE" local &&

0 commit comments

Comments
 (0)