summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/runtests.pl64
1 files changed, 26 insertions, 38 deletions
diff --git a/tests/runtests.pl b/tests/runtests.pl
index cc70a1011..a1f3bbf80 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -1696,7 +1696,6 @@ sub runhttpsserver {
sub runhttptlsserver {
my ($verbose, $ipv6) = @_;
my $proto = "httptls";
- my $port = ($ipv6 && ($ipv6 =~ /6$/)) ? $HTTPTLS6PORT : $HTTPTLSPORT;
my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP";
my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4;
my $idnum = 1;
@@ -1731,40 +1730,36 @@ sub runhttptlsserver {
$flags .= "--http ";
$flags .= "--debug 1 " if($debugprotocol);
- $flags .= "--port $port ";
$flags .= "--priority NORMAL:+SRP ";
$flags .= "--srppasswd $srcdir/certs/srp-verifier-db ";
$flags .= "--srppasswdconf $srcdir/certs/srp-verifier-conf";
- my $cmd = "$httptlssrv $flags > $logfile 2>&1";
- my ($httptlspid, $pid2) = startnew($cmd, $pidfile, 10, 1); # fake pidfile
+ my $port = 24367;
+ my ($httptlspid, $pid2);
+ for (1 .. 10) {
+ $port += int(rand(800));
+ my $allflags = "--port $port $flags";
- if($httptlspid <= 0 || !pidexists($httptlspid)) {
- # it is NOT alive
- logmsg "RUN: failed to start the $srvrname server\n";
- stopserver($server, "$pid2");
- displaylogs($testnumcheck);
- $doesntrun{$pidfile} = 1;
- return (0,0);
- }
+ my $cmd = "$httptlssrv $allflags > $logfile 2>&1";
+ ($httptlspid, $pid2) = startnew($cmd, $pidfile, 10, 1);
- # Server is up. Verify that we can speak to it. PID is from fake pidfile
- my $pid3 = verifyserver($proto, $ipvnum, $idnum, $ip, $port);
- if(!$pid3) {
- logmsg "RUN: $srvrname server failed verification\n";
- # failed to talk to it properly. Kill the server and return failure
- stopserver($server, "$httptlspid $pid2");
- displaylogs($testnumcheck);
- $doesntrun{$pidfile} = 1;
- return (0,0);
- }
- $pid2 = $pid3;
+ if($httptlspid <= 0 || !pidexists($httptlspid)) {
+ # it is NOT alive
+ logmsg "RUN: failed to start the $srvrname server\n";
+ stopserver($server, "$pid2");
+ displaylogs($testnumcheck);
+ $doesntrun{$pidfile} = 1;
+ $httptlspid = $pid2 = 0;
+ next;
+ }
+ $doesntrun{$pidfile} = 0;
- if($verbose) {
- logmsg "RUN: $srvrname server is now running PID $httptlspid\n";
+ if($verbose) {
+ logmsg "RUN: $srvrname server PID $httptlspid port $port\n";
+ }
+ last;
}
-
- return ($httptlspid, $pid2);
+ return ($httptlspid, $pid2, $port);
}
#######################################################################
@@ -3223,13 +3218,6 @@ sub checksystem {
if($verbose) {
logmsg "* Ports: ";
- if($httptlssrv) {
- logmsg sprintf("HTTPTLS/%d ", $HTTPTLSPORT);
- if($has_ipv6) {
- logmsg sprintf("HTTPTLS-IPv6/%d ", $HTTPTLS6PORT);
- }
- logmsg "\n";
- }
if($has_unix) {
logmsg "* Unix socket paths:\n";
@@ -4843,7 +4831,8 @@ sub startservers {
stopserver('httptls');
}
if(!$run{'httptls'}) {
- ($pid, $pid2) = runhttptlsserver($verbose, "IPv4");
+ ($pid, $pid2, $HTTPTLSPORT) =
+ runhttptlsserver($verbose, "IPv4");
if($pid <= 0) {
return "failed starting HTTPTLS server (gnutls-serv)";
}
@@ -4862,7 +4851,8 @@ sub startservers {
stopserver('httptls-ipv6');
}
if(!$run{'httptls-ipv6'}) {
- ($pid, $pid2) = runhttptlsserver($verbose, "ipv6");
+ ($pid, $pid2, $HTTPTLS6PORT) =
+ runhttptlsserver($verbose, "ipv6");
if($pid <= 0) {
return "failed starting HTTPTLS-IPv6 server (gnutls-serv)";
}
@@ -5476,8 +5466,6 @@ if ($gdbthis) {
}
$minport = $base; # original base port number
-$HTTPTLSPORT = $base++; # HTTP TLS (non-stunnel) server port
-$HTTPTLS6PORT = $base++; # HTTP TLS (non-stunnel) IPv6 server port
$HTTP2PORT = $base++; # HTTP/2 port
$DICTPORT = $base++; # DICT port
$SMBPORT = $base++; # SMB port