Change 27718 by [EMAIL PROTECTED] on 2006/04/05 10:35:58
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.)
Affected files ...
... //depot/perl/ext/IO/t/io_multihomed.t#4 edit
... //depot/perl/ext/IO/t/io_pipe.t#6 edit
... //depot/perl/ext/IO/t/io_sock.t#7 edit
Differences ...
==== //depot/perl/ext/IO/t/io_multihomed.t#4 (text) ====
Index: perl/ext/IO/t/io_multihomed.t
--- perl/ext/IO/t/io_multihomed.t#3~27710~ 2006-04-04 03:34:10.000000000
-0700
+++ perl/ext/IO/t/io_multihomed.t 2006-04-05 03:35:58.000000000 -0700
@@ -10,6 +10,11 @@
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 @@
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";
==== //depot/perl/ext/IO/t/io_pipe.t#6 (xtext) ====
Index: perl/ext/IO/t/io_pipe.t
--- perl/ext/IO/t/io_pipe.t#5~27711~ 2006-04-04 04:14:27.000000000 -0700
+++ perl/ext/IO/t/io_pipe.t 2006-04-05 03:35:58.000000000 -0700
@@ -16,19 +16,17 @@
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';
==== //depot/perl/ext/IO/t/io_sock.t#7 (xtext) ====
Index: perl/ext/IO/t/io_sock.t
--- perl/ext/IO/t/io_sock.t#6~27710~ 2006-04-04 03:34:10.000000000 -0700
+++ perl/ext/IO/t/io_sock.t 2006-04-05 03:35:58.000000000 -0700
@@ -10,6 +10,11 @@
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 @@
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";
End of Patch.