rename s/sv_getcwd/getcwd_sv/ for better conformance to existing
[p5sagit/p5-mst-13.2.git] / ext / POSIX / POSIX.t
index 09bd88c..87a2aea 100755 (executable)
@@ -10,15 +10,17 @@ BEGIN {
     }
 }
 
-use POSIX qw(fcntl_h signal_h limits_h _exit getcwd open read strftime write);
+use POSIX qw(fcntl_h signal_h limits_h _exit getcwd open read strftime write
+            errno);
 use strict subs;
 
 $| = 1;
-print "1..27\n";
+print "1..29\n";
 
 $Is_W32 = $^O eq 'MSWin32';
 $Is_NetWare = $^O eq 'NetWare';
 $Is_Dos = $^O eq 'dos';
+$Is_MPE = $^O eq 'mpeix';
 
 $testfd = open("TEST", O_RDONLY, 0) and print "ok 1\n";
 read($testfd, $buffer, 9) if $testfd > 2;
@@ -71,9 +73,13 @@ sub SigINT {
 }
 }
 
-print &_POSIX_OPEN_MAX > $fds[1] ? "ok 12\n" : "not ok 12\n";
+if ($Is_MPE) {
+    print "ok 12 # skipped, _POSIX_OPEN_MAX is inaccurate on MPE\n"
+} else {
+    print &_POSIX_OPEN_MAX > $fds[1] ? "ok 12\n" : "not ok 12\n"
+}
 
-print getcwd() =~ m#/t$# ? "ok 13\n" : "not ok 13\n";
+print getcwd() =~ m#[/\\]t$# ? "ok 13\n" : "not ok 13\n";
 
 # Check string conversion functions.
 
@@ -133,7 +139,24 @@ try_strftime(26, "Wed Mar 01 00:00:00 2000 061", 0,0,0, 1,2,100);
 try_strftime(27, "Fri Mar 31 00:00:00 2000 091", 0,0,0, 31,2,100);
 &POSIX::setlocale(&POSIX::LC_TIME, $lc) if $Config{d_setlocale};
 
+{
+    for my $test (0, 1) {
+       $! = 0;
+       # POSIX::errno is autoloaded. 
+       # Autoloading requires many system calls.
+       # errno() looks at $! to generate its result.
+       # Autoloading should not munge the value.
+       my $foo  = $!;
+       my $errno = POSIX::errno();
+       print "not " unless $errno == $foo;
+       print "ok ", 28 + $test, "\n";
+    }
+}
+
 $| = 0;
 # The following line assumes buffered output, which may be not true with EMX:
-print '@#!*$@(!@#$' unless ($^O eq 'os2' || $^O eq 'uwin' || $^O eq 'os390');
+print '@#!*$@(!@#$' unless ($^O eq 'os2' || $^O eq 'uwin' || $^O eq 'os390' ||
+                           (defined $ENV{PERLIO} &&
+                            $ENV{PERLIO} eq 'unix' &&
+                            $Config::Config{useperlio}));
 _exit(0);