Check for test server name resolution in tests

* tests/Test-https-*.px: Skip if test server name resolution fails
This commit is contained in:
Tim Rühsen 2017-05-09 11:06:44 +02:00
parent f68d001626
commit 466afc62b0
8 changed files with 81 additions and 12 deletions

View File

@ -3,7 +3,8 @@
use strict;
use warnings;
use POSIX;
use Socket;
use WgetFeature qw(https ssl/openssl);
use SSLTest;
###############################################################################
@ -33,6 +34,14 @@ my $cdir = $ENV{'PWD'};
my $testhostname = "WgetTestingServer";
$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts";
my $addr = gethostbyname($testhostname) or
exit 77;
unless (inet_ntoa($addr) =~ "127.0.0.1")
{
warn "Failed to resolve $testhostname";
exit 77;
}
# Create certindex
open CERTID, ">", "$cdir/certs/certindex" or
warn "Cannot overwrite file $cdir/certs/certindex";

View File

@ -2,7 +2,8 @@
use strict;
use warnings;
use Socket;
use WgetFeature qw(https);
use SSLTest;
###############################################################################
@ -32,6 +33,14 @@ my $cdir = $ENV{'PWD'};
my $testhostname = "WgetTestingServer";
$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts";
my $addr = gethostbyname($testhostname) or
exit 77;
unless (inet_ntoa($addr) =~ "127.0.0.1")
{
warn "Failed to resolve $testhostname";
exit 77;
}
# Create certindex
open CERTID, ">", "$cdir/certs/certindex" or
warn "Cannot overwrite file $cdir/certs/certindex";

View File

@ -2,7 +2,8 @@
use strict;
use warnings;
use Socket;
use WgetFeature qw(https);
use SSLTest;
###############################################################################
@ -30,11 +31,15 @@ my $cdir = $ENV{'PWD'};
# HOSTALIASES env variable allows us to create hosts file alias.
my $testhostname = "WgetTestingServer";
my $testhostfile = "$cdir/wgethosts";
open(my $fh, '>', $testhostfile);
print $fh "$testhostname 127.0.0.1\n";
close $fh;
$ENV{'HOSTALIASES'} = "$cdir/wgethosts";
$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts";
my $addr = gethostbyname($testhostname) or
exit 77;
unless (inet_ntoa($addr) =~ "127.0.0.1")
{
warn "Failed to resolve $testhostname";
exit 77;
}
# Create certindex
open CERTID, ">", "$cdir/certs/certindex" or

View File

@ -2,6 +2,8 @@
use strict;
use warnings;
use Socket;
use WgetFeature qw(https);
use SSLTest;
###############################################################################
@ -30,6 +32,14 @@ my $cdir = $ENV{'PWD'};
my $testhostname = "WgetTestingServer";
$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts";
my $addr = gethostbyname($testhostname) or
exit 77;
unless (inet_ntoa($addr) =~ "127.0.0.1")
{
warn "Failed to resolve $testhostname";
exit 77;
}
my $port = 24443;
my $cmdline = $WgetTest::WGETPATH . " --secure-protocol=PFS".
" --ca-certificate=$cdir/certs/test-ca-cert.pem".

View File

@ -2,7 +2,8 @@
use strict;
use warnings;
use Socket;
use WgetFeature qw(https);
use SSLTest;
###############################################################################
@ -32,6 +33,14 @@ my $cdir = $ENV{'PWD'};
my $testhostname = "WgetTestingServer";
$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts";
my $addr = gethostbyname($testhostname) or
exit 77;
unless (inet_ntoa($addr) =~ "127.0.0.1")
{
warn "Failed to resolve $testhostname";
exit 77;
}
# Prepare self-signed certificates
my $certfile="tmpsscert.pem";
my $keyfile="tmpsskey.pem";

View File

@ -2,7 +2,8 @@
use strict;
use warnings;
use Socket;
use WgetFeature qw(https);
use SSLTest;
###############################################################################
@ -31,6 +32,14 @@ my $cdir = $ENV{'PWD'};
my $testhostname = "WgetTestingServer";
$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts";
my $addr = gethostbyname($testhostname) or
exit 77;
unless (inet_ntoa($addr) =~ "127.0.0.1")
{
warn "Failed to resolve $testhostname";
exit 77;
}
my $port = 28443;
my $cmdline = $WgetTest::WGETPATH . " --secure-protocol=TLSv1".
" --ca-certificate=$cdir/certs/test-ca-cert.pem".

View File

@ -2,7 +2,8 @@
use strict;
use warnings;
use Socket;
use WgetFeature qw(https);
use SSLTest;
###############################################################################
@ -31,6 +32,14 @@ my $cdir = $ENV{'PWD'};
my $testhostname = "WgetTestingServer";
$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts";
my $addr = gethostbyname($testhostname) or
exit 77;
unless (inet_ntoa($addr) =~ "127.0.0.1")
{
warn "Failed to resolve $testhostname";
exit 77;
}
my $port = 29443;
my $cmdline = $WgetTest::WGETPATH . " --secure-protocol=TLSv1_1".
" --ca-certificate=$cdir/certs/test-ca-cert.pem".

View File

@ -2,7 +2,8 @@
use strict;
use warnings;
use Socket;
use WgetFeature qw(https);
use SSLTest;
###############################################################################
@ -32,6 +33,14 @@ my $cdir = $ENV{'PWD'};
my $testhostname = "WgetTestingServer";
$ENV{'HOSTALIASES'} = "$cdir/certs/wgethosts";
my $addr = gethostbyname($testhostname) or
exit 77;
unless (inet_ntoa($addr) =~ "127.0.0.1")
{
warn "Failed to resolve $testhostname";
exit 77;
}
# Create certindex
open CERTID, ">", "$cdir/certs/certindex" or
warn "Cannot overwrite file $cdir/certs/certindex";