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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
88bef8db84
commit
7a7b602267
@@ -4,12 +4,6 @@ test_description='upload-pack ref-in-want'
|
|||||||
|
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
if ! test_have_prereq PERL_TEST_HELPERS
|
|
||||||
then
|
|
||||||
skip_all='skipping upload-pack ref-in-want tests; Perl not available'
|
|
||||||
test_done
|
|
||||||
fi
|
|
||||||
|
|
||||||
get_actual_refs () {
|
get_actual_refs () {
|
||||||
sed -n -e '/wanted-refs/,/0001/{
|
sed -n -e '/wanted-refs/,/0001/{
|
||||||
/wanted-refs/d
|
/wanted-refs/d
|
||||||
@@ -89,18 +83,15 @@ test_expect_success 'setup repository' '
|
|||||||
|
|
||||||
test_expect_success 'config controls ref-in-want advertisement' '
|
test_expect_success 'config controls ref-in-want advertisement' '
|
||||||
test-tool serve-v2 --advertise-capabilities >out &&
|
test-tool serve-v2 --advertise-capabilities >out &&
|
||||||
perl -ne "/ref-in-want/ and print" out >out.filter &&
|
test_grep ! "ref-in-want" out &&
|
||||||
test_must_be_empty out.filter &&
|
|
||||||
|
|
||||||
git config uploadpack.allowRefInWant false &&
|
git config uploadpack.allowRefInWant false &&
|
||||||
test-tool serve-v2 --advertise-capabilities >out &&
|
test-tool serve-v2 --advertise-capabilities >out &&
|
||||||
perl -ne "/ref-in-want/ and print" out >out.filter &&
|
test_grep ! "ref-in-want" out &&
|
||||||
test_must_be_empty out.filter &&
|
|
||||||
|
|
||||||
git config uploadpack.allowRefInWant true &&
|
git config uploadpack.allowRefInWant true &&
|
||||||
test-tool serve-v2 --advertise-capabilities >out &&
|
test-tool serve-v2 --advertise-capabilities >out &&
|
||||||
perl -ne "/ref-in-want/ and print" out >out.filter &&
|
test_grep "ref-in-want" out
|
||||||
test_file_not_empty out.filter
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'invalid want-ref line' '
|
test_expect_success 'invalid want-ref line' '
|
||||||
@@ -486,7 +477,7 @@ inconsistency () {
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
test_expect_success 'server is initially ahead - no ref in want' '
|
test_expect_success PERL_TEST_HELPERS 'server is initially ahead - no ref in want' '
|
||||||
git -C "$REPO" config uploadpack.allowRefInWant false &&
|
git -C "$REPO" config uploadpack.allowRefInWant false &&
|
||||||
rm -rf local &&
|
rm -rf local &&
|
||||||
cp -r "$LOCAL_PRISTINE" local &&
|
cp -r "$LOCAL_PRISTINE" local &&
|
||||||
@@ -495,7 +486,7 @@ test_expect_success 'server is initially ahead - no ref in want' '
|
|||||||
test_grep "fatal: remote error: upload-pack: not our ref" err
|
test_grep "fatal: remote error: upload-pack: not our ref" err
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'server is initially ahead - ref in want' '
|
test_expect_success PERL_TEST_HELPERS 'server is initially ahead - ref in want' '
|
||||||
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
||||||
rm -rf local &&
|
rm -rf local &&
|
||||||
cp -r "$LOCAL_PRISTINE" local &&
|
cp -r "$LOCAL_PRISTINE" local &&
|
||||||
@@ -507,7 +498,7 @@ test_expect_success 'server is initially ahead - ref in want' '
|
|||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'server is initially behind - no ref in want' '
|
test_expect_success PERL_TEST_HELPERS 'server is initially behind - no ref in want' '
|
||||||
git -C "$REPO" config uploadpack.allowRefInWant false &&
|
git -C "$REPO" config uploadpack.allowRefInWant false &&
|
||||||
rm -rf local &&
|
rm -rf local &&
|
||||||
cp -r "$LOCAL_PRISTINE" local &&
|
cp -r "$LOCAL_PRISTINE" local &&
|
||||||
@@ -519,7 +510,7 @@ test_expect_success 'server is initially behind - no ref in want' '
|
|||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'server is initially behind - ref in want' '
|
test_expect_success PERL_TEST_HELPERS 'server is initially behind - ref in want' '
|
||||||
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
||||||
rm -rf local &&
|
rm -rf local &&
|
||||||
cp -r "$LOCAL_PRISTINE" local &&
|
cp -r "$LOCAL_PRISTINE" local &&
|
||||||
@@ -531,7 +522,7 @@ test_expect_success 'server is initially behind - ref in want' '
|
|||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'server loses a ref - ref in want' '
|
test_expect_success PERL_TEST_HELPERS 'server loses a ref - ref in want' '
|
||||||
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
||||||
rm -rf local &&
|
rm -rf local &&
|
||||||
cp -r "$LOCAL_PRISTINE" local &&
|
cp -r "$LOCAL_PRISTINE" local &&
|
||||||
|
|||||||
Reference in New Issue
Block a user