From 6cda6a94c38df76abe91f4d620a7377b8b889158 Mon Sep 17 00:00:00 2001 From: Steve Hay Date: Fri, 3 Oct 2014 09:25:12 +0100 Subject: 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.) --- Makefile.PL | 3 ++- t/nntp_ssl.t | 6 +++++- t/pop3_ssl.t | 6 +++++- t/smtp_ssl.t | 6 +++++- 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 -- cgit v1.2.3-24-ge0c7