Skip to content

Commit be38ca3

Browse files
bookgitster
authored andcommitted
Make sure $PERL_PATH is defined when the test suite is run.
Some test scripts run Perl scripts as if they were git-* scripts, and thus need to use the same perl that will be put in the shebang line of git*.perl commands. $PERL_PATH therefore needs to be used instead of a bare "perl". The tests can fail if another perl is found in $PATH before the one defined in $PERL_PATH. Example test failure caused by this: the perl defined in $PERL_PATH has Error.pm installed, and therefore the Git.pm's Makefile.PL doesn't install the private copy. The perl from $PATH doesn't have Error.pm installed, and all git*.perl scripts invoked during the test will fail loading Error.pm. Makefile patch by Jeff King <[email protected]>. Signed-off-by: Philippe Bruhat (BooK) <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 78d553b commit be38ca3

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,7 @@ GIT-CFLAGS: .FORCE-GIT-CFLAGS
16261626
# and the first level quoting from the shell that runs "echo".
16271627
GIT-BUILD-OPTIONS: .FORCE-GIT-BUILD-OPTIONS
16281628
@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
1629+
@echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@
16291630
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
16301631
@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
16311632
@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@

t/t9400-git-cvsserver-server.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ then
2020
say 'skipping git-cvsserver tests, cvs not found'
2121
test_done
2222
fi
23-
perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
23+
"$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
2424
say 'skipping git-cvsserver tests, Perl SQLite interface unavailable'
2525
test_done
2626
}

t/t9401-git-cvsserver-crlf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ then
5757
say 'skipping git-cvsserver tests, perl not available'
5858
test_done
5959
fi
60-
perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
60+
"$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
6161
say 'skipping git-cvsserver tests, Perl SQLite interface unavailable'
6262
test_done
6363
}

t/t9700-perl-git.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if ! test_have_prereq PERL; then
1111
test_done
1212
fi
1313

14-
perl -MTest::More -e 0 2>/dev/null || {
14+
"$PERL_PATH" -MTest::More -e 0 2>/dev/null || {
1515
say "Perl Test::More unavailable, skipping test"
1616
test_done
1717
}
@@ -48,6 +48,6 @@ test_expect_success \
4848

4949
test_external_without_stderr \
5050
'Perl API' \
51-
perl "$TEST_DIRECTORY"/t9700/test.pl
51+
"$PERL_PATH" "$TEST_DIRECTORY"/t9700/test.pl
5252

5353
test_done

0 commit comments

Comments
 (0)