diff --git a/check.pl b/check.pl index 84a5955..5f524bb 100644 --- a/check.pl +++ b/check.pl @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.pl,v 1.16 2008/04/01 16:01:45 tg Exp $ +# $MirOS: src/bin/mksh/check.pl,v 1.17 2008/04/01 16:26:42 tg Exp $ # $OpenBSD: th,v 1.12 2005/05/28 04:53:47 millert Exp $ #- # Example test: @@ -58,6 +58,7 @@ # the test harness). # ENV is set to /nonexistant. # __progname is set to the -p argument. +# __perlname is set to $^X (perlexe). # file-setup mps Used to create files, directories # and symlinks. First word is either # file, dir or symlink; second word is @@ -130,6 +131,7 @@ use POSIX qw(EINTR); use Getopt::Std; +use Config; $os = defined $^O ? $^O : 'unknown'; @@ -236,6 +238,11 @@ foreach $env (('USER', 'LOGNAME', 'HOME', 'PATH', 'SHELL')) { $new_env{$env} = $ENV{$env} if defined $ENV{$env}; } $new_env{'ENV'} = '/nonexistant'; +if (($^O eq 'VMS') || ($Config{perlpath} =~ m/$Config{_exe}$/i)) { + $new_env{'__perlname'} = $Config{perlpath}; +} else { + $new_env{'__perlname'} = $Config{perlpath} . $Config{_exe}; +} if (defined $opt_e) { # XXX need a way to allow many -e arguments... if ($opt_e =~ /^([a-zA-Z_]\w*)(|=(.*))$/) { diff --git a/check.t b/check.t index 39950d0..901fbcd 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.166 2008/04/01 16:12:18 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.167 2008/04/01 16:26:42 tg Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ @@ -41,6 +41,13 @@ stdin: expected-stdout: --- +name: selftest-env +description: + Just output the environment variables set (always fails) +category: disabled +stdin: + set +--- name: alias-1 description: Check that recursion is detected/avoided in aliases. @@ -4288,8 +4295,8 @@ env-setup: !FOO=BAR! stdin: print '#!'"$__progname"'\nprint "a=$ENV{FOO}";' >t1 print '#!'"$__progname"'\nprint "a=$ENV{FOO}";' >t2 - print '#!/usr/bin/env perl\nprint "a=$ENV{FOO}\n";' >t3 - print '#!/usr/bin/env perl\nprint "a=$ENV{FOO}\n";' >t4 + print '#!'"$__perlname"'\nprint "a=$ENV{FOO}\n";' >t3 + print '#!'"$__perlname"'\nprint "a=$ENV{FOO}\n";' >t4 chmod +x t? ./t1 ./t2