summaryrefslogtreecommitdiff
path: root/tests/tftpserver.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-04-19 23:29:21 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-04-20 09:13:20 +0200
commit369ce38ac1dacd16a87f91694a05c5c143e18d80 (patch)
tree508f3f0a946209c8200d3358f7eddb60353ec4fb /tests/tftpserver.pl
parent5811beba391baefad41cd6f8f4fa4e3862098813 (diff)
downloadcurl-369ce38ac1dacd16a87f91694a05c5c143e18d80.tar.gz
tests: run the TFTP test server on a dynamic port number
Picking a dynamic unused port is better than a fixed to avoid the collision risk. Closes #5265
Diffstat (limited to 'tests/tftpserver.pl')
-rwxr-xr-xtests/tftpserver.pl15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/tftpserver.pl b/tests/tftpserver.pl
index 523498634..a7b9b39df 100755
--- a/tests/tftpserver.pl
+++ b/tests/tftpserver.pl
@@ -43,8 +43,9 @@ my $port = 8997; # just a default
my $ipvnum = 4; # default IP version of tftp server
my $idnum = 1; # default tftp server instance number
my $proto = 'tftp'; # protocol the tftp server speaks
-my $pidfile; # tftp server pid file
-my $logfile; # tftp server log file
+my $pidfile;
+my $portfile;
+my $logfile;
my $srcdir;
my $fork;
@@ -59,6 +60,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];
@@ -108,7 +115,9 @@ if(!$logfile) {
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
}
-$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
+$flags .= "--pidfile \"$pidfile\" ".
+ "--portfile \"$portfile\" ".
+ "--logfile \"$logfile\" ";
$flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\"";
exec("server/tftpd".exe_ext('SRV')." $flags");