summaryrefslogtreecommitdiff
path: root/runtests.SH
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafayette.edu>2014-03-13 16:16:22 -0400
committerAndy Dougherty <doughera@lafayette.edu>2014-03-18 07:15:37 -0400
commit7d18793f050900d85e6cdbba5505b99cea51fe26 (patch)
tree8d83ff3cd1a3509a2de1be01f7695eb16b1bde56 /runtests.SH
parentf1397316ff9824d76d2953cfd3cef2bef5be92ee (diff)
downloadperl-7d18793f050900d85e6cdbba5505b99cea51fe26.tar.gz
Make sure the PWD environment variable points to the t directory.
runtests is typically run under /bin/sh. If the user uses a different interactive shell (such as /bin/ksh) that maintains the PWD environment variable, but /bin/sh does not, then the 'cd t' line in runtests ends up changing the working directory without updating $PWD. Several tests in t/io/fs.t rely on being able to change directories and then get back to the original. The tests assume that if $PWD is set at all, then it is set correctly. This fix changes runtests to ensure it is so.
Diffstat (limited to 'runtests.SH')
-rwxr-xr-xruntests.SH9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtests.SH b/runtests.SH
index 481a237f6b..78c879bb63 100755
--- a/runtests.SH
+++ b/runtests.SH
@@ -61,6 +61,15 @@ 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.