# If either of the marked numbers there aren't 1, it means you need to
# update the corresponding magic number in the next two lines.
-# Reember, these need to stay the last things in the module.
-$cop_seq_base = svref_2object(eval 'sub{0;}')->START->cop_seq + 11;
-$seq_base = svref_2object(eval 'sub{}')->START->seq + 84;
+# Remember, these need to stay the last things in the module.
+
+# Why these are different for MacOS? Does it matter?
+my $cop_seq_mnum = $^O eq 'MacOS' ? 12 : 11;
+my $seq_mnum = $^O eq 'MacOS' ? 100 : 84;
+$cop_seq_base = svref_2object(eval 'sub{0;}')->START->cop_seq + $cop_seq_mnum;
+$seq_base = svref_2object(eval 'sub{}')->START->seq + $seq_mnum;
1;
my $redir = $Is_MacOS ? "" : "2>&1";
$a = `$^X $path "-MO=Deparse" -anlwi.bak -e 1 $redir`;
-$a =~ s/(?:# )?-e syntax OK\n//g; # "# " for Mac OS
+$a =~ s/-e syntax OK\n//g;
$a =~ s/.*possible typo.*\n//; # Remove warning line
$a =~ s{\\340\\242}{\\s} if (ord("\\") == 224); # EBCDIC, cp 1047 or 037
$a =~ s{\\274\\242}{\\s} if (ord("\\") == 188); # $^O eq 'posix-bc'
'???';
}
EOF
+$b =~ s/(LINE:)/sub BEGIN {
+ 'MacPerl'->bootstrap;
+ 'OSA'->bootstrap;
+ 'XL'->bootstrap;
+}
+$1/ if $Is_MacOS;
print "# [$a]\n\# vs expected\n# [$b]\nnot " if $a ne $b;
print "ok " . $i++ . "\n";
if $Config{useithreads};
# Schwern's example of finding an RV
my $path = join " ", map { qq["-I$_"] } @INC;
+ $path = '-I::lib -MMac::err=unix' if $^O eq 'MacOS';
my $redir = $^O eq 'MacOS' ? '' : "2>&1";
my $items = qx{$^X $path "-MO=Terse" -le "print \\42" $redir};
like( $items, qr/RV $hex \\42/, 'RV' );
use Cwd;
use strict;
use warnings;
+use File::Spec;
use File::Path;
use Test::More tests => 16;
my $IsVMS = $^O eq 'VMS';
+my $IsMacOS = $^O eq 'MacOS';
# check imports
can_ok('main', qw(cwd getcwd fastcwd fastgetcwd));
my $pwd_cmd =
($^O eq "NetWare") ?
"cd" :
+ ($IsMacOS) ?
+ "pwd" :
(grep { -x && -f } map { "$_/$pwd$Config{exe_ext}" }
split m/$Config{path_sep}/, $ENV{PATH})[0];
$want =~ s|/|\.|g;
$want .= '\]';
$want = '((?i)' . $want . ')'; # might be ODS-2 or ODS-5
+} elsif ( $IsMacOS ) {
+ $_ = ":$_" for ($Top_Test_Dir, $Test_Dir);
+ s|/|:|g, s|$|:| for ($want, $Test_Dir);
}
mkpath(["$Test_Dir"], 0, 0777);
# Cwd::chdir should also update $ENV{PWD}
like($ENV{PWD}, qr|$want$|, 'Cwd::chdir() updates $ENV{PWD}');
-Cwd::chdir "..";
+my $updir = File::Spec->updir;
+Cwd::chdir $updir;
print "#$ENV{PWD}\n";
-Cwd::chdir "..";
+Cwd::chdir $updir;
print "#$ENV{PWD}\n";
-Cwd::chdir "..";
+Cwd::chdir $updir;
print "#$ENV{PWD}\n";
-Cwd::chdir "..";
+Cwd::chdir $updir;
print "#$ENV{PWD}\n";
-Cwd::chdir "..";
+Cwd::chdir $updir;
print "#$ENV{PWD}\n";
rmtree([$Top_Test_Dir], 0, 0);
if ($IsVMS) {
like($ENV{PWD}, qr|\b((?i)t)\]$|);
}
+elsif ($IsMacOS) {
+ like($ENV{PWD}, qr|\bt:$|);
+}
else {
like($ENV{PWD}, qr|\bt$|);
}
my $abs_path = Cwd::abs_path("linktest");
my $fast_abs_path = Cwd::fast_abs_path("linktest");
- my $want = "t/$Test_Dir";
+ my $want = File::Spec->catdir("t", $Test_Dir) if $IsMacOS;
like($abs_path, qr|$want$|);
like($fast_abs_path, qr|$want$|);
# (You'll need to have Perl 5.7.3 or later, to have the Encode installed.)
# (And remember that under the Perl core distribution you should
# also have the $ENV{PERL_CORE} set to a true value.)
+# Similarly, to update MacOS section, run with $ENV{MAC_MD5SUM} set.
if (ord "A" == 193) { # EBCDIC
$EXPECT = <<EOT;
-b362148b17a451f0d81e0ebb2487756e Changes
-5a591a47e8c40fe4b78c744111511c45 README
-3157e2d2e27dacddea7c54efddc32520 MD5.pm
-4850753428db9422e8e5f97b401d5a13 MD5.xs
-276da0aa4e9a08b7fe09430c9c5690aa rfc1321.txt
+b362148b17a451f0d81e0ebb2487756e Changes
+5a591a47e8c40fe4b78c744111511c45 README
+3157e2d2e27dacddea7c54efddc32520 MD5.pm
+4850753428db9422e8e5f97b401d5a13 MD5.xs
+276da0aa4e9a08b7fe09430c9c5690aa rfc1321.txt
+EOT
+} elsif ("\n" == "\015") { # MacOS
+ $EXPECT = <<EOT;
+cc90a85f89b397341f97c9279640fbf5 Changes
+127952946201e6afc19eb41250c56871 README
+d87ec77c963d27198b7427156167a5b3 MD5.pm
+5be7049479ea47d7c257dabcae835720 MD5.xs
+f9a35714ee1d1d0c5a3a80f4dbea956a rfc1321.txt
EOT
} else {
$EXPECT = <<EOT;
require Encode;
my $data = cat_file($file);
Encode::from_to($data, 'latin1', 'cp1047');
- print md5_hex($data), " $base\n";
+ print md5_hex($data), " $base\n";
+ next;
+ }
+ if ($ENV{MAC_MD5SUM}) {
+ my $data = cat_file($file);
+ print md5_hex($data), " $base\n";
next;
}
my $md5bin = pack("H*", $md5hex);
chop($_ = VMS::Filespec::unixpath($_)) if $Is_VMS;
my $dir;
if ($Is_MacOS) {
- $_ .= ":" unless /:$/;
- $dir = "${_}auto:$modpname";
+ my $path = $_;
+ $path .= ":" unless /:$/;
+ $dir = "${path}auto:$modpname";
} else {
$dir = "$_/auto/$modpname";
}
print $stderr "ok 3\n";
# Since some systems don't have echo, we use Perl.
-$echo = qq{$^X -le "print q{ok %d}"};
+$echo = qq{$^X -le "print q(ok %d)"};
$cmd = sprintf $echo, 4;
print `$cmd`;
-$cmd = sprintf "$echo 1>&2", 5;
+$cmd = sprintf "$echo 1>&2", 5;
+$cmd = sprintf $echo, 5 if $^O eq 'MacOS';
print `$cmd`;
$stderr->close;
$stderr->fdopen($duperr,"w");
if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') { print `type Io.dup` }
-else { system 'cat Io.dup' }
+elsif ($^O eq 'MacOS') { system 'Catenate Io.dup' }
+else { system 'cat Io.dup' }
unlink 'Io.dup';
print STDOUT "ok 6\n";
use Config;
eval { use POSIX; };
if($@ || $^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'dos' ||
- ($^O eq 'VMS' && !$Config{'d_sigaction'})) {
+ $^O eq 'MacOS' || ($^O eq 'VMS' && !$Config{'d_sigaction'})) {
print "1..0\n";
exit 0;
}
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
+ push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS';
unless (find PerlIO::Layer 'perlio') {
print "1..0 # Skip: not perlio\n";
exit 0;
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
+ push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS';
require "../t/test.pl";
skip_all("No perlio") unless (find PerlIO::Layer 'perlio');
if (ord("A") == 193) {
print "ok 1\n";
arm(5);
- if ($has_echo && connect(T,pack_sockaddr_in(7,inet_aton("localhost")))){
+ my $host = $^O eq 'MacOS' ? '127.0.0.1' : 'localhost';
+ if ($has_echo && connect(T,pack_sockaddr_in(7,inet_aton($host)))){
arm(0);
print "ok 2\n";
if ($ENV{PERL_CORE}){
chdir('t') if -d 't';
@INC = ('.', '../lib');
+ push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS';
} else {
unshift @INC, 't';
}
# AutoLoader.t runs before this test, so it seems safe to assume that it will
# work.
-my $incdir;
-my $lib = '"-I../lib"'; # ok on unix, nt, The extra \" are for VMS
+my($incdir, $lib);
BEGIN {
chdir 't' if -d 't';
if ($^O eq 'dos') {
}
if ($^O eq 'MacOS') {
$incdir = ":auto-$$";
- $lib = '-x -I::lib:'; # -x overcomes MPW $Config{startperl} anomaly
+ $lib = '-I::lib:';
} else {
$incdir = "auto-$$";
+ $lib = '"-I../lib"'; # ok on unix, nt, The extra \" are for VMS
}
@INC = $incdir;
push @INC, '../lib';
close DATA;
}
-my $pathsep = $^O eq 'MSWin32' ? '\\' : '/';
-
+my $pathsep = $^O eq 'MSWin32' ? '\\' : $^O eq 'MacOS' ? ':' : '/';
+my $endpathsep = $^O eq 'MacOS' ? ':' : '';
+
sub split_a_file {
my $contents = shift;
my $file = $_[0];
if ($^O eq 'VMS') {
$dir = VMS::Filespec::unixify($dir);
$dir =~ s/\/$//;
+} elsif ($^O eq 'MacOS') {
+ $dir =~ s/:$//;
}
+
foreach (@tests) {
my $module = 'A' . $i . '_' . $$ . 'splittest';
my $file = File::Spec->catfile($incdir,"$module.pm");
s/\*DIR\*/$dir/gm;
s/\*MOD\*/$module/gm;
s/\*PATHSEP\*/$pathsep/gm;
+ s/\*ENDPATHSEP\*/$endpathsep/gm;
s#//#/#gm;
# Build a hash for this test.
my %args = /^\#\#\ ([^\n]*)\n # Key is on a line starting ##
}
}
if ($args{Require}) {
+ $args{Require} =~ s|/|:|gm if $^O eq 'MacOS';
my $com = 'require "' . File::Spec->catfile ('auto', $args{Require}) . '"';
$com =~ s{\\}{/}gm if ($^O eq 'MSWin32');
eval $com;
# And that was all it has. You were expected to manually inspect the output
## Get
Warning: AutoSplit had to create top-level *DIR* unexpectedly.
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
*INC**PATHSEP**MOD*.pm: some names are not unique when truncated to 8 characters:
- directory *DIR**PATHSEP**MOD*:
+ directory *DIR**PATHSEP**MOD**ENDPATHSEP*:
testtesttesttest4_1.al, testtesttesttest4_2.al truncate to testtest
- directory *DIR**PATHSEP*Yet*PATHSEP*Another*PATHSEP*AutoSplit:
+ directory *DIR**PATHSEP*Yet*PATHSEP*Another*PATHSEP*AutoSplit*ENDPATHSEP*:
testtesttesttest4_1.al, testtesttesttest4_2.al truncate to testtest
## Files
*DIR*/*MOD*/autosplit.ix
1;
__END__
## Get
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
## Require
*MOD*/autosplit.ix
## Files
sub obsolete {my $a if 0; return $a++;}
sub gonner {warn "This gonner function should never get called"}
## Get
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
## Require
*MOD*/autosplit.ix
## Files
sub zombie {"You didn't use fire."};
sub flying_pig {"Oink oink flap flap"};
## Get
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
## Require
*MOD*/autosplit.ix
## Files
sub ghost {"bump"};
sub wraith {9};
## Get
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
## Require
*MOD*/autosplit.ix
## Files
## Extra
0, 1, 0
## Get
-AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD*)
+AutoSplitting *INC**PATHSEP**MOD*.pm (*DIR**PATHSEP**MOD**ENDPATHSEP*)
## Require
*MOD*/autosplit.ix
## Files
or ($^O eq 'VMS'
and (`write sys\$output f\$privilege("SYSPRV")` =~ m/FALSE/))) {
skip "icmp ping requires root privileges.", 1;
+} elsif ($^O eq 'MacOS') {
+ skip "icmp protocol not supported.", 1;
} else {
my $p = new Net::Ping "icmp";
ok !!$p;
@INC = '../lib';
}
-use Test::More tests => 7;
+use Test::More;
BEGIN {
require Config; import Config;
{
plan skip_all => "Test uses Socket, Socket not built";
}
+ if ($^O eq 'MacOS') {
+ plan skip_all => "Test relies on resolution of localhost, fails on Mac OS";
+ }
}
+use Test::More tests => 7;
BEGIN { use_ok 'Net::hostent' }
is( $$fake_out, $vbl_0, '-pathlist parameter' );
}
-{ # Test exit status from pod2usage()
+SKIP: { # Test exit status from pod2usage()
+ skip "Exit status broken on Mac OS", 1 if $^O eq 'MacOS';
my $exit = ($^O eq 'VMS' ? 2 : 42);
my $dev_null = File::Spec->devnull;
my $args = join ", ", (
my($podfile, $testname) = @_;
my $cwd = Cwd::cwd();
- my $base_dir = catdir $cwd, "..", "lib", "Pod";
+ my $base_dir = catdir $cwd, updir(), "lib", "Pod";
my $new_dir = catdir $base_dir, "t";
my $infile = catfile $new_dir, "$podfile.pod";
my $outfile = catfile $new_dir, "$podfile.html";
my $s = '';
$s .= " $ENV{'HARNESS_PERL_SWITCHES'}"
if exists $ENV{'HARNESS_PERL_SWITCHES'};
- $s .= join " ", qq[ "-$1"], map {qq["-I$_"]} $self->_filtered_INC
- if $first =~ /^#!.*\bperl.*\s-\w*([Tt]+)/;
+ $s .= qq[ "-$1" ] if $first =~ /^#!.*\bperl.*\s-\w*([Tt]+)/;
+ $s .= join " ", map {qq["-I$_"]} $self->_filtered_INC;
close(TEST) or print "can't close $file. $!\n";
}
}
-my $SAMPLE_TESTS = $ENV{PERL_CORE} ? 'lib/sample-tests' : 't/sample-tests';
+use File::Spec::Functions;
+
+my $SAMPLE_TESTS = $ENV{PERL_CORE}
+ ? catdir(curdir(), 'lib', 'sample-tests')
+ : catdir(curdir(), 't', 'sample-tests');
use Test::More;
while( my($test, $expect) = each %samples ) {
local @out = ();
- $strap->analyze_file("$SAMPLE_TESTS/$test");
+ $strap->analyze_file(catfile($SAMPLE_TESTS, $test));
is_deeply(\@out, $expect, "$test callback");
}
}
}
-my $SAMPLE_TESTS = $ENV{PERL_CORE} ? 'lib/sample-tests' : 't/sample-tests';
+use File::Spec::Functions;
+
+my $SAMPLE_TESTS = $ENV{PERL_CORE}
+ ? catdir(curdir(), 'lib', 'sample-tests')
+ : catdir(curdir(), 't', 'sample-tests');
use strict;
use Test::More;
+if ($^O eq 'MacOS') {
+ plan skip_all => "Exit status broken on Mac OS";
+}
+
my $IsVMS = $^O eq 'VMS';
# VMS uses native, not POSIX, exit codes.
}
my $strap = Test::Harness::Straps->new;
- my %results = $strap->analyze_file("$SAMPLE_TESTS/$test");
+ my %results = $strap->analyze_file(catfile($SAMPLE_TESTS, $test));
is_deeply($results{details}, $expect->{details}, "$test details" );
}
}
-my $SAMPLE_TESTS = $ENV{PERL_CORE} ? "lib/sample-tests" : "t/sample-tests";
+use File::Spec::Functions;
+
+my $SAMPLE_TESTS = $ENV{PERL_CORE}
+ ? catdir(curdir(), 'lib', 'sample-tests')
+ : catdir(curdir(), 't', 'sample-tests');
use strict;
use Test::More;
my $IsVMS = $^O eq 'VMS';
+my $IsMacOS = $^O eq 'MacOS';
# VMS uses native, not POSIX, exit codes.
-my $die_estat = $IsVMS ? 44 : 1;
+my $die_estat = $IsVMS ? 44 : $IsMacOS ? 0 : 1;
my %samples = (
simple => {
select NULL; # _run_all_tests() isn't as quiet as it should be.
local $SIG{__WARN__} = sub { $warning .= join '', @_; };
($totals, $failed) =
- Test::Harness::_run_all_tests("$SAMPLE_TESTS/$test");
+ Test::Harness::_run_all_tests(catfile($SAMPLE_TESTS, $test));
};
select STDOUT;
is_deeply( {map { $_=>$totals->{$_} } keys %{$expect->{total}}},
$expect->{total},
"$test - totals" );
- is_deeply( {map { $_=>$failed->{"$SAMPLE_TESTS/$test"}{$_} }
+ is_deeply( {map { $_=>$failed->{catfile($SAMPLE_TESTS, $test)}{$_} }
keys %{$expect->{failed}}},
$expect->{failed},
"$test - failed" );
exit 0;
}
+if( $^O eq 'MacOS' ) {
+ print "1..0 # Skip exit status broken on Mac OS\n";
+ exit 0;
+}
+
my $test_num = 1;
# Utility testing functions.
sub ok ($;$) {
use strict;
use warnings;
use Carp;
+use File::Spec;
require Exporter;
my $self = shift;
my $file = $self->{table} ne '' ? $self->{table} : $KeyFile;
- open my $fk, "<$Path/$file"
- or croak "File does not exist at $Path/$file";
+ my $filepath = File::Spec->catfile($Path, $file);
+ open my $fk, "<$filepath"
+ or croak "File does not exist at $filepath";
while (<$fk>) {
next if /^\s*#/;
}
chdir 't' if -d 't';
@INC = '../lib';
+ @INC = "::lib" if $^O eq 'MacOS'; # module parses @INC itself
}
use strict;
Nick Ing-Simmons nik@tiuk.ti.com
-=cut
+=cut
use Cwd;
+use File::Spec;
use vars qw($VERSION $Verbose);
-$VERSION = '1.01';
+$VERSION = '1.02';
$Verbose = 0;
sub import
$dir = shift;
$dir =~ s/blib\z//;
$dir =~ s,/+\z,,;
- $dir = '.' unless ($dir);
+ $dir = File::Spec->curdir unless ($dir);
die "$dir is not a directory\n" unless (-d $dir);
}
- my $i = 5;
+ my $i = 5;
+ my($blib, $blib_lib, $blib_arch);
while ($i--)
{
- my $blib = "${dir}/blib";
- if (-d $blib && -d "$blib/arch" && -d "$blib/lib")
+ $blib = File::Spec->catdir($dir, "blib");
+ $blib_lib = File::Spec->catdir($blib, "lib");
+
+ if ($^O eq 'MacOS')
+ {
+ $blib_arch = File::Spec->catdir($blib_lib, $MacPerl::Architecture);
+ }
+ else
+ {
+ $blib_arch = File::Spec->catdir($blib, "arch");
+ }
+
+ if (-d $blib && -d $blib_arch && -d $blib_lib)
{
- unshift(@INC,"$blib/arch","$blib/lib");
+ unshift(@INC,$blib_arch,$blib_lib);
warn "Using $blib\n" if $Verbose;
return;
}
- $dir .= "/..";
+ $dir = File::Spec->catdir($dir, File::Spec->updir);
}
die "Cannot find blib even in $dir\n";
}
}
use strict;
+my($blib, $blib_arch, $blib_lib, @blib_dirs);
sub _cleanup {
- rmdir foreach reverse qw(blib blib/arch blib/lib);
- unlink "stderr";
+ rmdir foreach reverse (@_);
+ unlink "stderr" unless $^O eq 'MacOS';
}
sub _mkdirs {
}
-BEGIN { _cleanup }
+BEGIN {
+ if ($^O eq 'MacOS')
+ {
+ $blib = ":blib:";
+ $blib_lib = ":blib:lib:";
+ $blib_arch = ":blib:lib:$MacPerl::Architecture:";
+ @blib_dirs = ($blib, $blib_lib, $blib_arch); # order
+ }
+ else
+ {
+ $blib = "blib";
+ $blib_arch = "blib/arch";
+ $blib_lib = "blib/lib";
+ @blib_dirs = ($blib, $blib_arch, $blib_lib);
+ }
+ _cleanup( @blib_dirs );
+}
use Test::More tests => 7;
eval 'use blib;';
ok( $@ =~ /Cannot find blib/, 'Fails if blib directory not found' );
-_mkdirs(qw(blib blib/arch blib/lib));
+_mkdirs( @blib_dirs );
{
my $warnings = '';
is( @INC, 3, '@INC now has 3 elements' );
is( $INC[2], '../lib', 'blib added to the front of @INC' );
-ok( grep(m|blib/lib$|, @INC[0,1]) == 1, ' blib/lib in @INC');
-ok( grep(m|blib/arch$|, @INC[0,1]) == 1, ' blib/arch in @INC');
+ok( grep(m|$blib_lib$|, @INC[0,1]) == 1, ' blib/lib in @INC');
+ok( grep(m|$blib_arch$|, @INC[0,1]) == 1, ' blib/arch in @INC');
-END { _cleanup(); }
+END { _cleanup( @blib_dirs ); }
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
+ push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS';
require Config; import Config;
}
my $Is_NetWare = $^O eq 'NetWare';
my $tmpfile = "tmp0000";
my $i = 0 ;
-1 while -f ++$tmpfile;
+1 while -e ++$tmpfile;
END { if ($tmpfile) { 1 while unlink $tmpfile; } }
my @prgs = () ;
-foreach (sort glob($^O eq 'MacOS' ? ":lib::strict:*" : "lib/strict/*")) {
+foreach (sort glob($^O eq 'MacOS' ? ":lib:strict:*" : "lib/strict/*")) {
next if /(~|\.orig|,v)$/;
$prog = shift @files ;
$prog =~ s|\./abc|:abc|g if $^O eq 'MacOS';
}
- open TEST, ">$tmpfile";
+ open TEST, ">$tmpfile" or die "Could not open: $!";
print TEST $prog,"\n";
close TEST or die "Could not close: $!";
my $results = $Is_MSWin32 ?
my $Is_VMS = $^O eq 'VMS';
my $Is_MSWin32 = $^O eq 'MSWin32';
my $Is_NetWare = $^O eq 'NetWare';
+my $Is_MacOS = $^O eq 'MacOS';
my $tmpfile = "tmp0000";
my $i = 0 ;
-1 while -f ++$tmpfile;
+1 while -e ++$tmpfile;
END { if ($tmpfile) { 1 while unlink $tmpfile} }
for (@prgs){
}
use File::Path;
+use File::Spec::Functions;
$| = 1;
my $Is_VMS = $^O eq 'VMS';
my $Is_MSWin32 = $^O eq 'MSWin32';
my $Is_NetWare = $^O eq 'NetWare';
+my $Is_MacOS = $^O eq 'MacOS';
my $tmpfile = "tmp0000";
my $i = 0 ;
-1 while -f ++$tmpfile;
+1 while -e ++$tmpfile;
END { if ($tmpfile) { 1 while unlink $tmpfile} }
my @prgs = () ;
my @w_files = () ;
if (@ARGV)
- { print "ARGV = [@ARGV]\n" ; @w_files = map { s#^#./lib/warnings/#; $_ } @ARGV }
+ { print "ARGV = [@ARGV]\n" ;
+ if ($^O eq 'MacOS') {
+ @w_files = map { s#^#:lib:warnings:#; $_ } @ARGV
+ } else {
+ @w_files = map { s#^#./lib/warnings/#; $_ } @ARGV
+ }
+ }
else
- { @w_files = sort glob("lib/warnings/*") }
+ { @w_files = sort glob(catfile(curdir(), "lib", "warnings", "*")) }
my $files = 0;
foreach my $file (@w_files) {
shift @files ;
$prog = shift @files ;
}
+
+ # fix up some paths
+ if ($^O eq 'MacOS') {
+ $prog =~ s|require "./abc(d)?";|require ":abc$1";|g;
+ $prog =~ s|"\."|":"|g;
+ }
+
open TEST, ">$tmpfile" or die "Cannot open >$tmpfile: $!";
print TEST q{
BEGIN {
$results =~ s/^(syntax|parse) error/syntax error/mig;
# allow all tests to run when there are leaks
$results =~ s/Scalars leaked: \d+\n//g;
+
+ # fix up some paths
+ if ($^O eq 'MacOS') {
+ $results =~ s|:abc\.pm\b|abc.pm|g;
+ $results =~ s|:abc(d)?\b|./abc$1|g;
+ }
+
$expected =~ s/\n+$//;
my $prefix = ($results =~ s#^PREFIX(\n|$)##) ;
# any special options? (OPTIONS foo bar zap)
if (PL_minus_c) {
#ifdef MACOS_TRADITIONAL
- PerlIO_printf(Perl_error_log, "# %s syntax OK\n", MacPerl_MPWFileName(PL_origfilename));
+ PerlIO_printf(Perl_error_log, "%s%s syntax OK\n",
+ (gMacPerl_ErrorFormat ? "# " : ""),
+ MacPerl_MPWFileName(PL_origfilename));
#else
PerlIO_printf(Perl_error_log, "%s syntax OK\n", PL_origfilename);
#endif
p = Nullch; /* break out */
}
#ifdef MACOS_TRADITIONAL
- if (!strchr(SvPVX(libdir), ':'))
- sv_insert(libdir, 0, 0, ":", 1);
+ if (!strchr(SvPVX(libdir), ':')) {
+ char buf[256];
+
+ sv_setpv(libdir, MacPerl_CanonDir(SvPVX(libdir), buf, 0));
+ }
if (SvPVX(libdir)[SvCUR(libdir)-1] != ':')
sv_catpv(libdir, ":");
#endif
$Inc = '' ;
foreach (@INC)
{ $Inc .= "\"-I$_\" " }
+$Inc = "-I::lib" if $^O eq 'MacOS';
$Perl = '' ;
$Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ;
Use of -l on filehandle $fh at - line 6.
########
# doio.c [Perl_do_aexec5]
+BEGIN {
+ if ($^O eq 'MacOS') {
+ print <<EOM;
+SKIPPED
+# no exec on Mac OS
+EOM
+ exit;
+ }
+}
use warnings 'io' ;
exec "lskdjfalksdjfdjfkls","" ;
no warnings 'io' ;
Can't exec "lskdjfalksdjfdjfkls": .+
########
# doio.c [Perl_do_exec3]
+BEGIN {
+ if ($^O eq 'MacOS') {
+ print <<EOM;
+SKIPPED
+# no exec on Mac OS
+EOM
+ exit;
+ }
+}
use warnings 'io' ;
exec "lskdjfalksdjfdjfkls", "abc" ;
no warnings 'io' ;
Can't exec "lskdjfalksdjfdjfkls(:? abc)?": .+
########
# doio.c [win32_execvp]
+BEGIN {
+ if ($^O eq 'MacOS') {
+ print <<EOM;
+SKIPPED
+# no exec on Mac OS
+EOM
+ exit;
+ }
+}
use warnings 'exec' ;
exec $^X, "-e0" ;
EXPECT
########
# mg.c
use warnings 'signal' ;
-if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
+if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS' || $^O eq 'MacOS') {
print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
}
$|=1;
########
# mg.c
no warnings 'signal' ;
-if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') {
- print "SKIPPED\n# win32, can't kill() to raise()\n"; exit;
+if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS' || $^O eq 'MacOS') {
+ print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
}
$|=1;
$SIG{"INT"} = "fred"; kill "INT",$$;
Hash %FRED missing the % in argument 1 of keys() at - line 3.
########
# op.c
+BEGIN {
+ if ($^O eq 'MacOS') {
+ print <<EOM;
+SKIPPED
+# no exec on Mac OS
+EOM
+ exit;
+ }
+}
use warnings 'syntax' ;
exec "$^X -e 1" ;
my $a
(Maybe you should just omit the defined()?)
########
# op.c
+BEGIN {
+ if ($^O eq 'MacOS') {
+ print <<EOM;
+SKIPPED
+# no exec on Mac OS
+EOM
+ exit;
+ }
+}
no warnings 'syntax' ;
exec "$^X -e 1" ;
my $a
my $s2pcmd = [ $s2p, '-f', $script ];
my $plcmd = [ $plsed, $stdin ];
+my $switches = '';
+$switches = ['-x'] if $^O eq 'MacOS';
+
# psed: we create a local copy as linking may not work on some systems.
copy( $s2p, $psed );
push( @aux, $psed );
# run and compare
#
- $psedres = runperl( args => $sedcmd );
+ $psedres = runperl( args => $sedcmd, switches => $switches );
is( $psedres, $testcase{$tc}{expect}, "psed $tc" );
# 2nd test: run s2p
# translate the sed script to a Perl program
-
- my $perlprog = runperl( args => $s2pcmd );
+
+ my $perlprog = runperl( args => $s2pcmd, switches => $switches );
open( PP, ">$plsed" ) || goto FAIL_S2P;
print PP $perlprog;
close( PP ) || goto FAIL_S2P;
# execute generated Perl program, compare
- $s2pres = runperl( args => $plcmd );
+ $s2pres = runperl( args => $plcmd, switches => $switches );
is( $s2pres, $testcase{$tc}{expect}, "s2p $tc" );
next;