Skip to content

Commit

Permalink
Solve Debian Bug#764868: with environment NO_NETWORK_TESTING set no e…
Browse files Browse the repository at this point in the history
…xternal tests will be done.

Simplify checks for fork by putting it into testlib and fix it by including Config.
  • Loading branch information
noxxi committed Oct 12, 2014
1 parent 7925def commit de1451f
Show file tree
Hide file tree
Showing 31 changed files with 36 additions and 222 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,3 +1,5 @@
- Skip live tests without asking if environment NO_NETWORK_TESTING is set.
Thanks to ntyni[AT]debian[DOT]org for suggestion.
- skip tests which require fork on non-default windows setups without proper
fork. Thanks to SHAY for https://github.com/noxxi/p5-io-socket-ssl/pull/18
1.999 2014/10/09
Expand Down
3 changes: 2 additions & 1 deletion Makefile.PL
Expand Up @@ -108,7 +108,8 @@ my %usable_ca;
}
}

my $xt = prompt( "Should I do external tests?\n".
my $xt = $ENV{NO_NETWORK_TESTING} && 'n';
$xt ||= prompt( "Should I do external tests?\n".
"These test will detect if there are network problems and fail soft,\n".
"so please disable them only if you definitely don't want to have any\n".
"network traffic to external sites. ".
Expand Down
8 changes: 0 additions & 8 deletions t/acceptSSL-timeout.t
Expand Up @@ -3,14 +3,6 @@ use warnings;
use IO::Socket::SSL;
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}

$|=1;
print "1..15\n";

Expand Down
9 changes: 1 addition & 8 deletions t/auto_verify_hostname.t
Expand Up @@ -5,14 +5,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

$|=1;
print "1..30\n";
Expand Down
8 changes: 1 addition & 7 deletions t/cert_formats.t
Expand Up @@ -3,13 +3,7 @@ use warnings;
use Test::More;
use IO::Socket::SSL;
use File::Temp 'tempfile';

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 => "fork not implemented on this platform";
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

my $srv = IO::Socket::INET->new(
LocalAddr => '127.0.0.1',
Expand Down
9 changes: 1 addition & 8 deletions t/cert_no_file.t
Expand Up @@ -16,14 +16,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

$|=1;
print "1..9\n";
Expand Down
9 changes: 1 addition & 8 deletions t/compatibility.t
Expand Up @@ -6,17 +6,10 @@ use strict;
use warnings;
use IO::Socket::SSL;
use Socket;
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

$|=1;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}

$SIG{'CHLD'} = "IGNORE";

print "1..9\n";
Expand Down
9 changes: 0 additions & 9 deletions t/connectSSL-timeout.t
@@ -1,17 +1,8 @@
use strict;
use warnings;
use IO::Socket::SSL;

do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}

$|=1;
print "1..16\n";

Expand Down
9 changes: 1 addition & 8 deletions t/core.t
Expand Up @@ -8,17 +8,10 @@ use Net::SSLeay;
use Socket;
use IO::Socket::SSL;
use Errno 'EAGAIN';
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

$|=1;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}

my $CAN_NONBLOCK = $^O =~m{mswin32}i ? 0 : eval "use 5.006; use IO::Select; 1";
my $CAN_PEEK = &Net::SSLeay::OPENSSL_VERSION_NUMBER >= 0x0090601f;

Expand Down
9 changes: 1 addition & 8 deletions t/dhe.t
Expand Up @@ -13,14 +13,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

$|=1;
print "1..3\n";
Expand Down
9 changes: 1 addition & 8 deletions t/ecdhe.t
Expand Up @@ -7,14 +7,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

if ( ! IO::Socket::SSL->can_ecdh ) {
print "1..0 # Skipped: no support for ecdh with this openssl/Net::SSLeay\n";
Expand Down
9 changes: 1 addition & 8 deletions t/io-socket-inet6.t
Expand Up @@ -14,14 +14,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

# check first if we have loaded IO::Socket::IP, as if so we won't need or use
# IO::Socket::INET6
Expand Down
9 changes: 1 addition & 8 deletions t/io-socket-ip.t
Expand Up @@ -10,14 +10,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

# check if we have loaded IO::Socket::IP, IO::Socket::SSL should do it by
# itself if it is available
Expand Down
9 changes: 1 addition & 8 deletions t/memleak_bad_handshake.t
Expand Up @@ -9,14 +9,7 @@ use Socket;
use IO::Socket::SSL;
use IO::Select;
use Errno qw(EAGAIN EINPROGRESS );

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

if ( grep { $^O =~m{$_}i } qw( MacOS VOS vmesa riscos amigaos mswin32) ) {
print "1..0 # Skipped: ps not implemented on this platform\n";
Expand Down
9 changes: 1 addition & 8 deletions t/mitm.t
Expand Up @@ -6,14 +6,7 @@ use Net::SSLeay;
use Socket;
use IO::Socket::SSL;
use IO::Socket::SSL::Intercept;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

print "1..8\n";

Expand Down
9 changes: 2 additions & 7 deletions t/nonblock.t
Expand Up @@ -10,19 +10,14 @@ use Socket;
use IO::Socket::SSL;
use IO::Select;
use Errno qw( EAGAIN EINPROGRESS EPIPE ECONNRESET );
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

if ( ! eval "use 5.006; use IO::Select; return 1" ) {
print "1..0 # Skipped: no support for nonblocking sockets\n";
exit;
}

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}


if ( $^O =~m{mswin32}i ) {
print "1..0 # Skipped: nonblocking does not work on Win32\n";
Expand Down
9 changes: 1 addition & 8 deletions t/npn.t
Expand Up @@ -7,14 +7,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

# check if we have NPN available
# if it is available
Expand Down
8 changes: 1 addition & 7 deletions t/plain_upgrade_downgrade.t
Expand Up @@ -3,13 +3,7 @@ use warnings;
use IO::Socket::SSL;
use IO::Socket::SSL::Utils;
use Test::More;

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 => "fork not implemented on this platform";
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

# create listener
IO::Socket::SSL::default_ca('certs/my-ca.pem');
Expand Down
8 changes: 1 addition & 7 deletions t/public_suffix_ssl.t
Expand Up @@ -3,13 +3,7 @@ use warnings;
use IO::Socket::SSL;
use IO::Socket::SSL::Utils;
use Test::More;

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 => "fork not implemented on this platform";
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

my @tests = qw(
fail:com|*
Expand Down
9 changes: 1 addition & 8 deletions t/readline.t
Expand Up @@ -16,14 +16,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

my @tests;
push @tests, [
Expand Down
9 changes: 1 addition & 8 deletions t/sessions.t
Expand Up @@ -7,14 +7,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

$|=1;
my $numtests = 35;
Expand Down
9 changes: 1 addition & 8 deletions t/signal-readline.t
Expand Up @@ -5,14 +5,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

if ( $^O =~m{mswin32}i ) {
print "1..0 # Skipped: signals not relevant on this platform\n";
Expand Down
9 changes: 1 addition & 8 deletions t/sni.t
Expand Up @@ -5,14 +5,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

if ( ! IO::Socket::SSL->can_server_sni() ) {
print "1..0 # skipped because no server side SNI support - openssl/Net::SSleay too old\n";
Expand Down
9 changes: 1 addition & 8 deletions t/sni_verify.t
Expand Up @@ -5,14 +5,7 @@ use warnings;
use Net::SSLeay;
use Socket;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

if ( ! IO::Socket::SSL->can_server_sni() ) {
print "1..0 # skipped because no server side SNI support - openssl/Net::SSleay too old\n";
Expand Down
9 changes: 1 addition & 8 deletions t/start-stopssl.t
Expand Up @@ -4,14 +4,7 @@ use strict;
use warnings;
use IO::Socket::INET;
use IO::Socket::SSL;

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/) ) {
print "1..0 # Skipped: fork not implemented on this platform\n";
exit
}
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";

$|=1;
my @tests = qw( start stop start close );
Expand Down

0 comments on commit de1451f

Please sign in to comment.