diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-04-20 14:53:50 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-04-20 22:48:57 +0200 |
commit | bae87dc0d93d8e56bd1038d4a46477992eaa1bdd (patch) | |
tree | 4c6c57aa114b17a19cdd8d39cb5e06335ce23c61 /tests/runtests.pl | |
parent | 018dd775c868a53c15fdaba7c67aaae6c5fd35c1 (diff) |
tests: run the RTSP test server on a dynamic port number
To avoid port collisions.
Closes #5272
Diffstat (limited to 'tests/runtests.pl')
-rwxr-xr-x | tests/runtests.pl | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/tests/runtests.pl b/tests/runtests.pl index cfc2c8694..1c6a028b9 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -2025,7 +2025,6 @@ sub runtftpserver { # sub runrtspserver { my ($verbose, $ipv6) = @_; - my $port = $RTSPPORT; my $ip = $HOSTIP; my $proto = 'rtsp'; my $ipvnum = 4; @@ -2039,13 +2038,13 @@ sub runrtspserver { if($ipv6) { # if IPv6, use a different setup $ipvnum = 6; - $port = $RTSP6PORT; $ip = $HOST6IP; } $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}) { @@ -2063,9 +2062,11 @@ sub runrtspserver { $logfile = server_logfilename($LOGDIR, $proto, $ipvnum, $idnum); $flags .= "--verbose " if($debugprotocol); - $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" "; + $flags .= "--pidfile \"$pidfile\" ". + "--portfile \"$portfile\" ". + "--logfile \"$logfile\" "; $flags .= "--id $idnum " if($idnum > 1); - $flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\""; + $flags .= "--ipv$ipvnum --port 0 --srcdir \"$srcdir\""; my $cmd = "$perl $srcdir/rtspserver.pl $flags"; my ($rtsppid, $pid2) = startnew($cmd, $pidfile, 15, 0); @@ -2079,6 +2080,8 @@ sub runrtspserver { return (0,0); } + my $port = pidfromfile($portfile); + # Server is up. Verify that we can speak to it. my $pid3 = verifyserver($proto, $ipvnum, $idnum, $ip, $port); if(!$pid3) { @@ -2092,12 +2095,12 @@ sub runrtspserver { $pid2 = $pid3; if($verbose) { - logmsg "RUN: $srvrname server is now running PID $rtsppid\n"; + logmsg "RUN: $srvrname server PID $rtsppid port $port\n"; } sleep(1); - return ($rtsppid, $pid2); + return ($rtsppid, $pid2, $port); } @@ -3154,14 +3157,10 @@ sub checksystem { if($verbose) { logmsg "* Ports: "; - logmsg sprintf("RTSP/%d ", $RTSPPORT); if($stunnel) { logmsg sprintf("FTPS/%d ", $FTPSPORT); logmsg sprintf("HTTPS/%d ", $HTTPSPORT); } - if($http_ipv6) { - logmsg sprintf("RTSP-IPv6/%d ", $RTSP6PORT); - } logmsg sprintf("\n* SSH/%d ", $SSHPORT); if($httptlssrv) { logmsg sprintf("HTTPTLS/%d ", $HTTPTLSPORT); @@ -4718,7 +4717,7 @@ sub startservers { stopserver('rtsp'); } if(!$run{'rtsp'}) { - ($pid, $pid2) = runrtspserver($verbose); + ($pid, $pid2, $RTSPPORT) = runrtspserver($verbose); if($pid <= 0) { return "failed starting RTSP server"; } @@ -4732,7 +4731,7 @@ sub startservers { stopserver('rtsp-ipv6'); } if(!$run{'rtsp-ipv6'}) { - ($pid, $pid2) = runrtspserver($verbose, "ipv6"); + ($pid, $pid2, $RTSP6PORT) = runrtspserver($verbose, "ipv6"); if($pid <= 0) { return "failed starting RTSP-IPv6 server"; } @@ -5446,8 +5445,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 -$RTSPPORT = $base++; # RTSP server port -$RTSP6PORT = $base++; # RTSP IPv6 server port $HTTPTLSPORT = $base++; # HTTP TLS (non-stunnel) server port $HTTPTLS6PORT = $base++; # HTTP TLS (non-stunnel) IPv6 server port $HTTP2PORT = $base++; # HTTP/2 port |