about summary refs log tree commit
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2014-10-03 09:25:12 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2014-10-03 09:25:12 +0100
commit6cda6a94c38df76abe91f4d620a7377b8b889158 (patch)
tree2e359d0656a1cc7feb670f01fde6c5d3d38bf947
parent12da672001a7b21c1c880bce88506acb34c96a67 (diff)
downloadperl-libnet-6cda6a94c38df76abe91f4d620a7377b8b889158.tar.gz
Better skipping of tests requiring fork()
Windows doesn't have a real fork() and only has a fork() emulation when
built with ithreads and -D PERL_IMPLICIT_SYS. ($Config{d_pseudofork} can
be used to identify such builds on recent perls, but was only added in
Perl 5.8.9/5.10.0.)
-rw-r--r--Makefile.PL3
-rw-r--r--t/nntp_ssl.t6
-rw-r--r--t/pop3_ssl.t6
-rw-r--r--t/smtp_ssl.t6
4 files changed, 17 insertions, 4 deletions
diff --git a/Makefile.PL b/Makefile.PL
index fdfbc04..375e1c9 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -173,7 +173,8 @@ MAIN: {
         },
 
         TEST_REQUIRES => {
-            'Cwd' => '0'
+            'Config' => '0',
+            'Cwd'    => '0'
         },
 
         PREREQ_PM => {
diff --git a/t/nntp_ssl.t b/t/nntp_ssl.t
index e4b4bcb..55cdc16 100644
--- a/t/nntp_ssl.t
+++ b/t/nntp_ssl.t
@@ -5,6 +5,7 @@ use 5.008001;
 use strict;
 use warnings;
 
+use Config;
 use File::Temp 'tempfile';
 use Net::NNTP;
 use Test::More;
@@ -16,7 +17,10 @@ my $parent = 0;
 plan skip_all => "no SSL support found in Net::NNTP" if ! Net::NNTP->can_ssl;
 
 plan skip_all => "fork not supported on this platform"
-  if grep { $^O =~m{$_} } qw(MacOS VOS vmesa riscos amigaos);
+  unless $Config::Config{d_fork} || $Config::Config{d_pseudofork} ||
+    (($^O eq 'MSWin32' || $^O eq 'NetWare') and
+     $Config::Config{useithreads} and
+     $Config::Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/);
 
 plan skip_all => "incomplete or version of IO::Socket::SSL"
   if ! eval { require IO::Socket::SSL::Utils };
diff --git a/t/pop3_ssl.t b/t/pop3_ssl.t
index 3ba74af..b7b433e 100644
--- a/t/pop3_ssl.t
+++ b/t/pop3_ssl.t
@@ -5,6 +5,7 @@ use 5.008001;
 use strict;
 use warnings;
 
+use Config;
 use File::Temp 'tempfile';
 use Net::POP3;
 use Test::More;
@@ -16,7 +17,10 @@ my $parent = 0;
 plan skip_all => "no SSL support found in Net::POP3" if ! Net::POP3->can_ssl;
 
 plan skip_all => "fork not supported on this platform"
-  if grep { $^O =~m{$_} } qw(MacOS VOS vmesa riscos amigaos);
+  unless $Config::Config{d_fork} || $Config::Config{d_pseudofork} ||
+    (($^O eq 'MSWin32' || $^O eq 'NetWare') and
+     $Config::Config{useithreads} and
+     $Config::Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/);
 
 plan skip_all => "incomplete or to old version of IO::Socket::SSL" if ! eval {
   require IO::Socket::SSL
diff --git a/t/smtp_ssl.t b/t/smtp_ssl.t
index b7a533f..00b67e5 100644
--- a/t/smtp_ssl.t
+++ b/t/smtp_ssl.t
@@ -5,6 +5,7 @@ use 5.008001;
 use strict;
 use warnings;
 
+use Config;
 use File::Temp 'tempfile';
 use Net::SMTP;
 use Test::More;
@@ -16,7 +17,10 @@ my $parent = 0;
 plan skip_all => "no SSL support found in Net::SMTP" if ! Net::SMTP->can_ssl;
 
 plan skip_all => "fork not supported on this platform"
-  if grep { $^O =~m{$_} } qw(MacOS VOS vmesa riscos amigaos);
+  unless $Config::Config{d_fork} || $Config::Config{d_pseudofork} ||
+    (($^O eq 'MSWin32' || $^O eq 'NetWare') and
+     $Config::Config{useithreads} and
+     $Config::Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/);
 
 plan skip_all => "incomplete or to old version of IO::Socket::SSL" if ! eval {
   require IO::Socket::SSL