aboutsummaryrefslogtreecommitdiff
path: root/tests/runtests.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-04-16 17:52:24 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-04-18 22:45:28 +0200
commit80d651541537433e1363f7b4ba7497b08d0fb53f (patch)
treed8cfbaeccb174df77ea16bd9020b79bd180268b1 /tests/runtests.pl
parente917492048f4b85a0fd58a033d10072fc7666c3b (diff)
tests: run the sws server on "any port"
Makes the test servers for HTTP and Gopher pop up on a currently unused port and runtests adapts to that! Closes #5247
Diffstat (limited to 'tests/runtests.pl')
-rwxr-xr-xtests/runtests.pl46
1 files changed, 25 insertions, 21 deletions
diff --git a/tests/runtests.pl b/tests/runtests.pl
index c44b03fb5..549db529f 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -1498,6 +1498,7 @@ sub runhttpserver {
$server = servername_id($proto, $ipvnum, $idnum);
$pidfile = $serverpidfile{$server};
+ my $portfile = $serverportfile{$server};
# don't retry if the server doesn't work
if ($doesntrun{$pidfile}) {
@@ -1518,11 +1519,12 @@ sub runhttpserver {
$flags .= "--connect $HOSTIP " if($alt eq "proxy");
$flags .= $verbose_flag if($debugprotocol);
$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
+ $flags .= "--portfile $portfile ";
$flags .= "--id $idnum " if($idnum > 1);
if($ipvnum eq "unix") {
$flags .= "--unix-socket '$port_or_path' ";
} else {
- $flags .= "--ipv$ipvnum --port $port_or_path ";
+ $flags .= "--ipv$ipvnum --port 0 ";
}
$flags .= "--srcdir \"$srcdir\"";
@@ -1538,6 +1540,12 @@ sub runhttpserver {
return (0,0);
}
+ # where is it?
+ my $port;
+ if(!$port_or_path) {
+ $port = $port_or_path = pidfromfile($portfile);
+ }
+
# Server is up. Verify that we can speak to it.
my $pid3 = verifyserver($proto, $ipvnum, $idnum, $ip, $port_or_path);
if(!$pid3) {
@@ -1556,7 +1564,7 @@ sub runhttpserver {
sleep(1);
- return ($httppid, $pid2);
+ return ($httppid, $pid2, $port);
}
#######################################################################
@@ -4611,8 +4619,8 @@ sub startservers {
stopserver('gopher');
}
if(!$run{'gopher'}) {
- ($pid, $pid2) = runhttpserver("gopher", $verbose, 0,
- $GOPHERPORT);
+ ($pid, $pid2, $GOPHERPORT) =
+ runhttpserver("gopher", $verbose, 0);
if($pid <= 0) {
return "failed starting GOPHER server";
}
@@ -4628,8 +4636,8 @@ sub startservers {
stopserver('gopher-ipv6');
}
if(!$run{'gopher-ipv6'}) {
- ($pid, $pid2) = runhttpserver("gopher", $verbose, "ipv6",
- $GOPHER6PORT);
+ ($pid, $pid2, $GOPHER6PORT) =
+ runhttpserver("gopher", $verbose, "ipv6");
if($pid <= 0) {
return "failed starting GOPHER-IPv6 server";
}
@@ -4655,8 +4663,8 @@ sub startservers {
stopserver('http');
}
if(!$run{'http'}) {
- ($pid, $pid2) = runhttpserver("http", $verbose, 0,
- $HTTPPORT);
+ ($pid, $pid2, $HTTPPORT) =
+ runhttpserver("http", $verbose, 0);
if($pid <= 0) {
return "failed starting HTTP server";
}
@@ -4672,8 +4680,8 @@ sub startservers {
stopserver('http-proxy');
}
if(!$run{'http-proxy'}) {
- ($pid, $pid2) = runhttpserver("http", $verbose, "proxy",
- $HTTPPROXYPORT);
+ ($pid, $pid2, $HTTPPROXYPORT) =
+ runhttpserver("http", $verbose, "proxy");
if($pid <= 0) {
return "failed starting HTTP-proxy server";
}
@@ -4688,8 +4696,8 @@ sub startservers {
stopserver('http-ipv6');
}
if(!$run{'http-ipv6'}) {
- ($pid, $pid2) = runhttpserver("http", $verbose, "ipv6",
- $HTTP6PORT);
+ ($pid, $pid2, $HTTP6PORT) =
+ runhttpserver("http", $verbose, "ipv6");
if($pid <= 0) {
return "failed starting HTTP-IPv6 server";
}
@@ -4775,8 +4783,8 @@ sub startservers {
stopserver('http');
}
if(!$run{'http'}) {
- ($pid, $pid2) = runhttpserver("http", $verbose, 0,
- $HTTPPORT);
+ ($pid, $pid2, $HTTPPORT) =
+ runhttpserver("http", $verbose, 0);
if($pid <= 0) {
return "failed starting HTTP server";
}
@@ -4895,8 +4903,9 @@ sub startservers {
stopserver('http-unix');
}
if(!$run{'http-unix'}) {
- ($pid, $pid2) = runhttpserver("http", $verbose, "unix",
- $HTTPUNIXPATH);
+ my $unused;
+ ($pid, $pid2, $unused) =
+ runhttpserver("http", $verbose, "unix", $HTTPUNIXPATH);
if($pid <= 0) {
return "failed starting HTTP-unix server";
}
@@ -5427,11 +5436,9 @@ if ($gdbthis) {
$minport = $base; # original base port number
-$HTTPPORT = $base++; # HTTP server port
$HTTPSPORT = $base++; # HTTPS (stunnel) server port
$FTPPORT = $base++; # FTP server port
$FTPSPORT = $base++; # FTPS (stunnel) server port
-$HTTP6PORT = $base++; # HTTP IPv6 server port
$FTP2PORT = $base++; # FTP server 2 port
$FTP6PORT = $base++; # FTP IPv6 port
$TFTPPORT = $base++; # TFTP (UDP) port
@@ -5446,11 +5453,8 @@ $SMTPPORT = $base++; # SMTP server port
$SMTP6PORT = $base++; # SMTP IPv6 server port
$RTSPPORT = $base++; # RTSP server port
$RTSP6PORT = $base++; # RTSP IPv6 server port
-$GOPHERPORT = $base++; # Gopher IPv4 server port
-$GOPHER6PORT = $base++; # Gopher IPv6 server port
$HTTPTLSPORT = $base++; # HTTP TLS (non-stunnel) server port
$HTTPTLS6PORT = $base++; # HTTP TLS (non-stunnel) IPv6 server port
-$HTTPPROXYPORT = $base++; # HTTP proxy port, when using CONNECT
$HTTP2PORT = $base++; # HTTP/2 port
$DICTPORT = $base++; # DICT port
$SMBPORT = $base++; # SMB port