]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
runtests: create runner functions for clearlocks and stopservers
authorDan Fandrich <dan@coneharvesters.com>
Fri, 21 Apr 2023 22:00:00 +0000 (15:00 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Mon, 24 Apr 2023 23:04:24 +0000 (16:04 -0700)
runtests.pl now uses runner for all server actions beyond the initial
variable configuration.

Ref: #10818

tests/runner.pm
tests/runtests.pl
tests/servers.pm

index 69fe323c84143d9b55de68c0cfc3c0c0f12b0805..22f88ae7c27ab062dd7e904d758a245c7a0734b2 100644 (file)
@@ -36,6 +36,8 @@ BEGIN {
         checktestcmd
         prepro
         restore_test_env
+        runner_clearlocks
+        runner_stopservers
         runner_test_preprocess
         runner_test_run
         $DBGCURL
@@ -63,6 +65,7 @@ use processhelp qw(
     );
 use servers qw(
     checkcmd
+    clearlocks
     serverfortest
     stopserver
     stopservers
@@ -995,4 +998,19 @@ sub runner_test_run {
     return (0, \%testtimings, $cmdres, $CURLOUT, $tool, $usedvalgrind);
 }
 
+
+###################################################################
+# Kill the server processes that still have lock files in a directory
+sub runner_clearlocks {
+    my ($lockdir)=@_;
+    clearlocks($lockdir);
+}
+
+
+###################################################################
+# Kill all server processes
+sub runner_stopservers {
+    return stopservers($verbose);
+}
+
 1;
index 8cda319c14f0c71bd31d901b327085197e86c3f2..fad5c17d0daec1f0b9922dac1c8352adbe0a7745 100755 (executable)
@@ -195,7 +195,7 @@ $ENV{'COLUMNS'}=79; # screen width!
 sub catch_zap {
     my $signame = shift;
     logmsg "runtests.pl received SIG$signame, exiting\n";
-    stopservers($verbose);
+    runner_stopservers();
     die "Somebody sent me a SIG$signame";
 }
 $SIG{INT} = \&catch_zap;
@@ -1412,7 +1412,7 @@ sub singletest_check {
             if(!$filename) {
                 logmsg "ERROR: section verify=>file$partsuffix ".
                        "has no name attribute\n";
-                stopservers($verbose);
+                runner_stopservers();
                 # timestamp test result verification end
                 $timevrfyend{$testnum} = Time::HiRes::time();
                 return -1;
@@ -1626,7 +1626,7 @@ sub singletest {
 
     # first, remove all lingering log files
     if(!cleardir($LOGDIR) && $clearlocks) {
-        clearlocks($LOGDIR);
+        runner_clearlocks($LOGDIR);
         cleardir($LOGDIR);
     }
 
@@ -2546,7 +2546,7 @@ my $sofar = time() - $start;
 citest_finishtestrun();
 
 # Tests done, stop the servers
-my $unexpected = stopservers($verbose);
+my $unexpected = runner_stopservers();
 
 my $numskipped = %skipped ? sum values %skipped : 0;
 my $all = $total + $numskipped;
index 241e0e5d7c3a4697ed5cf7b9ca7f088212582ac7..44c71a6e944fdaebb2227270ec115d152cb631a3 100644 (file)
@@ -54,9 +54,7 @@ BEGIN {
 
         # functions
         qw(
-            clearlocks
             initserverconfig
-            stopservers
         )
     );
 
@@ -64,8 +62,10 @@ BEGIN {
         # functions
         qw(
             checkcmd
+            clearlocks
             serverfortest
             stopserver
+            stopservers
             subvariables
         ),