git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Make sure $PERL_PATH is defined when the test suite is run.

From
Philippe Bruhat (BooK) <book@cpan.org>
Date
Nov 16, 2009, 23:53 UTC
Message-ID
<1258415600-4656-1-git-send-email-book@cpan.org>
In-Reply-To
<20091116234849.GA3608@plop>

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 <peff@peff.net>.
Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
---
 Makefile                        |    1 +
 t/t9400-git-cvsserver-server.sh |    2 +-
 t/t9401-git-cvsserver-crlf.sh   |    2 +-
 t/t9700-perl-git.sh             |    4 ++--
 4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 35f5294..8e8f981 100644
--- a/Makefile
+++ b/Makefile
@@ -1633,6 +1633,7 @@ GIT-CFLAGS: .FORCE-GIT-CFLAGS
 # and the first level quoting from the shell that runs "echo".
 GIT-BUILD-OPTIONS: .FORCE-GIT-BUILD-OPTIONS
 	@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
+	@echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >$@
 	@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
 	@echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
 	@echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 64f947d..dc710f8 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -20,7 +20,7 @@ then
     say 'skipping git-cvsserver tests, cvs not found'
     test_done
 fi
-perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
+$PERL_PATH -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
     say 'skipping git-cvsserver tests, Perl SQLite interface unavailable'
     test_done
 }
diff --git a/t/t9401-git-cvsserver-crlf.sh b/t/t9401-git-cvsserver-crlf.sh
index aca40c1..c9e3dba 100755
--- a/t/t9401-git-cvsserver-crlf.sh
+++ b/t/t9401-git-cvsserver-crlf.sh
@@ -57,7 +57,7 @@ then
     say 'skipping git-cvsserver tests, perl not available'
     test_done
 fi
-perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
+$PERL_PATH -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
     say 'skipping git-cvsserver tests, Perl SQLite interface unavailable'
     test_done
 }
diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index 4eb7d3f..3354e18 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -11,7 +11,7 @@ if ! test_have_prereq PERL; then
 	test_done
 fi
 
-perl -MTest::More -e 0 2>/dev/null || {
+$PERL_PATH -MTest::More -e 0 2>/dev/null || {
 	say "Perl Test::More unavailable, skipping test"
 	test_done
 }
@@ -48,6 +48,6 @@ test_expect_success \
 
 test_external_without_stderr \
     'Perl API' \
-    perl "$TEST_DIRECTORY"/t9700/test.pl
+    $PERL_PATH "$TEST_DIRECTORY"/t9700/test.pl
 
 test_done
-- 
1.6.0.3.517.g759a
Previous: Philippe Bruhat (BooK)Next: Junio C Hamano
Message 6 of 18 in “Define $PERL_PATH in test-lib.sh”
  1. Define $PERL_PATH in test-lib.shPhilippe Bruhat (BooK), Nov 10, 2009
  2. Jeff KingNov 10, 2009
  3. Philippe Bruhat (BooK)Nov 10, 2009
  4. Junio C HamanoNov 15, 2009
  5. Philippe Bruhat (BooK)Nov 16, 2009
  6. Make sure $PERL_PATH is defined when the test suite is run.Philippe Bruhat (BooK), Nov 16, 2009
  7. Junio C HamanoNov 17, 2009
  8. Philippe Bruhat (BooK)Nov 17, 2009
  9. Make sure $PERL_PATH is defined when the test suite is run.Philippe Bruhat (BooK), Nov 17, 2009
  10. Johannes SixtNov 17, 2009
  11. Philippe Bruhat (BooK)Nov 17, 2009
  12. Junio C HamanoNov 17, 2009
  13. Make sure $PERL_PATH is defined when the test suite is run.Philippe Bruhat (BooK), Nov 17, 2009
  14. Johannes SixtNov 10, 2009
  15. Philippe Bruhat (BooK)Nov 10, 2009
  16. Junio C HamanoNov 10, 2009
  17. Philippe Bruhat (BooK)Nov 11, 2009
  18. Jeff KingNov 11, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.