diff options
author | Paul Smith <psmith@gnu.org> | 2020-01-03 01:53:47 -0500 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2020-01-03 02:08:59 -0500 |
commit | 7449abfe1b50f15e5de040ba20aa1916de24bfe1 (patch) | |
tree | f480fb8d9ac9836b5e4082f9116aa42a2fd80916 /tests/test_driver.pl | |
parent | 53b9770b403303ed536f82b320dc2eadeef46a16 (diff) | |
download | make-git-7449abfe1b50f15e5de040ba20aa1916de24bfe1.tar.gz |
* tests/test_driver.pl: Compute full path to Perl interpreter
Diffstat (limited to 'tests/test_driver.pl')
-rw-r--r-- | tests/test_driver.pl | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/test_driver.pl b/tests/test_driver.pl index bcf534d6..96a86e44 100644 --- a/tests/test_driver.pl +++ b/tests/test_driver.pl @@ -30,7 +30,9 @@ # $Id$ +use Config; use Cwd; +use File::Spec; # The number of test categories we've run $categories_run = 0; @@ -53,8 +55,32 @@ $test_passed = 1; $test_timeout = 5; $test_timeout = 10 if $^O eq 'VMS'; -# Path to Perl--make sure it uses forward-slashes +# Path to Perl $perl_name = $^X; +if ($^O ne 'VMS') { + $perl_name .= $Config{_exe} unless $perl_name =~ m/$Config{_exe}$/i; +} +# If it's a simple name, look it up on PATH +{ + my ($v,$d,$f) = File::Spec->splitpath($perl_name); + if (!$d) { + my $perl = undef; + foreach my $p (File::Spec->path()) { + my $f = File::Spec->catfile($p, $f); + if (-e $f) { + $perl = $f; + last; + } + } + if ($perl) { + $perl_name = $perl; + } else { + print "Cannot locate Perl interpreter $perl_name\n"; + } + } +} +# Make sure it uses forward-slashes even on Windows, else it won't work +# in recipes $perl_name =~ tr,\\,/,; # %makeENV is the cleaned-out environment. |