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

Re: [PATCH] t: Replace 'perl' by $PERL_PATH

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 12, 2012, 16:44 UTC
Message-ID
<7vhaugjx9h.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vsje0jyxh.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 8 quoted lines
> Erik Faye-Lund <kusmabite@gmail.com> writes:
>
>> Having an MSYS version of Perl in PATH is "broken" in the Windows
>> world, so it's THIS Perl that people might want to keep out of their
>> PATH.
>
> Fair enough.  After all, that is why we have $PERL_PATH that can be
> used (and is used) in our Porcelain scripts.
Let's also apply something like this to t/README.
As to vfr's patch, I'll replace $PERL_PATH with "$PERL_PATH" and queue.
 t/README | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/t/README b/t/README
index 3534f43..4c3ea25 100644
--- a/t/README
+++ b/t/README
@@ -307,6 +307,25 @@ Don't:
    Use test_done instead if you need to stop the tests early (see
    "Skipping tests" below).
 
+ - use '! git cmd' when you want to make sure the git command exits
+   with failure in a controlled way by calling "die()".  Instead,
+   use 'test_must_fail git cmd'.  This will signal a failure if git
+   dies in an unexpected way (e.g. segfault).
+
+ - use perl without spelling it as "$PERL_PATH". This is to help our
+   friends on Windows where the platform Perl often adds CR before
+   the end of line, and they bundle Git with a version of Perl that
+   does not do so, whose path is specified with $PERL_PATH.
+
+ - use sh without spelling it as "$SHELL_PATH", when your script can
+   be misinterpreted by broken platform shell (e.g. Solaris).
+
+ - chdir around in tests.  It is not sufficient to chdir to
+   somewhere and then chdir back to the original location later in
+   the test, as any intermediate step can fail and abort the test,
+   causing the next test to start in an unexpected directory.  Do chdir
+   inside a subshell if necessary.
+
  - Break the TAP output
 
    The raw output from your test may be interpreted by a TAP harness. TAP
@@ -342,9 +361,9 @@ If you need to skip tests you should do so by using the three-arg form
 of the test_* functions (see the "Test harness library" section
 below), e.g.:
 
-    test_expect_success PERL 'I need Perl' "
-        '$PERL_PATH' -e 'hlagh() if unf_unf()'
-    "
+    test_expect_success PERL 'I need Perl' '
+        "$PERL_PATH" -e "hlagh() if unf_unf()"
+    '
 
 The advantage of skipping tests like this is that platforms that don't
 have the PERL and other optional dependencies get an indication of how
Previous: Junio C HamanoNext: Jeff King
Message 8 of 15 in “t: Replace 'perl' by $PERL_PATH”
  1. t: Replace 'perl' by $PERL_PATHvfr@lyx.org, Jun 11, 2012
  2. Junio C HamanoJun 11, 2012
  3. Jeff KingJun 12, 2012
  4. Junio C HamanoJun 12, 2012
  5. Jeff KingJun 12, 2012
  6. Erik Faye-LundJun 12, 2012
  7. Junio C HamanoJun 12, 2012
  8. Junio C HamanoJun 12, 2012
  9. Jeff KingJun 12, 2012
  10. Vincent van RavesteijnJun 12, 2012
  11. Torsten BögershausenJun 17, 2012
  12. Junio C HamanoJun 17, 2012
  13. Torsten BögershausenJun 17, 2012
  14. Junio C HamanoJun 17, 2012
  15. Torsten BögershausenJun 20, 2012

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.