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
This commit is contained in:
Daniel Stenberg 2020-04-16 17:52:24 +02:00
parent e917492048
commit 80d6515415
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 101 additions and 29 deletions

View file

@ -44,8 +44,9 @@ my $unix_socket; # location to place a listening Unix socket
my $ipvnum = 4; # default IP version of http server
my $idnum = 1; # default http server instance number
my $proto = 'http'; # protocol the http server speaks
my $pidfile; # http server pid file
my $logfile; # http server log file
my $pidfile; # pid file
my $portfile; # port number file
my $logfile; # log file
my $connect; # IP to connect to on CONNECT
my $srcdir;
my $gopher = 0;
@ -61,6 +62,12 @@ while(@ARGV) {
shift @ARGV;
}
}
elsif($ARGV[0] eq '--portfile') {
if($ARGV[1]) {
$portfile = $ARGV[1];
shift @ARGV;
}
}
elsif($ARGV[0] eq '--logfile') {
if($ARGV[1]) {
$logfile = $ARGV[1];
@ -122,11 +129,16 @@ if(!$srcdir) {
if(!$pidfile) {
$pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum);
}
if(!$portfile) {
$portfile = "$path/". server_portfilename($proto, $ipvnum, $idnum);
}
if(!$logfile) {
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
}
$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
$flags .= "--pidfile \"$pidfile\" ".
"--logfile \"$logfile\" ".
"--portfile \"$portfile\" ";
$flags .= "--gopher " if($gopher);
$flags .= "--connect $connect " if($connect);
if($ipvnum eq 'unix') {