mirror of
https://github.com/curl/curl.git
synced 2025-04-12 16:20:35 +08:00
runtests: display logs on server failure in singletest()
This is closer to the place where logs are displayed on test failure. Also, only display these logs if -p is given, which is the same flag that controls display of test failure logs. Some server log files need to be deleted later so that they stay around long enough to be displayed on failure. Ref: #10818
This commit is contained in:
parent
90158f0bab
commit
8da49c9e38
@ -97,13 +97,6 @@ sub logmsg {
|
||||
return main::logmsg(@_);
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
# Call main's displaylogs
|
||||
# TODO: this will eventually stop being called in this package
|
||||
sub displaylogs{
|
||||
return main::displaylogs(@_);
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
# Check for a command in the PATH of the machine running curl.
|
||||
#
|
||||
@ -389,25 +382,31 @@ sub restore_test_env {
|
||||
sub singletest_startservers {
|
||||
my ($testnum, $testtimings) = @_;
|
||||
|
||||
# remove test server commands file before servers are started/verified
|
||||
unlink($FTPDCMD) if(-f $FTPDCMD);
|
||||
# remove old test server files before servers are started/verified
|
||||
unlink($FTPDCMD);
|
||||
unlink($SERVERIN);
|
||||
unlink($SERVER2IN);
|
||||
unlink($PROXYIN);
|
||||
|
||||
# timestamp required servers verification start
|
||||
$$testtimings{"timesrvrini"} = Time::HiRes::time();
|
||||
|
||||
my $why;
|
||||
my $error;
|
||||
if (!$listonly) {
|
||||
my @what = getpart("client", "server");
|
||||
if(!$what[0]) {
|
||||
warn "Test case $testnum has no server(s) specified";
|
||||
$why = "no server specified";
|
||||
$error = -1;
|
||||
} else {
|
||||
my $err;
|
||||
($why, $err) = serverfortest(@what);
|
||||
if($err == 1) {
|
||||
# Error indicates an actual problem starting the server, so
|
||||
# display the server logs
|
||||
displaylogs($testnum);
|
||||
# Error indicates an actual problem starting the server
|
||||
$error = -2;
|
||||
} else {
|
||||
$error = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -415,12 +414,7 @@ sub singletest_startservers {
|
||||
# timestamp required servers verification end
|
||||
$$testtimings{"timesrvrend"} = Time::HiRes::time();
|
||||
|
||||
# remove server output logfile after servers are started/verified
|
||||
unlink($SERVERIN);
|
||||
unlink($SERVER2IN);
|
||||
unlink($PROXYIN);
|
||||
|
||||
return $why;
|
||||
return ($why, $error);
|
||||
}
|
||||
|
||||
|
||||
@ -533,6 +527,11 @@ sub singletest_prepare {
|
||||
}
|
||||
unlink("core");
|
||||
|
||||
# remove server output logfiles after servers are started/verified
|
||||
unlink($SERVERIN);
|
||||
unlink($SERVER2IN);
|
||||
unlink($PROXYIN);
|
||||
|
||||
# if this section exists, it might be FTP server instructions:
|
||||
my @ftpservercmd = getpart("reply", "servercmd");
|
||||
push @ftpservercmd, "Testnum $testnum\n";
|
||||
@ -915,7 +914,7 @@ sub runner_test_preprocess {
|
||||
|
||||
###################################################################
|
||||
# Start the servers needed to run this test case
|
||||
my $why = singletest_startservers($testnum, \%testtimings);
|
||||
my ($why, $error) = singletest_startservers($testnum, \%testtimings);
|
||||
|
||||
if(!$why) {
|
||||
|
||||
@ -933,9 +932,10 @@ sub runner_test_preprocess {
|
||||
# Check that the test environment is fine to run this test case
|
||||
if (!$listonly) {
|
||||
$why = singletest_precheck($testnum);
|
||||
$error = -1;
|
||||
}
|
||||
}
|
||||
return ($why, \%testtimings);
|
||||
return ($why, $error, \%testtimings);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1646,12 +1646,19 @@ sub singletest {
|
||||
# Register the test case with the CI environment
|
||||
citest_starttest($testnum);
|
||||
|
||||
my ($why, $testtimings) = runner_test_preprocess($testnum);
|
||||
my ($why, $error, $testtimings) = runner_test_preprocess($testnum);
|
||||
if($error == -2) {
|
||||
if($postmortem) {
|
||||
# Error indicates an actual problem starting the server, so
|
||||
# display the server logs
|
||||
displaylogs($testnum);
|
||||
}
|
||||
}
|
||||
updatetesttimings($testnum, %$testtimings);
|
||||
|
||||
#######################################################################
|
||||
# Print the test name and count tests
|
||||
my $error = singletest_count($testnum, $why);
|
||||
$error = singletest_count($testnum, $why);
|
||||
if($error) {
|
||||
return $error;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user