runtests: create runner functions for clearlocks and stopservers

runtests.pl now uses runner for all server actions beyond the initial
variable configuration.

Ref: #10818
This commit is contained in:
Dan Fandrich 2023-04-21 15:00:00 -07:00
parent 640f4c2267
commit b88ea272c1
3 changed files with 24 additions and 6 deletions

View 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;

View File

@ -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;

View File

@ -54,9 +54,7 @@ BEGIN {
# functions
qw(
clearlocks
initserverconfig
stopservers
)
);
@ -64,8 +62,10 @@ BEGIN {
# functions
qw(
checkcmd
clearlocks
serverfortest
stopserver
stopservers
subvariables
),