diff options
Diffstat (limited to 'src/test/perl/TestLib.pm')
-rw-r--r-- | src/test/perl/TestLib.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index 7d017d49bd0..b6862688d4f 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -11,6 +11,7 @@ use strict; use warnings; use Config; +use Cwd; use Exporter 'import'; use File::Basename; use File::Spec; @@ -158,6 +159,23 @@ sub tempdir_short return File::Temp::tempdir(CLEANUP => 1); } +# Return the real directory for a virtual path directory under msys. +# The directory must exist. If it's not an existing directory or we're +# not under msys, return the input argument unchanged. +sub real_dir +{ + my $dir = "$_[0]"; + return $dir unless -d $dir; + return $dir unless $Config{osname} eq 'msys'; + my $here = cwd; + chdir $dir; + # this odd way of calling 'pwd -W' is the only way that seems to work. + $dir = qx{sh -c "pwd -W"}; + chomp $dir; + chdir $here; + return $dir; +} + sub system_log { print("# Running: " . join(" ", @_) . "\n"); |