From 58e85d6d1d87382b6c5fbb6053e555323780796f Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Wed, 29 Mar 2023 11:27:53 -0700 Subject: [PATCH] tests: fix remaining servers to run with a dynamic log directory This final commit in the series is sufficient to allow the tests succeed if $LOGDIR is changed in runtests.pl. Ref: #10818 Closes #10866 --- tests/rtspserver.pl | 9 ++++++++- tests/runtests.pl | 17 ++++++++++++++--- tests/secureserver.pl | 8 +++++++- tests/sshserver.pl | 6 ++++++ tests/tftpserver.pl | 9 ++++++++- 5 files changed, 43 insertions(+), 6 deletions(-) diff --git a/tests/rtspserver.pl b/tests/rtspserver.pl index 376d67ea9..a91f0a253 100755 --- a/tests/rtspserver.pl +++ b/tests/rtspserver.pl @@ -73,6 +73,12 @@ while(@ARGV) { shift @ARGV; } } + elsif($ARGV[0] eq '--logdir') { + if($ARGV[1]) { + $logdir = $ARGV[1]; + shift @ARGV; + } + } elsif($ARGV[0] eq '--srcdir') { if($ARGV[1]) { $srcdir = $ARGV[1]; @@ -118,7 +124,8 @@ if(!$logfile) { $flags .= "--pidfile \"$pidfile\" ". "--portfile \"$portfile\" ". - "--logfile \"$logfile\" "; + "--logfile \"$logfile\" ". + "--logdir \"$logdir\" "; $flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\""; $| = 1; diff --git a/tests/runtests.pl b/tests/runtests.pl index f0ac9e04b..a727385a5 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -1735,6 +1735,7 @@ sub runhttpsserver { $flags .= "--verbose " if($debugprotocol); $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" "; + $flags .= "--logdir \"$LOGDIR\" "; $flags .= "--id $idnum " if($idnum > 1); $flags .= "--ipv$ipvnum --proto $proto "; $flags .= "--certfile \"$certfile\" " if($certfile ne 'stunnel.pem'); @@ -1979,6 +1980,7 @@ sub runsecureserver { $flags .= "--verbose " if($debugprotocol); $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" "; + $flags .= "--logdir \"$LOGDIR\" "; $flags .= "--id $idnum " if($idnum > 1); $flags .= "--ipv$ipvnum --proto $proto "; $flags .= "--certfile \"$certfile\" " if($certfile ne 'stunnel.pem'); @@ -2063,7 +2065,8 @@ sub runtftpserver { $flags .= "--verbose " if($debugprotocol); $flags .= "--pidfile \"$pidfile\" ". "--portfile \"$portfile\" ". - "--logfile \"$logfile\" "; + "--logfile \"$logfile\" ". + "--logdir \"$LOGDIR\" "; $flags .= "--id $idnum " if($idnum > 1); $flags .= "--ipv$ipvnum --port 0 --srcdir \"$srcdir\""; @@ -2145,7 +2148,8 @@ sub runrtspserver { $flags .= "--verbose " if($debugprotocol); $flags .= "--pidfile \"$pidfile\" ". "--portfile \"$portfile\" ". - "--logfile \"$logfile\" "; + "--logfile \"$logfile\" ". + "--logdir \"$LOGDIR\" "; $flags .= "--id $idnum " if($idnum > 1); $flags .= "--ipv$ipvnum --port 0 --srcdir \"$srcdir\""; @@ -2231,6 +2235,7 @@ sub runsshserver { $flags .= "--verbose " if($verb); $flags .= "--debugprotocol " if($debugprotocol); $flags .= "--pidfile \"$pidfile\" "; + $flags .= "--logdir \"$LOGDIR\" "; $flags .= "--id $idnum " if($idnum > 1); $flags .= "--ipv$ipvnum --addr \"$ip\" "; $flags .= "--user \"$USER\""; @@ -2368,7 +2373,9 @@ sub runmqttserver { " --port 0 ". " --pidfile $pidfile". " --portfile $portfile". - " --config $FTPDCMD"; + " --config $FTPDCMD". + " --logfile $logfile". + " --logdir $LOGDIR"; my ($sockspid, $pid2) = startnew($cmd, $pidfile, 30, 0); if($sockspid <= 0 || !pidexists($sockspid)) { @@ -2429,6 +2436,8 @@ sub runsocksserver { if($is_unix) { $cmd="server/socksd".exe_ext('SRV'). " --pidfile $pidfile". + " --reqfile $SOCKSIN". + " --logfile $logfile". " --unix-socket $SOCKSUNIXPATH". " --backend $HOSTIP". " --config $FTPDCMD"; @@ -2437,6 +2446,8 @@ sub runsocksserver { " --port 0 ". " --pidfile $pidfile". " --portfile $portfile". + " --reqfile $SOCKSIN". + " --logfile $logfile". " --backend $HOSTIP". " --config $FTPDCMD"; } diff --git a/tests/secureserver.pl b/tests/secureserver.pl index ec858e18f..e8c604545 100755 --- a/tests/secureserver.pl +++ b/tests/secureserver.pl @@ -167,6 +167,12 @@ while(@ARGV) { shift @ARGV; } } + elsif($ARGV[0] eq '--logdir') { + if($ARGV[1]) { + $logdir = "$path/". $ARGV[1]; + shift @ARGV; + } + } else { print STDERR "\nWarning: secureserver.pl unknown parameter: $ARGV[0]\n"; } @@ -183,7 +189,7 @@ if(!$logfile) { $logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum); } -$conffile = "$path/${proto}_stunnel.conf"; +$conffile = "$logdir/${proto}_stunnel.conf"; $capath = abs_path($path); $certfile = "$srcdir/". ($stuncert?"certs/$stuncert":"stunnel.pem"); diff --git a/tests/sshserver.pl b/tests/sshserver.pl index aaf503972..ab15d9f7e 100755 --- a/tests/sshserver.pl +++ b/tests/sshserver.pl @@ -157,6 +157,12 @@ while(@ARGV) { shift @ARGV; } } + elsif($ARGV[0] eq '--logdir') { + if($ARGV[1]) { + $logdir = "$path/". $ARGV[1]; + shift @ARGV; + } + } elsif($ARGV[0] eq '--sshport') { if($ARGV[1]) { if($ARGV[1] =~ /^(\d+)$/) { diff --git a/tests/tftpserver.pl b/tests/tftpserver.pl index 23750b2dd..1143b9b42 100755 --- a/tests/tftpserver.pl +++ b/tests/tftpserver.pl @@ -74,6 +74,12 @@ while(@ARGV) { shift @ARGV; } } + elsif($ARGV[0] eq '--logdir') { + if($ARGV[1]) { + $logdir = $ARGV[1]; + shift @ARGV; + } + } elsif($ARGV[0] eq '--srcdir') { if($ARGV[1]) { $srcdir = $ARGV[1]; @@ -119,7 +125,8 @@ if(!$logfile) { $flags .= "--pidfile \"$pidfile\" ". "--portfile \"$portfile\" ". - "--logfile \"$logfile\" "; + "--logfile \"$logfile\" ". + "--logdir \"$logdir\" "; $flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\""; $| = 1;