This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix magic.t's expectation for $^X under minitest when the OS makes $^X absolute
authorNicholas Clark <nick@ccl4.org>
Fri, 25 Feb 2011 14:01:43 +0000 (14:01 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 6 Mar 2011 09:13:49 +0000 (09:13 +0000)
Under minitest, t/perl is a symlink to ../perl. Test scripts are invoked with
./perl. When $Config{d_procselfexe} is undefined, $^X is still ./perl.
When it is defined, the OS resolves it to the absolute path .../miniperl.
Fix t/op/magic.t to be aware of this. Previously it was working for all cases
other than [$Config{d_procselfexe} is defined] and [make minitest] and
[perl does not exist].

t/op/magic.t

index 6c9f95e..403cba7 100644 (file)
@@ -193,7 +193,7 @@ like ($@, qr/^Modification of a read-only value attempted/);
     else {
        $wd = '.';
     }
-    my $perl = $Is_VMS ? $^X : "$wd/perl";
+    my $perl = $Is_VMS || $Config{d_procselfexe} ? $^X : "$wd/perl";
     my $headmaybe = '';
     my $middlemaybe = '';
     my $tailmaybe = '';
@@ -237,7 +237,7 @@ EOH
     $s1 = "\$^X is $perl, \$0 is $script\n";
     ok open(SCRIPT, ">$script") or diag "Can't write to $script: $!";
     ok print(SCRIPT $headmaybe . <<EOB . $middlemaybe . <<'EOF' . $tailmaybe) or diag $!;
-#!$wd/perl
+#!$perl
 EOB
 print "\$^X is $^X, \$0 is $0\n";
 EOF
@@ -246,7 +246,6 @@ EOF
     $_ = $Is_VMS ? `$perl $script` : `$script`;
     s/\.exe//i if $Is_Dos or $Is_Cygwin or $Is_os2;
     s{./$script}{$script} if $Is_BeOS; # revert BeOS execvp() side-effect
-    s{\bminiperl\b}{perl}; # so that test doesn't fail with miniperl
     s{is perl}{is $perl}; # for systems where $^X is only a basename
     s{\\}{/}g;
     if ($Is_MSWin32 || $Is_os2) {