X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2Fio_unix.t;h=0e559e0d9074eb928715fca8e5f0607d5258d899;hb=4348140855c01942a6531a8decdfe1325fe36f8a;hp=ccb274847fc7146bdb4a38cb22855c05dfcc3e55;hpb=93430cb427caeba01ba89b008008b46159a7c165;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/lib/io_unix.t b/t/lib/io_unix.t index ccb2748..0e559e0 100644 --- a/t/lib/io_unix.t +++ b/t/lib/io_unix.t @@ -5,17 +5,39 @@ BEGIN { chdir 't' if -d 't'; unshift @INC, '../lib' if -d '../lib'; } + # ``use IO::Socket'' executes too early below in the os2 block + if ($^O eq 'dos') { + print "1..0 # Skip: no fork\n"; + } } use Config; BEGIN { if(-d "lib" && -f "TEST") { - if ( ($Config{'extensions'} !~ /\bSocket\b/ || - $Config{'extensions'} !~ /\bIO\b/) && - !(($^O eq 'VMS') && $Config{d_socket})) { - print "1..0\n"; - exit 0; + my $reason; + if (! $Config{'d_fork'}) { + $reason = 'no fork'; + } + elsif ($Config{'extensions'} !~ /\bSocket\b/) { + $reason = 'Socket extension unavailable'; + } + elsif ($Config{'extensions'} !~ /\bIO\b/) { + $reason = 'IO extension unavailable'; + } + elsif ($^O eq 'os2') { + use IO::Socket; + + eval {IO::Socket::pack_sockaddr_un('/tmp/foo') || 1} + or $@ !~ /not implemented/ or + $reason = 'compiled without TCP/IP stack v4'; + } elsif ($^O eq 'qnx') { + $reason = 'Not implemented'; + } + undef $reason if $^O eq 'VMS' and $Config{d_socket}; + if ($reason) { + print "1..0 # Skip: $reason\n"; + exit 0; } } } @@ -23,12 +45,12 @@ BEGIN { $PATH = "/tmp/sock-$$"; # Test if we can create the file within the tmp directory -if (-e $PATH or not open(TEST, ">$PATH")) { - print "1..0\n"; +if (-e $PATH or not open(TEST, ">$PATH") and $^O ne 'os2') { + print "1..0 # Skip: cannot open '$PATH' for write\n"; exit 0; } close(TEST); -unlink($PATH) or die "Can't unlink $PATH: $!"; +unlink($PATH) or $^O eq 'os2' or die "Can't unlink $PATH: $!"; # Start testing $| = 1; @@ -51,7 +73,7 @@ if($pid = fork()) { $sock->close; waitpid($pid,0); - unlink($PATH) || warn "Can't unlink $PATH: $!"; + unlink($PATH) || $^O eq 'os2' || warn "Can't unlink $PATH: $!"; print "ok 5\n";