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-19 23:29:21 +0200
commit2b1067453eeadfddd4ff1d0a34dd770f7cb7810c (patch)
tree683abdb6d030116b219684f8d8033c26fb24bc23 /tests/tftpserver.pl
parent207a6cbb909ba6df01ba5ed8f73acc733128bdf1 (diff)
downloadcurl-2b1067453eeadfddd4ff1d0a34dd770f7cb7810c.tar.gz
tests: run the TFTP server on a dynamic portbagder/tftp-tests-dynamic-port
Picking an unused one is better than a fixed to avoid collision risk.
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");