diff options
author | Steve Hay <SteveHay@planit.com> | 2006-04-05 10:35:58 +0000 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2006-04-05 10:35:58 +0000 |
commit | ec64f737c146f80372e587adab709f821d4d25f9 (patch) | |
tree | 3c58cae9c0fa5f6df31763ddf54e34f4f018606f /ext/IO/t | |
parent | 878305029f3dfbd9e56219891ad218e5edbb3c02 (diff) | |
download | perl-ec64f737c146f80372e587adab709f821d4d25f9.tar.gz |
Simplify tests for fork() capabilities
Jarkko pointed out that change #27710 was causing some
black smoke so makes the tests for fork() simpler, as
per lib\Test\Simple\t\fork.t for now. (Ideally we want
a $Config{d_pseudofork}, as suggested by Andy Dougherty,
but that'll have to wait until I get some more tuits.)
p4raw-link: @27710 on //depot/perl: 2f78ce11bc4a9355ade5d20a0825b10fbb177169
p4raw-id: //depot/perl@27718
Diffstat (limited to 'ext/IO/t')
-rw-r--r-- | ext/IO/t/io_multihomed.t | 16 | ||||
-rwxr-xr-x | ext/IO/t/io_pipe.t | 16 | ||||
-rwxr-xr-x | ext/IO/t/io_sock.t | 16 |
3 files changed, 21 insertions, 27 deletions
diff --git a/ext/IO/t/io_multihomed.t b/ext/IO/t/io_multihomed.t index d9355cf424..3560d7be1c 100644 --- a/ext/IO/t/io_multihomed.t +++ b/ext/IO/t/io_multihomed.t @@ -10,6 +10,11 @@ BEGIN { use Config; BEGIN { + my $can_fork = $Config{d_fork} || + (($^O eq 'MSWin32' || $^O eq 'NetWare') and + $Config{useithreads} and + $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/ + ); my $reason; if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bSocket\b/) { $reason = 'Socket extension unavailable'; @@ -17,15 +22,8 @@ BEGIN { elsif ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bIO\b/) { $reason = 'IO extension unavailable'; } - elsif ( - ! eval { - my $pid= fork(); - ! defined($pid) and die "Fork failed!"; - ! $pid and exit; - defined waitpid($pid, 0); - } - ) { - $reason = "no fork: $@"; + elsif (!$can_fork) { + $reason = 'no fork'; } if ($reason) { print "1..0 # Skip: $reason\n"; diff --git a/ext/IO/t/io_pipe.t b/ext/IO/t/io_pipe.t index 857d3d0e33..f4519a2ffd 100755 --- a/ext/IO/t/io_pipe.t +++ b/ext/IO/t/io_pipe.t @@ -16,19 +16,17 @@ BEGIN { use Config; BEGIN { + my $can_fork = $Config{d_fork} || + (($^O eq 'MSWin32' || $^O eq 'NetWare') and + $Config{useithreads} and + $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/ + ); my $reason; if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bIO\b/) { $reason = 'IO extension unavailable'; } - elsif ( - ! eval { - my $pid= fork(); - ! defined($pid) and die "Fork failed!"; - ! $pid and exit; - defined waitpid($pid, 0); - } - ) { - $reason = "no fork: $@"; + elsif (!$can_fork) { + $reason = 'no fork'; } elsif ($^O eq 'MSWin32' && !$ENV{TEST_IO_PIPE}) { $reason = 'Win32 testing environment not set'; diff --git a/ext/IO/t/io_sock.t b/ext/IO/t/io_sock.t index b743bf0700..24d68180c0 100755 --- a/ext/IO/t/io_sock.t +++ b/ext/IO/t/io_sock.t @@ -10,6 +10,11 @@ BEGIN { use Config; BEGIN { + my $can_fork = $Config{d_fork} || + (($^O eq 'MSWin32' || $^O eq 'NetWare') and + $Config{useithreads} and + $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/ + ); my $reason; if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bSocket\b/) { $reason = 'Socket extension unavailable'; @@ -17,15 +22,8 @@ BEGIN { elsif ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bIO\b/) { $reason = 'IO extension unavailable'; } - elsif ( - ! eval { - my $pid= fork(); - ! defined($pid) and die "Fork failed!"; - ! $pid and exit; - defined waitpid($pid, 0); - } - ) { - $reason = "no fork: $@"; + elsif (!$can_fork) { + $reason = 'no fork'; } if ($reason) { print "1..0 # Skip: $reason\n"; |