summaryrefslogtreecommitdiff
path: root/tests/runtests.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-04-19 23:45:15 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-04-20 10:00:30 +0200
commitbcd9813588e971212f139d614a77215f1602e066 (patch)
treeef9a1aba2ee28971f5c818f61c795a4b2ff9c563 /tests/runtests.pl
parentff7a3107ed7f46bca8d1b4f989b1a83cd6e47adf (diff)
downloadgnurl-bcd9813588e971212f139d614a77215f1602e066.tar.gz
gnurl-bcd9813588e971212f139d614a77215f1602e066.tar.bz2
gnurl-bcd9813588e971212f139d614a77215f1602e066.zip
tests: run the SOCKS test server on a dynamic port number
Closes #5266
Diffstat (limited to 'tests/runtests.pl')
-rwxr-xr-xtests/runtests.pl13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 9857076fb..cd22cd3f7 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -2277,7 +2277,6 @@ sub runmqttserver {
sub runsocksserver {
my ($id, $verbose, $ipv6) = @_;
my $ip=$HOSTIP;
- my $port = $SOCKSPORT;
my $proto = 'socks';
my $ipvnum = 4;
my $idnum = ($id && ($id =~ /^(\d+)$/) && ($id > 1)) ? $id : 1;
@@ -2290,6 +2289,7 @@ sub runsocksserver {
$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}) {
@@ -2308,8 +2308,9 @@ sub runsocksserver {
# start our socks server, get commands from the FTP cmd file
my $cmd="server/socksd".exe_ext('SRV').
- " --port $port ".
+ " --port 0 ".
" --pidfile $pidfile".
+ " --portfile $portfile".
" --backend $HOSTIP".
" --config $FTPDCMD";
my ($sockspid, $pid2) = startnew($cmd, $pidfile, 30, 0);
@@ -2322,11 +2323,13 @@ sub runsocksserver {
return (0,0);
}
+ my $port = pidfromfile($portfile);
+
if($verbose) {
logmsg "RUN: $srvrname server is now running PID $pid2\n";
}
- return ($pid2, $sockspid);
+ return ($pid2, $sockspid, $port);
}
#######################################################################
@@ -3159,7 +3162,6 @@ sub checksystem {
logmsg sprintf("RTSP-IPv6/%d ", $RTSP6PORT);
}
logmsg sprintf("\n* SSH/%d ", $SSHPORT);
- logmsg sprintf("SOCKS/%d ", $SOCKSPORT);
if($httptlssrv) {
logmsg sprintf("HTTPTLS/%d ", $HTTPTLSPORT);
if($has_ipv6) {
@@ -4883,7 +4885,7 @@ sub startservers {
}
elsif($what eq "socks4" || $what eq "socks5" ) {
if(!$run{'socks'}) {
- ($pid, $pid2) = runsocksserver("", $verbose);
+ ($pid, $pid2, $SOCKSPORT) = runsocksserver("", $verbose);
if($pid <= 0) {
return "failed starting socks server";
}
@@ -5442,7 +5444,6 @@ $minport = $base; # original base port number
$HTTPSPORT = $base++; # HTTPS (stunnel) server port
$FTPSPORT = $base++; # FTPS (stunnel) server port
$SSHPORT = $base++; # SSH (SCP/SFTP) port
-$SOCKSPORT = $base++; # SOCKS port
$RTSPPORT = $base++; # RTSP server port
$RTSP6PORT = $base++; # RTSP IPv6 server port
$HTTPTLSPORT = $base++; # HTTP TLS (non-stunnel) server port