From 80d651541537433e1363f7b4ba7497b08d0fb53f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 16 Apr 2020 17:52:24 +0200 Subject: 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 --- tests/httpserver.pl | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'tests/httpserver.pl') diff --git a/tests/httpserver.pl b/tests/httpserver.pl index 05ec80ac7..58ab5d460 100755 --- a/tests/httpserver.pl +++ b/tests/httpserver.pl @@ -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') { -- cgit v1.2.3