%feature
%keywords
@protocols
- %timesrvrend
- %timesrvrini
- %timesrvrlog
- %timetoolend
- %timetoolini
- %timevrfyend
);
}
use pathhelp qw(exe_ext);
our %feature; # hash of enabled features
our $has_shared; # built as a shared library
our %keywords; # hash of keywords from the test spec
-our %timesrvrini; # timestamp for each test required servers verification start
-our %timesrvrend; # timestamp for each test required servers verification end
-our %timetoolini; # timestamp for each test command run starting
-our %timetoolend; # timestamp for each test command run stopping
-our %timesrvrlog; # timestamp for each test server logs lock removal
-our %timevrfyend; # timestamp for each test result verification end
1;
#######################################################################
# Start the servers needed to run this test case
sub singletest_startservers {
- my ($testnum) = @_;
+ my ($testnum, $testtimings) = @_;
# remove test server commands file before servers are started/verified
unlink($FTPDCMD) if(-f $FTPDCMD);
# timestamp required servers verification start
- $timesrvrini{$testnum} = Time::HiRes::time();
+ $$testtimings{"timesrvrini"} = Time::HiRes::time();
my $why;
if (!$listonly) {
}
# timestamp required servers verification end
- $timesrvrend{$testnum} = Time::HiRes::time();
+ $$testtimings{"timesrvrend"} = Time::HiRes::time();
# remove server output logfile after servers are started/verified
unlink($SERVERIN);
#######################################################################
# Run the test command
sub singletest_run {
- my $testnum = $_[0];
+ my ($testnum, $testtimings) = @_;
# get the command line options to use
my ($cmd, @blaha)= getpart("client", "command");
$| = 1;
# timestamp starting of test command
- $timetoolini{$testnum} = Time::HiRes::time();
+ $$testtimings{"timetoolini"} = Time::HiRes::time();
# run the command line we built
if ($torture) {
}
# timestamp finishing of test command
- $timetoolend{$testnum} = Time::HiRes::time();
+ $$testtimings{"timetoolend"} = Time::HiRes::time();
return (0, $cmdres, $dumped_core, $CURLOUT, $tool, use_valgrind() && !$disablevalgrind);
}
#######################################################################
# Clean up after test command
sub singletest_clean {
- my ($testnum, $dumped_core)=@_;
+ my ($testnum, $dumped_core, $testtimings)=@_;
if(!$dumped_core) {
if(-r "core") {
portable_sleep($postcommanddelay) if($postcommanddelay);
# timestamp removal of server logs advisor read lock
- $timesrvrlog{$testnum} = Time::HiRes::time();
+ $$testtimings{"timesrvrlog"} = Time::HiRes::time();
# test definition might instruct to stop some servers
# stop also all servers relative to the given one
chomp $server;
if(stopserver($server)) {
logmsg " killserver FAILED\n";
- # timestamp test result verification end
- $timevrfyend{$testnum} = Time::HiRes::time();
return 1; # normal error if asked to fail on unexpected alive
}
}
# to clean up, but the result can't be relied upon.
if($rc != 0 && !$torture) {
logmsg " postcheck FAILED\n";
- # timestamp test result verification end
- $timevrfyend{$testnum} = Time::HiRes::time();
return -1;
}
}
sub runner_test_preprocess {
my ($testnum)=@_;
+ my %testtimings;
+
###################################################################
# Start the servers needed to run this test case
- my $why = singletest_startservers($testnum);
+ my $why = singletest_startservers($testnum, \%testtimings);
if(!$why) {
$why = singletest_precheck($testnum);
}
}
- return $why;
+ return ($why, \%testtimings);
}
sub runner_test_run {
my ($testnum)=@_;
+ my %testtimings;
+
#######################################################################
# Prepare the test environment to run this test case
my $error = singletest_prepare($testnum);
my $CURLOUT;
my $tool;
my $usedvalgrind;
- ($error, $cmdres, $dumped_core, $CURLOUT, $tool, $usedvalgrind) = singletest_run($testnum);
+ ($error, $cmdres, $dumped_core, $CURLOUT, $tool, $usedvalgrind) = singletest_run($testnum, \%testtimings);
if($error) {
- return -2;
+ return (-2, \%testtimings);
}
#######################################################################
# Clean up after test command
- $error = singletest_clean($testnum, $dumped_core);
+ $error = singletest_clean($testnum, $dumped_core, \%testtimings);
if($error) {
- return $error;
+ return ($error, \%testtimings);
}
#######################################################################
# Verify that the postcheck succeeded
$error = singletest_postcheck($testnum);
if($error) {
- return $error;
+ return ($error, \%testtimings);
}
#######################################################################
# restore environment variables that were modified
restore_test_env(0);
- return (0, $cmdres, $CURLOUT, $tool, $usedvalgrind);
+
+ return (0, \%testtimings, $cmdres, $CURLOUT, $tool, $usedvalgrind);
}
1;
my $timestats; # time stamping and stats generation
my $fullstats; # show time stats for every single test
my %timeprepini; # timestamp for each test preparation start
+my %timesrvrini; # timestamp for each test required servers verification start
+my %timesrvrend; # timestamp for each test required servers verification end
+my %timetoolini; # timestamp for each test command run starting
+my %timetoolend; # timestamp for each test command run stopping
+my %timesrvrlog; # timestamp for each test server logs lock removal
+my %timevrfyend; # timestamp for each test result verification end
#######################################################################
# variables that command line options may set
}
+# add one set of test timings from the runner to global set
+sub updatetesttimings {
+ my ($testnum, %testtimings)=@_;
+
+ if(defined $testtimings{"timesrvrini"}) {
+ $timesrvrini{$testnum} = $testtimings{"timesrvrini"};
+ }
+ if(defined $testtimings{"timesrvrend"}) {
+ $timesrvrend{$testnum} = $testtimings{"timesrvrend"};
+ }
+ if(defined $testtimings{"timetoolini"}) {
+ $timetoolini{$testnum} = $testtimings{"timetoolini"};
+ }
+ if(defined $testtimings{"timetoolend"}) {
+ $timetoolend{$testnum} = $testtimings{"timetoolend"};
+ }
+ if(defined $testtimings{"timesrvrlog"}) {
+ $timesrvrlog{$testnum} = $testtimings{"timesrvrlog"};
+ }
+}
+
+
#######################################################################
# Verify that this test case should be run
sub singletest_shouldrun {
citest_starttest($testnum);
if(!$why) {
- $why = runner_test_preprocess($testnum);
+ my $testtimings;
+ ($why, $testtimings) = runner_test_preprocess($testnum);
+ updatetesttimings($testnum, %$testtimings);
} else {
# set zero servers verification time when they aren't started
my $CURLOUT;
my $tool;
my $usedvalgrind;
- ($error, $cmdres, $CURLOUT, $tool, $usedvalgrind) = runner_test_run($testnum);
+ my $testtimings;
+ ($error, $testtimings, $cmdres, $CURLOUT, $tool, $usedvalgrind) = runner_test_run($testnum);
+ updatetesttimings($testnum, %$testtimings);
if($error == -1) {
- # return a test failure, either to be reported or to be ignored
- return $errorreturncode;
+ # no further verification will occur
+ $timevrfyend{$testnum} = Time::HiRes::time();
+ # return a test failure, either to be reported or to be ignored
+ return $errorreturncode;
}
elsif($error == -2) {
- timestampskippedevents($testnum);
- return $error;
+ # fill in the missing timings on error
+ timestampskippedevents($testnum);
+ return $error;
}
elsif($error > 0) {
- return $error;
+ # no further verification will occur
+ $timevrfyend{$testnum} = Time::HiRes::time();
+ return $error;
}
#######################################################################
elsif($ARGV[0] eq "-r") {
# run time statistics needs Time::HiRes
if($Time::HiRes::VERSION) {
- keys(%timeprepini) = 1000;
- keys(%timesrvrini) = 1000;
- keys(%timesrvrend) = 1000;
- keys(%timetoolini) = 1000;
- keys(%timetoolend) = 1000;
- keys(%timesrvrlog) = 1000;
- keys(%timevrfyend) = 1000;
+ # presize hashes appropriately to hold an entire test run
+ keys(%timeprepini) = 2000;
+ keys(%timesrvrini) = 2000;
+ keys(%timesrvrend) = 2000;
+ keys(%timetoolini) = 2000;
+ keys(%timetoolend) = 2000;
+ keys(%timesrvrlog) = 2000;
+ keys(%timevrfyend) = 2000;
$timestats=1;
$fullstats=0;
}
elsif($ARGV[0] eq "-rf") {
# run time statistics needs Time::HiRes
if($Time::HiRes::VERSION) {
- keys(%timeprepini) = 1000;
- keys(%timesrvrini) = 1000;
- keys(%timesrvrend) = 1000;
- keys(%timetoolini) = 1000;
- keys(%timetoolend) = 1000;
- keys(%timesrvrlog) = 1000;
- keys(%timevrfyend) = 1000;
+ # presize hashes appropriately to hold an entire test run
+ keys(%timeprepini) = 2000;
+ keys(%timesrvrini) = 2000;
+ keys(%timesrvrend) = 2000;
+ keys(%timetoolini) = 2000;
+ keys(%timetoolend) = 2000;
+ keys(%timesrvrlog) = 2000;
+ keys(%timevrfyend) = 2000;
$timestats=1;
$fullstats=1;
}