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
diff --git a/tests/rtspserver.pl b/tests/rtspserver.pl
index 376d67e..a91f0a2 100755
--- a/tests/rtspserver.pl
+++ b/tests/rtspserver.pl
@@ -73,6 +73,12 @@
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 @@
$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 f0ac9e0..a727385 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -1735,6 +1735,7 @@
$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 @@
$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 @@
$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 @@
$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 @@
$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 @@
" --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 @@
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 @@
" --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 ec858e1..e8c6045 100755
--- a/tests/secureserver.pl
+++ b/tests/secureserver.pl
@@ -167,6 +167,12 @@
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 @@
$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 aaf5039..ab15d9f 100755
--- a/tests/sshserver.pl
+++ b/tests/sshserver.pl
@@ -157,6 +157,12 @@
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 23750b2..1143b9b 100755
--- a/tests/tftpserver.pl
+++ b/tests/tftpserver.pl
@@ -74,6 +74,12 @@
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 @@
$flags .= "--pidfile \"$pidfile\" ".
"--portfile \"$portfile\" ".
- "--logfile \"$logfile\" ";
+ "--logfile \"$logfile\" ".
+ "--logdir \"$logdir\" ";
$flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\"";
$| = 1;