]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: fix http servers to run with a dynamic log directory
authorDan Fandrich <dan@coneharvesters.com>
Wed, 29 Mar 2023 15:54:57 +0000 (08:54 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Thu, 30 Mar 2023 16:53:57 +0000 (09:53 -0700)
Ref: #10818

tests/http-server.pl
tests/http2-server.pl
tests/http3-server.pl
tests/runtests.pl

index d4978854bf030c2dd2f4ee16bc0632270eb616e0..cd7401e9ca3962273dc2549b41002a792474d80f 100755 (executable)
@@ -49,6 +49,7 @@ my $proto = 'http';  # protocol the http server speaks
 my $pidfile;         # pid file
 my $portfile;        # port number file
 my $logfile;         # log file
+my $cmdfile;         # command file
 my $connect;         # IP to connect to on CONNECT
 my $srcdir;
 my $gopher = 0;
@@ -70,12 +71,24 @@ while(@ARGV) {
             shift @ARGV;
         }
     }
+    elsif($ARGV[0] eq '--config') {
+        if($ARGV[1]) {
+            $cmdfile = $ARGV[1];
+            shift @ARGV;
+        }
+    }
     elsif($ARGV[0] eq '--logfile') {
         if($ARGV[1]) {
             $logfile = $ARGV[1];
             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];
@@ -139,7 +152,9 @@ if(!$logfile) {
 }
 
 $flags .= "--pidfile \"$pidfile\" ".
+    "--cmdfile \"$cmdfile\" ".
     "--logfile \"$logfile\" ".
+    "--logdir \"$logdir\" ".
     "--portfile \"$portfile\" ";
 $flags .= "--gopher " if($gopher);
 $flags .= "--connect $connect " if($connect);
index bbfaf47754ce51882013c7e1c3d2421f1ebcc39c..52c5284c0c7beee9e4cc8a7633ae0f456a8399f3 100755 (executable)
@@ -29,8 +29,9 @@ use Cwd;
 use Cwd 'abs_path';
 use File::Basename;
 
-my $pidfile = "log/nghttpx.pid";
-my $logfile = "log/http2.log";
+my $logdir = "log";
+my $pidfile = "$logdir/nghttpx.pid";
+my $logfile = "$logdir/http2.log";
 my $nghttpx = "nghttpx";
 my $listenport = 9015;
 my $listenport2 = 9016;
@@ -82,6 +83,12 @@ while(@ARGV) {
             shift @ARGV;
         }
     }
+    elsif($ARGV[0] eq '--logdir') {
+        if($ARGV[1]) {
+            $logdir = $ARGV[1];
+            shift @ARGV;
+        }
+    }
     elsif($ARGV[0] eq '--conf') {
         if($ARGV[1]) {
             $conf = $ARGV[1];
index 0c562fba3b282197953260d33829f1ac7d3c1c8d..7e5f243454b4cbf12f56101f531a79384468f537 100755 (executable)
@@ -30,8 +30,9 @@ use Cwd;
 use Cwd 'abs_path';
 use File::Basename;
 
-my $pidfile = "log/nghttpx.pid";
-my $logfile = "log/http3.log";
+my $logdir = "log";
+my $pidfile = "$logdir/nghttpx.pid";
+my $logfile = "$logdir/http3.log";
 my $nghttpx = "nghttpx";
 my $listenport = 9015;
 my $connect = "127.0.0.1,8990";
@@ -82,6 +83,12 @@ while(@ARGV) {
             shift @ARGV;
         }
     }
+    elsif($ARGV[0] eq '--logdir') {
+        if($ARGV[1]) {
+            $logdir = $ARGV[1];
+            shift @ARGV;
+        }
+    }
     elsif($ARGV[0] eq '--conf') {
         if($ARGV[1]) {
             $conf = $ARGV[1];
index 06c934c74bb130039bcc7bac47d3ffdacb135b33..f0ac9e04b51a24d1a6f49a8eb77386889fe746b3 100755 (executable)
@@ -1479,6 +1479,7 @@ sub runhttp2server {
 
     $flags .= "--nghttpx \"$ENV{'NGHTTPX'}\" ";
     $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
+    $flags .= "--logdir \"$LOGDIR\" ";
     $flags .= "--connect $HOSTIP:" . protoport("http") . " ";
     $flags .= $verbose_flag if($debugprotocol);
 
@@ -1552,6 +1553,7 @@ sub runhttp3server {
 
     $flags .= "--nghttpx \"$ENV{'NGHTTPX'}\" ";
     $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
+    $flags .= "--logdir \"$LOGDIR\" ";
     $flags .= "--connect $HOSTIP:" . protoport("http") . " ";
     $flags .= "--cert \"$cert\" " if($cert);
     $flags .= $verbose_flag if($debugprotocol);
@@ -1639,7 +1641,9 @@ sub runhttpserver {
     $flags .= "--connect $HOSTIP " if($alt eq "proxy");
     $flags .= $verbose_flag if($debugprotocol);
     $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
+    $flags .= "--logdir \"$LOGDIR\" ";
     $flags .= "--portfile $portfile ";
+    $flags .= "--config $FTPDCMD ";
     $flags .= "--id $idnum " if($idnum > 1);
     if($ipvnum eq "unix") {
         $flags .= "--unix-socket '$port_or_path' ";