Change 11198 by pudge@pudge-mobile on 2001/07/07 20:44:12

        Portability fixes for a lot of tests, especially IO-related
        tests, and warnings, and the harness script.

Affected files ...

... //depot/maint-5.6/macperl/t/harness#2 edit
... //depot/maint-5.6/macperl/t/io/argv.t#2 edit
... //depot/maint-5.6/macperl/t/io/dup.t#2 edit
... //depot/maint-5.6/macperl/t/io/fs.t#2 edit
... //depot/maint-5.6/macperl/t/io/inplace.t#2 edit
... //depot/maint-5.6/macperl/t/io/iprefix.t#2 edit
... //depot/maint-5.6/macperl/t/io/open.t#2 edit
... //depot/maint-5.6/macperl/t/io/openpid.t#2 edit
... //depot/maint-5.6/macperl/t/lib/filepath.t#2 edit
... //depot/maint-5.6/macperl/t/lib/findbin.t#2 edit
... //depot/maint-5.6/macperl/t/lib/io_dup.t#2 edit
... //depot/maint-5.6/macperl/t/lib/socket.t#2 edit
... //depot/maint-5.6/macperl/t/op/die_exit.t#3 edit
... //depot/maint-5.6/macperl/t/op/misc.t#3 edit
... //depot/maint-5.6/macperl/t/op/read.t#2 edit
... //depot/maint-5.6/macperl/t/op/readdir.t#2 edit
... //depot/maint-5.6/macperl/t/op/runlevel.t#2 edit
... //depot/maint-5.6/macperl/t/op/stat.t#2 edit
... //depot/maint-5.6/macperl/t/op/subst_wamp.t#2 edit
... //depot/maint-5.6/macperl/t/op/taint.t#2 edit
... //depot/maint-5.6/macperl/t/pragma/diagnostics.t#2 edit
... //depot/maint-5.6/macperl/t/pragma/subs.t#2 edit
... //depot/maint-5.6/macperl/t/pragma/warn/doio#2 edit
... //depot/maint-5.6/macperl/t/pragma/warn/mg#2 edit
... //depot/maint-5.6/macperl/t/pragma/warn/op#2 edit
... //depot/maint-5.6/macperl/t/pragma/warn/pp_sys#2 edit
... //depot/maint-5.6/macperl/t/pragma/warnings.t#2 edit

Differences ...

==== //depot/maint-5.6/macperl/t/harness#2 (xtext) ====
Index: perl/t/harness
--- perl/t/harness.~1~  Sat Jul  7 17:50:08 2001
+++ perl/t/harness      Sat Jul  7 17:50:08 2001
@@ -7,6 +7,7 @@
     chdir 't' if -d 't';
     unshift @INC, '../lib';
     $ENV{PERL5LIB} = '../lib';    # so children will see it too
+    $ENV{HARNESS_NOTTY} = 1 if $^O eq 'MacOS';
 }
 use lib '../lib';
 

==== //depot/maint-5.6/macperl/t/io/argv.t#2 (xtext) ====
Index: perl/t/io/argv.t
--- perl/t/io/argv.t.~1~        Sat Jul  7 17:50:08 2001
+++ perl/t/io/argv.t    Sat Jul  7 17:50:08 2001
@@ -18,6 +18,9 @@
 if ($^O eq 'MSWin32') {
   $x = `.\\perl -e "while (<>) {print \$.,\$_;}" Io_argv1.tmp Io_argv1.tmp`;
 }
+elsif ($^O eq 'MacOS') {
+  $x = `$^X -e 'while (<>) {print \$.,\$_;}' Io_argv1.tmp Io_argv1.tmp`;
+}
 else {
   $x = `./perl -e 'while (<>) {print \$.,\$_;}' Io_argv1.tmp Io_argv1.tmp`;
 }
@@ -26,6 +29,9 @@
 if ($^O eq 'MSWin32') {
   $x = `.\\perl -le "print 'foo'" | .\\perl -e "while (<>) {print \$_;}" Io_argv1.tmp 
-`;
 }
+elsif ($^O eq 'MacOS') {
+  $x = `echo foo|$^X -e 'while (<>) {print $_;}' Io_argv1.tmp -`;
+}
 else {
   $x = `echo foo|./perl -e 'while (<>) {print $_;}' Io_argv1.tmp -`;
 }
@@ -34,6 +40,9 @@
 if ($^O eq 'MSWin32') {
   $x = `.\\perl -le "print 'foo'" |.\\perl -e "while (<>) {print \$_;}"`;
 }
+elsif ($^O eq 'MacOS') {
+  $x = `echo foo|$^X -e 'while (<>) {print $_;}'`;
+}
 else {
   $x = `echo foo|./perl -e 'while (<>) {print $_;}'`;
 }

==== //depot/maint-5.6/macperl/t/io/dup.t#2 (xtext) ====
Index: perl/t/io/dup.t
--- perl/t/io/dup.t.~1~ Sat Jul  7 17:50:08 2001
+++ perl/t/io/dup.t     Sat Jul  7 17:50:08 2001
@@ -21,6 +21,10 @@
     print `echo ok 4`;
     print `echo ok 5 1>&2`; # does this work?
 }
+elsif ($^O eq 'MacOS') {
+    system 'echo ok 4';
+    system 'echo ok 5';  # no real way to do this, i think
+}
 else {
     system 'echo ok 4';
     system 'echo ok 5 1>&2';
@@ -32,8 +36,9 @@
 open(STDOUT,">&dupout");
 open(STDERR,">&duperr");
 
-if ($^O eq 'MSWin32') { print `type Io.dup` }
-else                  { system 'cat Io.dup' }
+if ($^O eq 'MSWin32')  { print `type Io.dup`      }
+elsif ($^O eq 'MacOS') { system 'catenate Io.dup' }
+else                   { system 'cat Io.dup'      }
 unlink 'Io.dup';
 
 print STDOUT "ok 6\n";

==== //depot/maint-5.6/macperl/t/io/fs.t#2 (xtext) ====
Index: perl/t/io/fs.t
--- perl/t/io/fs.t.~1~  Sat Jul  7 17:50:08 2001
+++ perl/t/io/fs.t      Sat Jul  7 17:50:08 2001
@@ -8,7 +8,9 @@
 }
 
 use Config;
+use File::Spec::Functions;
 
+$Is_MacOS  = $^O eq 'MacOS';
 $Is_Dosish = ($^O eq 'MSWin32' or $^O eq 'dos' or
              $^O eq 'os2' or $^O eq 'mint');
 
@@ -21,25 +23,26 @@
 $wd = (($^O eq 'MSWin32') ? `cd` : `pwd`);
 chop($wd);
 
-if ($^O eq 'MSWin32') { `rmdir /s /q tmp 2>nul`; `mkdir tmp`; }
+if ($^O eq 'MSWin32')  { `rmdir /s /q tmp 2>nul`; `mkdir tmp`; }
+elsif ($^O eq 'MacOS') { rmdir "tmp"; mkdir "tmp"; }
 else {  `rm -f tmp 2>/dev/null; mkdir tmp 2>/dev/null`; }
-chdir './tmp';
+chdir catdir(curdir(), 'tmp');
 `/bin/rm -rf a b c x` if -x '/bin/rm';
 
 umask(022);
 
-if ($^O eq 'MSWin32') { print "ok 1 # skipped: bogus umask()\n"; }
+if ($^O eq 'MSWin32' || $Is_MacOS) { print "ok 1 # skipped: bogus umask()\n"; }
 elsif ((umask(0)&0777) == 022) {print "ok 1\n";} else {print "not ok 1\n";}
 open(fh,'>x') || die "Can't create x";
 close(fh);
 open(fh,'>a') || die "Can't create a";
 close(fh);
 
-if ($Is_Dosish) {print "ok 2 # skipped: no link\n";} 
+if ($Is_Dosish || $Is_MacOS) {print "ok 2 # skipped: no link\n";} 
 elsif (eval {link('a','b')}) {print "ok 2\n";} 
 else {print "not ok 2\n";}
 
-if ($Is_Dosish) {print "ok 3 # skipped: no link\n";} 
+if ($Is_Dosish || $Is_MacOS) {print "ok 3 # skipped: no link\n";} 
 elsif (eval {link('b','c')}) {print "ok 3\n";} 
 else {print "not ok 3\n";}
 
@@ -52,7 +55,7 @@
     {print "ok 4\n";} 
 else {print "not ok 4\n";}
 
-if ($^O eq 'amigaos' || $Is_Dosish)
+if ($^O eq 'amigaos' || $Is_Dosish || $Is_MacOS)
     {print "ok 5 # skipped: no link\n";} 
 elsif (($mode & 0777) == 0666)
     {print "ok 5\n";} 
@@ -63,7 +66,7 @@
 
 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
     $blksize,$blocks) = stat('c');
-if ($Is_Dosish) {print "ok 7 # skipped: no link\n";} 
+if ($Is_Dosish || $Is_MacOS) {print "ok 7 # skipped: no link\n";} 
 elsif (($mode & 0777) == $newmode) {print "ok 7\n";} 
 else {print "not ok 7\n";}
 
@@ -73,23 +76,23 @@
     $newmode = 0666;
 }
 
-if ($Is_Dosish) {print "ok 8 # skipped: no link\n";} 
+if ($Is_Dosish || $Is_MacOS) {print "ok 8 # skipped: no link\n";} 
 elsif ((chmod $newmode,'c','x') == 2) {print "ok 8\n";} 
 else {print "not ok 8\n";}
 
 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
     $blksize,$blocks) = stat('c');
-if ($Is_Dosish) {print "ok 9 # skipped: no link\n";} 
+if ($Is_Dosish || $Is_MacOS) {print "ok 9 # skipped: no link\n";} 
 elsif (($mode & 0777) == $newmode) {print "ok 9\n";} 
 else {print "not ok 9\n";}
 
 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
     $blksize,$blocks) = stat('x');
-if ($Is_Dosish) {print "ok 10 # skipped: no link\n";} 
+if ($Is_Dosish || $Is_MacOS) {print "ok 10 # skipped: no link\n";} 
 elsif (($mode & 0777) == $newmode) {print "ok 10\n";} 
 else {print "not ok 10\n";}
 
-if ($Is_Dosish) {print "ok 11 # skipped: no link\n"; unlink 'b','x'; } 
+if ($Is_Dosish || $Is_MacOS) {print "ok 11 # skipped: no link\n"; unlink 'b','x'; } 
 elsif ((unlink 'b','x') == 2) {print "ok 11\n";} 
 else {print "not ok 11\n";}
 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
@@ -111,7 +114,7 @@
     $blksize,$blocks) = stat('b');
 if ($^O eq 'MSWin32') { print "ok 17 # skipped: bogus (stat)[1]\n"; }
 elsif ($ino) {print "ok 17\n";} else {print "not ok 17\n";}
-if ($wd =~ m#/afs/# || $^O eq 'amigaos' || $^O eq 'dos' || $^O eq 'MSWin32')
+if ($wd =~ m#/afs/# || $^O eq 'amigaos' || $^O eq 'dos' || $^O eq 'MSWin32' || 
+$Is_MacOS)
     {print "ok 18 # skipped: granularity of the filetime\n";}
 elsif ($atime == 500000000 && $mtime == 500000000 + $delta)
     {print "ok 18\n";}

==== //depot/maint-5.6/macperl/t/io/inplace.t#2 (xtext) ====
Index: perl/t/io/inplace.t
--- perl/t/io/inplace.t.~1~     Sat Jul  7 17:50:08 2001
+++ perl/t/io/inplace.t Sat Jul  7 17:50:08 2001
@@ -19,6 +19,12 @@
   `MCR []perl. -le "print 'foo'" > ./.b`;
   `MCR []perl. -le "print 'foo'" > ./.c`;
 }
+elsif ($^O eq 'MacOS') {
+  $CAT = "$^X -e \"print<>\"";
+  `$^X -le "print 'foo'" > .a`;
+  `$^X -le "print 'foo'" > .b`;
+  `$^X -le "print 'foo'" > .c`;
+}
 else {
   $CAT = 'cat';
   `echo foo | tee .a .b .c`;

==== //depot/maint-5.6/macperl/t/io/iprefix.t#2 (xtext) ====
Index: perl/t/io/iprefix.t
--- perl/t/io/iprefix.t.~1~     Sat Jul  7 17:50:08 2001
+++ perl/t/io/iprefix.t Sat Jul  7 17:50:08 2001
@@ -19,6 +19,12 @@
   `MCR []perl. -le "print 'foo'" > ./.b`;
   `MCR []perl. -le "print 'foo'" > ./.c`;
 }
+elsif ($^O eq 'MacOS') {
+  $CAT = "$^X -e \"print<>\"";
+  `$^X -le "print 'foo'" > .a`;
+  `$^X -le "print 'foo'" > .b`;
+  `$^X -le "print 'foo'" > .c`;
+}
 else {
   $CAT = 'cat';
   `echo foo | tee .a .b .c`;

==== //depot/maint-5.6/macperl/t/io/open.t#2 (xtext) ====
Index: perl/t/io/open.t
--- perl/t/io/open.t.~1~        Sat Jul  7 17:50:08 2001
+++ perl/t/io/open.t    Sat Jul  7 17:50:08 2001
@@ -8,8 +8,9 @@
 # $RCSfile$    
 $|  = 1;
 use warnings;
-$Is_VMS = $^O eq 'VMS';
-$Is_Dos = $^O eq 'dos';
+$Is_MacOS = $^O eq 'MacOS';
+$Is_VMS   = $^O eq 'VMS';
+$Is_Dos   = $^O eq 'dos';
 
 print "1..66\n";
 
@@ -100,7 +101,7 @@
 }
 
 # 24..26
-if ($Is_VMS) {
+if ($Is_VMS || $Is_MacOS) {
     for (24..26) { print "ok $_ # skipped: not Unix fork\n"; $test++;}
 }
 else {
@@ -116,7 +117,7 @@
 }
 
 # 27..30
-if ($Is_VMS) {
+if ($Is_VMS || $Is_MacOS) {
     for (27..30) { print "ok $_ # skipped: not Unix fork\n"; $test++;}
 }
 else {
@@ -224,7 +225,7 @@
 }
 
 # 56..58
-if ($Is_VMS) {
+if ($Is_VMS || $Is_MacOS) {
     for (56..58) { print "ok $_ # skipped: not Unix fork\n"; $test++;}
 }
 else {
@@ -240,7 +241,7 @@
 }
 
 # 59..62
-if ($Is_VMS) {
+if ($Is_VMS || $Is_MacOS) {
     for (59..62) { print "ok $_ # skipped: not Unix fork\n"; $test++;}
 }
 else {

==== //depot/maint-5.6/macperl/t/io/openpid.t#2 (xtext) ====
Index: perl/t/io/openpid.t
--- perl/t/io/openpid.t.~1~     Sat Jul  7 17:50:08 2001
+++ perl/t/io/openpid.t Sat Jul  7 17:50:08 2001
@@ -10,7 +10,7 @@
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
-    if ($^O eq 'dos') {
+    if ($^O eq 'dos' || $^O eq 'MacOS') {
         print "1..0 # Skip: no multitasking\n";
         exit 0;
     }

==== //depot/maint-5.6/macperl/t/lib/filepath.t#2 (xtext) ====
Index: perl/t/lib/filepath.t
--- perl/t/lib/filepath.t.~1~   Sat Jul  7 17:50:08 2001
+++ perl/t/lib/filepath.t       Sat Jul  7 17:50:08 2001
@@ -5,6 +5,7 @@
     @INC = '../lib';
 }
 
+use File::Spec::Functions;
 use File::Path;
 use strict;
 
@@ -16,13 +17,16 @@
 # first check for stupid permissions second for full, so we clean up
 # behind ourselves
 for my $perm (0111,0777) {
-    mkpath("foo/bar");
-    chmod $perm, "foo", "foo/bar";
+    my $one = catdir(curdir(), "foo");
+    my $two = catdir(curdir(), "foo", "bar");
+
+    mkpath($two);
+    chmod $perm, $one, $two;
 
-    print "not " unless -d "foo" && -d "foo/bar";
+    print "not " unless -d $one && -d $two;
     print "ok ", ++$count, "\n";
 
-    rmtree("foo");
-    print "not " if -e "foo";
+    rmtree($one);
+    print "not " if -e $one;
     print "ok ", ++$count, "\n";
 }

==== //depot/maint-5.6/macperl/t/lib/findbin.t#2 (xtext) ====
Index: perl/t/lib/findbin.t
--- perl/t/lib/findbin.t.~1~    Sat Jul  7 17:50:08 2001
+++ perl/t/lib/findbin.t        Sat Jul  7 17:50:08 2001
@@ -9,5 +9,6 @@
 
 use FindBin qw($Bin);
 
-print "not " unless $Bin =~ m,t[/.]lib\]?$,;
+my $match = $^O eq 'MacOS' ? qr/t:lib:$/ : qr,t[/.]lib\]?$,;
+print "not " unless $Bin =~ $match;
 print "ok 1\n";

==== //depot/maint-5.6/macperl/t/lib/io_dup.t#2 (xtext) ====
Index: perl/t/lib/io_dup.t
--- perl/t/lib/io_dup.t.~1~     Sat Jul  7 17:50:08 2001
+++ perl/t/lib/io_dup.t Sat Jul  7 17:50:08 2001
@@ -43,6 +43,10 @@
     print `echo ok 4`;
     print `echo ok 5 1>&2`; # does this *really* work?
 }
+elsif ($^O eq 'MacOS') {
+    system 'echo ok 4';
+    system 'echo ok 5';  # no real way to do this, i think
+}
 else {
     system 'echo ok 4';
     system 'echo ok 5 1>&2';
@@ -54,8 +58,9 @@
 $stdout->fdopen($dupout,"w");
 $stderr->fdopen($duperr,"w");
 
-if ($^O eq 'MSWin32') { print `type Io.dup` }
-else                  { system 'cat Io.dup' }
+if ($^O eq 'MSWin32')  { print `type Io.dup`      }
+elsif ($^O eq 'MacOS') { system 'catenate Io.dup' }
+else                   { system 'cat Io.dup'      }
 unlink 'Io.dup';
 
 print STDOUT "ok 6\n";

==== //depot/maint-5.6/macperl/t/lib/socket.t#2 (xtext) ====
Index: perl/t/lib/socket.t
--- perl/t/lib/socket.t.~1~     Sat Jul  7 17:50:08 2001
+++ perl/t/lib/socket.t Sat Jul  7 17:50:08 2001
@@ -18,7 +18,9 @@
 if (socket(T,PF_INET,SOCK_STREAM,6)) {
   print "ok 1\n";
 
-  if (connect(T,pack_sockaddr_in(7,inet_aton("localhost")))){
+  # localhost won't always work on Mac OS
+  my $host = $^O eq 'MacOS' ? "127.0.0.1" : "localhost";
+  if (connect(T,pack_sockaddr_in(7,inet_aton($host)))){
        print "ok 2\n";
 
        print "# Connected to " .

==== //depot/maint-5.6/macperl/t/op/die_exit.t#3 (xtext) ====
==== //depot/maint-5.6/macperl/t/op/misc.t#3 (xtext) ====
Index: perl/t/op/misc.t
--- perl/t/op/misc.t.~1~        Sat Jul  7 17:50:08 2001
+++ perl/t/op/misc.t    Sat Jul  7 17:50:08 2001
@@ -34,7 +34,8 @@
 
     if ($^O eq 'MSWin32') {
       $results = `.\\perl -I../lib $switch $tmpfile 2>&1`;
-    } elsif ($^O eq 'MacOS') {
+    }
+    elsif ($^O eq 'MacOS') {
       $results = `$^X -I::lib $switch $tmpfile`;
     }
     else {
@@ -96,7 +97,7 @@
 ########
 eval {sub bar {print "In bar";}}
 ########
-system './perl -ne "print if eof" /dev/null'
+system './perl -ne "print if eof" /dev/null' unless $^O eq 'MacOS';
 ########
 chop($file = <DATA>);
 ########
@@ -274,7 +275,7 @@
 EXPECT
 ok
 ########
-open(H,'op/misc.t'); # must be in the 't' directory
+open(H,'op/misc.t') || open(H,':op:misc.t'); # must be in the 't' directory
 stat(H);
 print "ok\n" if (-e _ and -f _ and -r _);
 EXPECT

==== //depot/maint-5.6/macperl/t/op/read.t#2 (xtext) ====
Index: perl/t/op/read.t
--- perl/t/op/read.t.~1~        Sat Jul  7 17:50:08 2001
+++ perl/t/op/read.t    Sat Jul  7 17:50:08 2001
@@ -5,7 +5,7 @@
 print "1..4\n";
 
 
-open(FOO,'op/read.t') || open(FOO,'t/op/read.t') || die "Can't open op.read";
+open(FOO,'op/read.t') || open(FOO,'t/op/read.t') || open(FOO,':op:read.t') || die 
+"Can't open op.read";
 seek(FOO,4,0);
 $got = read(FOO,$buf,4);
 

==== //depot/maint-5.6/macperl/t/op/readdir.t#2 (xtext) ====
Index: perl/t/op/readdir.t
--- perl/t/op/readdir.t.~1~     Sat Jul  7 17:50:08 2001
+++ perl/t/op/readdir.t Sat Jul  7 17:50:08 2001
@@ -5,6 +5,8 @@
     @INC = '../lib';
 }
 
+use File::Spec::Functions;
+
 eval 'opendir(NOSUCH, "no/such/directory");';
 if ($@) { print "1..0\n"; exit; }
 
@@ -28,12 +30,13 @@
 
 @R = sort @D;
 @G = sort <op/*.t>;
+@G = sort <:op:*.t> if $^O eq 'MacOS';
 if ($G[0] =~ m#.*\](\w+\.t)#i) {
     # grep is to convert filespecs returned from glob under VMS to format
     # identical to that returned by readdir
     @G = grep(s#.*\](\w+\.t).*#op/$1#i,<op/*.t>);
 }
-while (@R && @G && "op/".$R[0] eq $G[0]) {
+while (@R && @G && $G[0] eq ($^O eq 'MacOS' ? ':op:' : 'op/').$R[0]) {
        shift(@R);
        shift(@G);
 }

==== //depot/maint-5.6/macperl/t/op/runlevel.t#2 (xtext) ====
Index: perl/t/op/runlevel.t
--- perl/t/op/runlevel.t.~1~    Sat Jul  7 17:50:08 2001
+++ perl/t/op/runlevel.t        Sat Jul  7 17:50:08 2001
@@ -10,6 +10,7 @@
 @INC = '../lib';
 $Is_VMS = $^O eq 'VMS';
 $Is_MSWin32 = $^O eq 'MSWin32';
+$Is_MacOS = $^O eq 'MacOS';
 $ENV{PERL5LIB} = "../lib" unless $Is_VMS;
 
 $|=1;
@@ -32,10 +33,12 @@
     print TEST "$prog\n";
     close TEST;
     my $results = $Is_VMS ?
-                  `MCR $^X "-I[-.lib]" $switch $tmpfile 2>&1` :
-                     $Is_MSWin32 ?  
-                         `.\\perl -I../lib $switch $tmpfile 2>&1` :
-                             `./perl $switch $tmpfile 2>&1`;
+       `MCR $^X "-I[-.lib]" $switch $tmpfile 2>&1` :
+           $Is_MSWin32 ?
+               `.\\perl -I../lib $switch $tmpfile 2>&1` :
+                   $Is_MacOS ?
+                       `$^X -I::lib $switch $tmpfile` :
+                           `./perl $switch $tmpfile 2>&1`;
     my $status = $?;
     $results =~ s/\n+$//;
     # allow expected output to be written as if $prog is on STDIN

==== //depot/maint-5.6/macperl/t/op/stat.t#2 (xtext) ====
Index: perl/t/op/stat.t
--- perl/t/op/stat.t.~1~        Sat Jul  7 17:50:08 2001
+++ perl/t/op/stat.t    Sat Jul  7 17:50:08 2001
@@ -8,9 +8,11 @@
 }
 
 use Config;
+use File::Spec::Functions;
 
 print "1..58\n";
 
+$Is_MacOS = $^O eq 'MacOS';
 $Is_MSWin32 = $^O eq 'MSWin32';
 $Is_Dos = $^O eq 'dos';
 $Is_Dosish = $Is_Dos || $^O eq 'os2' || $Is_MSWin32;
@@ -52,7 +54,7 @@
   print "# open failed: $!\nnot ok 1\nnot ok 2\n";
 }
 
-if ($Is_Dosish) { unlink "Op.stat.tmp2"}
+if ($Is_Dosish || $Is_MacOS) { unlink "Op.stat.tmp2"}
 else {
     `rm -f Op.stat.tmp2;ln Op.stat.tmp Op.stat.tmp2; chmod 644 Op.stat.tmp`;
 }
@@ -66,7 +68,7 @@
     {print "ok 3\n";} 
 else {print "# \$nlink is |$nlink|\nnot ok 3\n";}
 
-if (   $Is_Dosish
+if (   $Is_Dosish || $Is_MacOS
         # Solaris tmpfs bug
        || ($cwd =~ m#^/tmp# and $mtime && $mtime==$ctime && $^O eq 'solaris')
        || $cwd =~ m#/afs/#
@@ -85,7 +87,7 @@
 print "#4      :$mtime: should != :$ctime:\n";
 
 unlink "Op.stat.tmp" or print "# unlink failed: $!\n";
-if ($Is_MSWin32) {  open F, '>Op.stat.tmp' and close F }
+if ($Is_MSWin32 || $Is_MacOS) {  open F, '>Op.stat.tmp' and close F }
 else             { `touch Op.stat.tmp` }
 
 if (-z 'Op.stat.tmp') {print "ok 5\n";} else {print "not ok 5\n";}
@@ -118,15 +120,16 @@
 chmod 0700,'Op.stat.tmp';
 if (-r 'Op.stat.tmp') {print "ok 18\n";} else {print "not ok 18\n";}
 if (-w 'Op.stat.tmp') {print "ok 19\n";} else {print "not ok 19\n";}
-if ($Is_Dosish) {print "ok 20 # skipped: -x by extension\n";} 
+if ($Is_Dosish || $Is_MacOS) {print "ok 20 # skipped: -x by extension\n";} 
 elsif (-x 'Op.stat.tmp') {print "ok 20\n";} 
 else {print "not ok 20\n";}
 
 if (-f 'Op.stat.tmp') {print "ok 21\n";} else {print "not ok 21\n";}
 if (! -d 'Op.stat.tmp') {print "ok 22\n";} else {print "not ok 22\n";}
 
-if (-d '.') {print "ok 23\n";} else {print "not ok 23\n";}
-if (! -f '.') {print "ok 24\n";} else {print "not ok 24\n";}
+my $dir = curdir();
+if (-d $dir) {print "ok 23\n";} else {print "not ok 23\n";}
+if (! -f $dir) {print "ok 24\n";} else {print "not ok 24\n";}
 
 if (!$Is_Dosish and `ls -l perl` =~ /^l.*->/) {
     if (-l 'perl') {print "ok 25\n";} else {print "not ok 25\n";}
@@ -171,7 +174,7 @@
     {print "not ok 33\n";}
 if (! -b '.') {print "ok 34\n";} else {print "not ok 34\n";}
 
-if ($^O eq 'mpeix' or $^O eq 'amigaos' or $Is_Dosish or $Is_Cygwin) {
+if ($^O eq 'mpeix' or $^O eq 'amigaos' or $Is_Dosish or $Is_Cygwin or $Is_MacOS) {
   print "ok 35 # skipped: no -u\n"; goto tty_test;
 }
 
@@ -205,7 +208,7 @@
 # may not be available (at, cron  rsh etc), the PERL_SKIP_TTY_TEST env var
 # can be set to skip the tests that need a tty.
 unless($ENV{PERL_SKIP_TTY_TEST}) {
-    if ($Is_MSWin32) {
+    if ($Is_MSWin32 || $Is_MacOS) {
        print "ok 36\n";
        print "ok 37\n";
     }
@@ -235,20 +238,21 @@
     print "ok 38\n";
     print "ok 39\n";
 }
-open(null,"/dev/null");
+my $devnull = File::Spec->devnull;
+open(null, $devnull);
 if (! -t null || -e '/xenix' || $^O eq 'machten' || $Is_MSWin32)
        {print "ok 40\n";} else {print "not ok 40\n";}
 close(null);
 
 # These aren't strictly "stat" calls, but so what?
+my $file = catfile(curdir(), 'op', 'stat.t');
+if (-T $file) {print "ok 41\n";} else {print "not ok 41\n";}
+if (! -B $file) {print "ok 42\n";} else {print "not ok 42\n";}
 
-if (-T 'op/stat.t') {print "ok 41\n";} else {print "not ok 41\n";}
-if (! -B 'op/stat.t') {print "ok 42\n";} else {print "not ok 42\n";}
+if (-B './perl' || -B './perl.exe' || -B $^X) {print "ok 43\n";} else {print "not ok 
+43\n";}
+if (! -T './perl' && ! -T './perl.exe' || ! -T $^X) {print "ok 44\n";} else {print 
+"not ok 44\n";}
 
-if (-B './perl' || -B './perl.exe') {print "ok 43\n";} else {print "not ok 43\n";}
-if (! -T './perl' && ! -T './perl.exe') {print "ok 44\n";} else {print "not ok 44\n";}
-
-open(FOO,'op/stat.t');
+open(FOO,$file);
 eval { -T FOO; };
 if ($@ =~ /not implemented/) {
     print "# $@";
@@ -265,7 +269,7 @@
     if (! -B FOO) {print "ok 49\n";} else {print "not ok 49\n";}
     close(FOO);
 
-    open(FOO,'op/stat.t');
+    open(FOO,$file);
     $_ = <FOO>;
     if (/perl/) {print "ok 50\n";} else {print "not ok 50\n";}
     if (-T FOO) {print "ok 51\n";} else {print "not ok 51\n";}
@@ -276,8 +280,8 @@
 }
 close(FOO);
 
-if (-T '/dev/null') {print "ok 55\n";} else {print "not ok 55\n";}
-if (-B '/dev/null') {print "ok 56\n";} else {print "not ok 56\n";}
+if (-T $devnull) {print "ok 55\n";} else {print "not ok 55\n";}
+if (-B $devnull) {print "ok 56\n";} else {print "not ok 56\n";}
 
 # and now, a few parsing tests:
 $_ = 'Op.stat.tmp';

==== //depot/maint-5.6/macperl/t/op/subst_wamp.t#2 (xtext) ====
Index: perl/t/op/subst_wamp.t
--- perl/t/op/subst_wamp.t.~1~  Sat Jul  7 17:50:08 2001
+++ perl/t/op/subst_wamp.t      Sat Jul  7 17:50:08 2001
@@ -1,7 +1,7 @@
 #!./perl
 
 $dummy = defined $&;           # Now we have it...
-for $file ('op/subst.t', 't/op/subst.t') {
+for $file ('op/subst.t', 't/op/subst.t', ':op:subst.t') {
   if (-r $file) {
     do $file;
     exit;

==== //depot/maint-5.6/macperl/t/op/taint.t#2 (xtext) ====
Index: perl/t/op/taint.t
--- perl/t/op/taint.t.~1~       Sat Jul  7 17:50:08 2001
+++ perl/t/op/taint.t   Sat Jul  7 17:50:08 2001
@@ -14,6 +14,7 @@
 
 use strict;
 use Config;
+use File::Spec::Functions;
 
 # We do not want the whole taint.t to fail
 # just because Errno possibly failing.
@@ -36,11 +37,12 @@
   }
 }
 
+my $Is_MacOS = $^O eq 'MacOS';
 my $Is_VMS = $^O eq 'VMS';
 my $Is_MSWin32 = $^O eq 'MSWin32';
 my $Is_Dos = $^O eq 'dos';
 my $Invoke_Perl = $Is_VMS ? 'MCR Sys$Disk:[]Perl.' :
-                  $Is_MSWin32 ? '.\perl' : './perl';
+                  $Is_MSWin32 ? '.\perl' : $Is_MacOS ? '::macos:perl' : './perl';
 my @MoreEnv = qw/IFS CDPATH ENV BASH_ENV/;
 
 if ($Is_VMS) {
@@ -97,7 +99,7 @@
 }
 
 # We need an external program to call.
-my $ECHO = ($Is_MSWin32 ? ".\\echo$$" : "./echo$$");
+my $ECHO = ($Is_MSWin32 ? ".\\echo$$" : $Is_MacOS ? ":echo$$" : "./echo$$");
 END { unlink $ECHO }
 open PROG, "> $ECHO" or die "Can't create $ECHO: $!";
 print PROG 'print "@ARGV\n"', "\n";
@@ -118,7 +120,7 @@
 
     test 1, eval { `$echo 1` } eq "1\n";
 
-    if ($Is_MSWin32 || $Is_VMS || $Is_Dos) {
+    if ($Is_MSWin32 || $Is_VMS || $Is_Dos || $Is_MacOS) {
        print "# Environment tainting tests skipped\n";
        for (2..5) { print "ok $_\n" }
     }
@@ -235,7 +237,7 @@
 # How about command-line arguments? The problem is that we don't
 # always get some, so we'll run another process with some.
 {
-    my $arg = "./arg$$";
+    my $arg = catfile(curdir(), "arg$$");
     open PROG, "> $arg" or die "Can't create $arg: $!";
     print PROG q{
        eval { join('', @ARGV), kill 0 };
@@ -251,7 +253,7 @@
 
 # Reading from a file should be tainted
 {
-    my $file = './TEST';
+    my $file = catfile(curdir(), 'TEST');
     test 32, open(FILE, $file), "Couldn't open '$file': $!";
 
     my $block;
@@ -583,7 +585,10 @@
     if ($Config{d_readlink} && $Config{d_symlink}) {
        my $symlink = "sl$$";
        unlink($symlink);
-       symlink("/something/naughty", $symlink) or die "symlink: $!\n";
+       my $sl = "/something/naughty";
+       # it has to be a real path on Mac OS
+       $sl = MacPerl::MakePath((MacPerl::Volumes)[0]) if $Is_MacOS;
+       symlink($sl, $symlink) or die "symlink: $!\n";
        my $readlink = readlink($symlink);
        test 144, tainted $readlink;
        unlink($symlink);
@@ -697,7 +702,7 @@
 {
     # bug id 20001004.006
 
-    open IN, "./TEST" or warn "$0: cannot read ./TEST: $!" ;
+    open IN, catfile(curdir(), 'TEST') or warn "$0: cannot read ./TEST: $!" ;
     local $/;
     my $a = <IN>;
     my $b = <IN>;
@@ -709,7 +714,7 @@
 {
     # bug id 20001004.007
 
-    open IN, "./TEST" or warn "$0: cannot read ./TEST: $!" ;
+    open IN, catfile(curdir(), 'TEST') or warn "$0: cannot read ./TEST: $!" ;
     my $a = <IN>;
 
     my $c = { a => 42,

==== //depot/maint-5.6/macperl/t/pragma/diagnostics.t#2 (xtext) ====
Index: perl/t/pragma/diagnostics.t
--- perl/t/pragma/diagnostics.t.~1~     Sat Jul  7 17:50:08 2001
+++ perl/t/pragma/diagnostics.t Sat Jul  7 17:50:08 2001
@@ -1,8 +1,15 @@
 #!./perl
 
 BEGIN {
-    chdir '..' if -d '../pod' && -d '../t';
-    @INC = 'lib';
+       # special-case Mac OS because of
+       # diagnostic-finding-date logistics
+       if ($^O eq 'MacOS') {
+           chdir '::' if -d '::pod' && -d '::t';
+           @INC = ":lib:";
+       } else {
+           chdir '..' if -d '../pod' && -d '../t';
+           @INC = 'lib';
+       }
 }
 
 

==== //depot/maint-5.6/macperl/t/pragma/subs.t#2 (xtext) ====
Index: perl/t/pragma/subs.t
--- perl/t/pragma/subs.t.~1~    Sat Jul  7 17:50:08 2001
+++ perl/t/pragma/subs.t        Sat Jul  7 17:50:08 2001
@@ -11,6 +11,7 @@
 my @prgs = split "\n########\n", <DATA>;
 print "1..", scalar @prgs, "\n";
 
+my $Is_MacOS = $^O eq 'MacOS';
 my $Is_VMS = $^O eq 'VMS';
 my $Is_MSWin32 = $^O eq 'MSWin32';
 my $tmpfile = "tmp0000";
@@ -46,10 +47,12 @@
     print TEST $prog,"\n";
     close TEST;
     my $results = $Is_VMS ?
-                  `./perl $switch $tmpfile 2>&1` :
-                 $Is_MSWin32 ?
-                  `.\\perl -I../lib $switch $tmpfile 2>&1` :
-                  `./perl $switch $tmpfile 2>&1`;
+       `./perl $switch $tmpfile 2>&1` :
+           $Is_MSWin32 ?
+               `.\\perl -I../lib $switch $tmpfile 2>&1` :
+                   $Is_MacOS ?
+                       `$^X -I::lib $switch $tmpfile` :
+                           `./perl $switch $tmpfile 2>&1`;
     my $status = $?;
     $results =~ s/\n+$//;
     # allow expected output to be written as if $prog is on STDIN
@@ -143,7 +146,7 @@
 1;
 --FILE--
 use subs qw( Fred ) ;
-require "./abc" ;
+require ($^O eq "MacOS" ? ":abc" : "./abc");
 sub Fred { print $_[0] + $_[1], "\n" }
 EXPECT
 3

==== //depot/maint-5.6/macperl/t/pragma/warn/doio#2 (text) ====
Index: perl/t/pragma/warn/doio
--- perl/t/pragma/warn/doio.~1~ Sat Jul  7 17:50:08 2001
+++ perl/t/pragma/warn/doio     Sat Jul  7 17:50:08 2001
@@ -156,6 +156,12 @@
 ########
 # doio.c [Perl_do_aexec5]
 use warnings 'io' ;
+BEGIN {
+    if ($^O eq 'MacOS') {
+       print "SKIPPED\n# exec not present\n";
+       exit;
+    }
+}
 exec "lskdjfalksdjfdjfkls","" ;
 no warnings 'io' ;
 exec "lskdjfalksdjfdjfkls","" ;
@@ -165,6 +171,12 @@
 ########
 # doio.c [Perl_do_exec3]
 use warnings 'io' ;
+BEGIN {
+    if ($^O eq 'MacOS') {
+       print "SKIPPED\n# exec not present\n";
+       exit;
+    }
+}
 exec "lskdjfalksdjfdjfkls", "abc" ;
 no warnings 'io' ;
 exec "lskdjfalksdjfdjfkls", "abc" ;

==== //depot/maint-5.6/macperl/t/pragma/warn/mg#2 (text) ====
Index: perl/t/pragma/warn/mg
--- perl/t/pragma/warn/mg.~1~   Sat Jul  7 17:50:08 2001
+++ perl/t/pragma/warn/mg       Sat Jul  7 17:50:08 2001
@@ -25,7 +25,7 @@
 ########
 # mg.c
 use warnings 'signal' ;
-if ($^O eq 'MSWin32' || $^O eq 'VMS') {
+if ($^O eq 'MSWin32' || $^O eq 'VMS' || $^O eq 'MacOS') {
     print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
 }
 $|=1;
@@ -35,8 +35,8 @@
 ########
 # mg.c
 no warnings 'signal' ;
-if ($^O eq 'MSWin32' || $^O eq 'VMS') {
-    print "SKIPPED\n# win32, can't kill() to raise()\n"; exit;
+if ($^O eq 'MSWin32' || $^O eq 'VMS' || $^O eq 'MacOS') {
+    print "SKIPPED\n# $^O, can't kill() to raise()\n"; exit;
 }
 $|=1;
 $SIG{"INT"} = "fred"; kill "INT",$$;

==== //depot/maint-5.6/macperl/t/pragma/warn/op#2 (text) ====
Index: perl/t/pragma/warn/op
--- perl/t/pragma/warn/op.~1~   Sat Jul  7 17:50:08 2001
+++ perl/t/pragma/warn/op       Sat Jul  7 17:50:08 2001
@@ -745,6 +745,12 @@
 ########
 # op.c
 use warnings 'syntax' ;
+BEGIN {
+    if ($^O eq 'MacOS') {
+       print "SKIPPED\n# exec not present\n";
+       exit;
+    }
+}
 exec "$^X -e 1" ; 
 my $a
 EXPECT
@@ -774,6 +780,12 @@
 ########
 # op.c
 no warnings 'syntax' ;
+BEGIN {
+    if ($^O eq 'MacOS') {
+       print "SKIPPED\n# exec not present\n";
+       exit;
+    }
+}
 exec "$^X -e 1" ; 
 my $a
 EXPECT

==== //depot/maint-5.6/macperl/t/pragma/warn/pp_sys#2 (text) ====
==== //depot/maint-5.6/macperl/t/pragma/warnings.t#2 (xtext) ====
Index: perl/t/pragma/warnings.t
--- perl/t/pragma/warnings.t.~1~        Sat Jul  7 17:50:08 2001
+++ perl/t/pragma/warnings.t    Sat Jul  7 17:50:08 2001
@@ -7,8 +7,11 @@
     require Config; import Config;
 }
 
+use File::Spec::Functions;
+
 $| = 1;
 
+my $Is_MacOS   = $^O eq 'MacOS';
 my $Is_VMS     = $^O eq 'VMS';
 my $Is_MSWin32 = $^O eq 'MSWin32';
 my $tmpfile = "tmp0000";
@@ -20,9 +23,15 @@
 my @w_files = () ;
 
 if (@ARGV)
-  { print "ARGV = [@ARGV]\n" ; @w_files = map { s#^#./pragma/warn/#; $_ } @ARGV }
+  { print "ARGV = [@ARGV]\n" ;
+    if ($^O eq 'MacOS') {
+      @w_files = map { s#^#:pragma:warn:#; $_ } @ARGV
+    } else {
+      @w_files = map { s#^#./pragma/warn/#; $_ } @ARGV
+    }
+  }
 else
-  { @w_files = sort glob("pragma/warn/*") }
+  { @w_files = sort glob(catfile(curdir(), "pragma", "warn", "*")) }
 
 foreach (@w_files) {
 
@@ -70,14 +79,24 @@
        shift @files ;
        $prog = shift @files ;
     }
+
+    # fix up some paths
+    if ($^O eq 'MacOS') {
+       $prog =~ s|require "./abc";|require ":abc";|g;
+       $prog =~ s|require "./abcd";|require ":abcd";|g;
+       $prog =~ s|"\."|":"|g;
+    }
+
     open TEST, ">$tmpfile";
     print TEST $prog,"\n";
     close TEST;
     my $results = $Is_VMS ?
-                  `./perl "-I../lib" $switch $tmpfile 2>&1` :
-                 $Is_MSWin32 ?
-                  `.\\perl -I../lib $switch $tmpfile 2>&1` :
-                  `./perl -I../lib $switch $tmpfile 2>&1`;
+       `./perl "-I../lib" $switch $tmpfile 2>&1` :
+           $Is_MSWin32 ?
+               `.\\perl -I../lib $switch $tmpfile 2>&1` :
+                   $Is_MacOS ?
+                       `$^X -I::lib $switch $tmpfile` :
+                           `./perl -I../lib $switch $tmpfile 2>&1`;
     my $status = $?;
     $results =~ s/\n+$//;
     # allow expected output to be written as if $prog is on STDIN
@@ -88,6 +107,14 @@
     $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|:abcd\b|./abcd|g;
+       $results =~ s|:abc\.pm\b|abc.pm|g;
+       $results =~ s|:abc\b|./abc|g;
+    }
+
     $expected =~ s/\n+$//;
     my $prefix = ($results =~ s#^PREFIX(\n|$)##) ;
     # any special options? (OPTIONS foo bar zap)
End of Patch.

Reply via email to