This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Final perldelta change for 5.21.3
[perl5.git] / runtests.SH
index 24e1ffa..78c879b 100755 (executable)
@@ -16,21 +16,26 @@ case "$0" in
 esac
 echo "Extracting runtests (with variable substitutions)"
 rm -f runtests
+
 $spitshell >runtests <<!GROK!THIS!
 $startsh -e
 # runtests.SH
 # 
+!GROK!THIS!
 
-export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
+## In the following, dollars and backticks do not need the extra backslash.
+$spitshell >>runtests <<'!NO!SUBS!'
 
-case \$# in
+export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
+
+case $# in
     0)
        echo "runtests tty_flag ..."
        exit 1
        ;;
 esac
 
-case \$1 in
+case $1 in
     tty)
        tty=Y
        ;;
@@ -50,23 +55,31 @@ case \$1 in
        ;;
 esac
 
-if test X"\$TESTFILE" = X; then
+if test X"$TESTFILE" = X; then
     TESTFILE=TEST
 fi
 
-if test X"\$PERL" = X; then
-    PERL=./perl$_exe
-    export PERL
-fi
-
 cd t
 
+# If this is run under an old shell that doesn't automatically 
+# update PWD, then we must update it.  Otherwise, t/io/fs.t gets 
+# mixed up about what directory we are in.
+case "$PWD" in
+    '')  ;; # Do nothing if it isn't set at all.
+    */t) ;; # Leave it alone if it's properly updated.
+    *) PWD=${PWD}/t; export PWD ;;  # Otherwise, fix it.
+esac
+
+!NO!SUBS!
+
+## In the following, dollars and backticks do need the extra backslash.
+$spitshell >>runtests <<!GROK!THIS!
 # The second branch is for testing without a tty or controlling terminal,
 # see t/op/stat.t
 if test \$tty = Y; then
-    \$PERL \$TESTFILE \$TEST_ARGS \$TEST_FILES </dev/tty
+    ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES </dev/tty
 else
-    PERL_SKIP_TTY_TEST=1 \$PERL \$TESTFILE \$TEST_ARGS \$TEST_FILES
+    PERL_SKIP_TTY_TEST=1 ./perl$_exe \$TESTFILE \$TEST_ARGS \$TEST_FILES
 fi
 
 echo "Ran tests" > rantests