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
This commit is contained in:
Dan Fandrich 2023-03-29 11:27:53 -07:00
parent 0bdb95ecbf
commit 58e85d6d1d
5 changed files with 43 additions and 6 deletions

View File

@ -73,6 +73,12 @@ while(@ARGV) {
shift @ARGV; shift @ARGV;
} }
} }
elsif($ARGV[0] eq '--logdir') {
if($ARGV[1]) {
$logdir = $ARGV[1];
shift @ARGV;
}
}
elsif($ARGV[0] eq '--srcdir') { elsif($ARGV[0] eq '--srcdir') {
if($ARGV[1]) { if($ARGV[1]) {
$srcdir = $ARGV[1]; $srcdir = $ARGV[1];
@ -118,7 +124,8 @@ if(!$logfile) {
$flags .= "--pidfile \"$pidfile\" ". $flags .= "--pidfile \"$pidfile\" ".
"--portfile \"$portfile\" ". "--portfile \"$portfile\" ".
"--logfile \"$logfile\" "; "--logfile \"$logfile\" ".
"--logdir \"$logdir\" ";
$flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\""; $flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\"";
$| = 1; $| = 1;

View File

@ -1735,6 +1735,7 @@ sub runhttpsserver {
$flags .= "--verbose " if($debugprotocol); $flags .= "--verbose " if($debugprotocol);
$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" "; $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
$flags .= "--logdir \"$LOGDIR\" ";
$flags .= "--id $idnum " if($idnum > 1); $flags .= "--id $idnum " if($idnum > 1);
$flags .= "--ipv$ipvnum --proto $proto "; $flags .= "--ipv$ipvnum --proto $proto ";
$flags .= "--certfile \"$certfile\" " if($certfile ne 'stunnel.pem'); $flags .= "--certfile \"$certfile\" " if($certfile ne 'stunnel.pem');
@ -1979,6 +1980,7 @@ sub runsecureserver {
$flags .= "--verbose " if($debugprotocol); $flags .= "--verbose " if($debugprotocol);
$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" "; $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
$flags .= "--logdir \"$LOGDIR\" ";
$flags .= "--id $idnum " if($idnum > 1); $flags .= "--id $idnum " if($idnum > 1);
$flags .= "--ipv$ipvnum --proto $proto "; $flags .= "--ipv$ipvnum --proto $proto ";
$flags .= "--certfile \"$certfile\" " if($certfile ne 'stunnel.pem'); $flags .= "--certfile \"$certfile\" " if($certfile ne 'stunnel.pem');
@ -2063,7 +2065,8 @@ sub runtftpserver {
$flags .= "--verbose " if($debugprotocol); $flags .= "--verbose " if($debugprotocol);
$flags .= "--pidfile \"$pidfile\" ". $flags .= "--pidfile \"$pidfile\" ".
"--portfile \"$portfile\" ". "--portfile \"$portfile\" ".
"--logfile \"$logfile\" "; "--logfile \"$logfile\" ".
"--logdir \"$LOGDIR\" ";
$flags .= "--id $idnum " if($idnum > 1); $flags .= "--id $idnum " if($idnum > 1);
$flags .= "--ipv$ipvnum --port 0 --srcdir \"$srcdir\""; $flags .= "--ipv$ipvnum --port 0 --srcdir \"$srcdir\"";
@ -2145,7 +2148,8 @@ sub runrtspserver {
$flags .= "--verbose " if($debugprotocol); $flags .= "--verbose " if($debugprotocol);
$flags .= "--pidfile \"$pidfile\" ". $flags .= "--pidfile \"$pidfile\" ".
"--portfile \"$portfile\" ". "--portfile \"$portfile\" ".
"--logfile \"$logfile\" "; "--logfile \"$logfile\" ".
"--logdir \"$LOGDIR\" ";
$flags .= "--id $idnum " if($idnum > 1); $flags .= "--id $idnum " if($idnum > 1);
$flags .= "--ipv$ipvnum --port 0 --srcdir \"$srcdir\""; $flags .= "--ipv$ipvnum --port 0 --srcdir \"$srcdir\"";
@ -2231,6 +2235,7 @@ sub runsshserver {
$flags .= "--verbose " if($verb); $flags .= "--verbose " if($verb);
$flags .= "--debugprotocol " if($debugprotocol); $flags .= "--debugprotocol " if($debugprotocol);
$flags .= "--pidfile \"$pidfile\" "; $flags .= "--pidfile \"$pidfile\" ";
$flags .= "--logdir \"$LOGDIR\" ";
$flags .= "--id $idnum " if($idnum > 1); $flags .= "--id $idnum " if($idnum > 1);
$flags .= "--ipv$ipvnum --addr \"$ip\" "; $flags .= "--ipv$ipvnum --addr \"$ip\" ";
$flags .= "--user \"$USER\""; $flags .= "--user \"$USER\"";
@ -2368,7 +2373,9 @@ sub runmqttserver {
" --port 0 ". " --port 0 ".
" --pidfile $pidfile". " --pidfile $pidfile".
" --portfile $portfile". " --portfile $portfile".
" --config $FTPDCMD"; " --config $FTPDCMD".
" --logfile $logfile".
" --logdir $LOGDIR";
my ($sockspid, $pid2) = startnew($cmd, $pidfile, 30, 0); my ($sockspid, $pid2) = startnew($cmd, $pidfile, 30, 0);
if($sockspid <= 0 || !pidexists($sockspid)) { if($sockspid <= 0 || !pidexists($sockspid)) {
@ -2429,6 +2436,8 @@ sub runsocksserver {
if($is_unix) { if($is_unix) {
$cmd="server/socksd".exe_ext('SRV'). $cmd="server/socksd".exe_ext('SRV').
" --pidfile $pidfile". " --pidfile $pidfile".
" --reqfile $SOCKSIN".
" --logfile $logfile".
" --unix-socket $SOCKSUNIXPATH". " --unix-socket $SOCKSUNIXPATH".
" --backend $HOSTIP". " --backend $HOSTIP".
" --config $FTPDCMD"; " --config $FTPDCMD";
@ -2437,6 +2446,8 @@ sub runsocksserver {
" --port 0 ". " --port 0 ".
" --pidfile $pidfile". " --pidfile $pidfile".
" --portfile $portfile". " --portfile $portfile".
" --reqfile $SOCKSIN".
" --logfile $logfile".
" --backend $HOSTIP". " --backend $HOSTIP".
" --config $FTPDCMD"; " --config $FTPDCMD";
} }

View File

@ -167,6 +167,12 @@ while(@ARGV) {
shift @ARGV; shift @ARGV;
} }
} }
elsif($ARGV[0] eq '--logdir') {
if($ARGV[1]) {
$logdir = "$path/". $ARGV[1];
shift @ARGV;
}
}
else { else {
print STDERR "\nWarning: secureserver.pl unknown parameter: $ARGV[0]\n"; print STDERR "\nWarning: secureserver.pl unknown parameter: $ARGV[0]\n";
} }
@ -183,7 +189,7 @@ if(!$logfile) {
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum); $logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
} }
$conffile = "$path/${proto}_stunnel.conf"; $conffile = "$logdir/${proto}_stunnel.conf";
$capath = abs_path($path); $capath = abs_path($path);
$certfile = "$srcdir/". ($stuncert?"certs/$stuncert":"stunnel.pem"); $certfile = "$srcdir/". ($stuncert?"certs/$stuncert":"stunnel.pem");

View File

@ -157,6 +157,12 @@ while(@ARGV) {
shift @ARGV; shift @ARGV;
} }
} }
elsif($ARGV[0] eq '--logdir') {
if($ARGV[1]) {
$logdir = "$path/". $ARGV[1];
shift @ARGV;
}
}
elsif($ARGV[0] eq '--sshport') { elsif($ARGV[0] eq '--sshport') {
if($ARGV[1]) { if($ARGV[1]) {
if($ARGV[1] =~ /^(\d+)$/) { if($ARGV[1] =~ /^(\d+)$/) {

View File

@ -74,6 +74,12 @@ while(@ARGV) {
shift @ARGV; shift @ARGV;
} }
} }
elsif($ARGV[0] eq '--logdir') {
if($ARGV[1]) {
$logdir = $ARGV[1];
shift @ARGV;
}
}
elsif($ARGV[0] eq '--srcdir') { elsif($ARGV[0] eq '--srcdir') {
if($ARGV[1]) { if($ARGV[1]) {
$srcdir = $ARGV[1]; $srcdir = $ARGV[1];
@ -119,7 +125,8 @@ if(!$logfile) {
$flags .= "--pidfile \"$pidfile\" ". $flags .= "--pidfile \"$pidfile\" ".
"--portfile \"$portfile\" ". "--portfile \"$portfile\" ".
"--logfile \"$logfile\" "; "--logfile \"$logfile\" ".
"--logdir \"$logdir\" ";
$flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\""; $flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\"";
$| = 1; $| = 1;