1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

merge 47978,48683

This commit is contained in:
Bjorn Munch
2009-11-24 12:26:06 +01:00
5 changed files with 74 additions and 113 deletions

View File

@ -439,7 +439,7 @@ sub run_test_server ($$$) {
my $result;
my $exe_mysqld= find_mysqld($basedir) || ""; # Used as hint to CoreDump
my $suite_timeout_proc= My::SafeProcess->timer(suite_timeout());
my $suite_timeout= start_timer(suite_timeout());
my $s= IO::Select->new();
$s->add($server);
@ -460,7 +460,6 @@ sub run_test_server ($$$) {
mtr_verbose("Child closed socket");
$s->remove($sock);
if (--$childs == 0){
$suite_timeout_proc->kill();
return $completed;
}
next;
@ -529,13 +528,11 @@ sub run_test_server ($$$) {
if ( !$opt_force ) {
# Test has failed, force is off
$suite_timeout_proc->kill();
push(@$completed, $result);
return $completed;
}
elsif ($opt_max_test_fail > 0 and
$num_failed_test >= $opt_max_test_fail) {
$suite_timeout_proc->kill();
push(@$completed, $result);
mtr_report_stats("Too many failed", $completed, 1);
mtr_report("Too many tests($num_failed_test) failed!",
@ -667,7 +664,7 @@ sub run_test_server ($$$) {
# ----------------------------------------------------
# Check if test suite timer expired
# ----------------------------------------------------
if ( ! $suite_timeout_proc->wait_one(0) )
if ( has_expired($suite_timeout) )
{
mtr_report_stats("Timeout", $completed, 1);
mtr_report("Test suite timeout! Terminating...");
@ -2952,11 +2949,11 @@ sub check_testcase($$)
# Return immediately if no check proceess was started
return 0 unless ( keys %started );
my $timeout_proc= My::SafeProcess->timer(check_timeout());
my $timeout= start_timer(check_timeout());
while (1){
my $result;
my $proc= My::SafeProcess->wait_any();
my $proc= My::SafeProcess->wait_any_timeout($timeout);
mtr_report("Got $proc");
if ( delete $started{$proc->pid()} ) {
@ -2980,9 +2977,6 @@ sub check_testcase($$)
if ( keys(%started) == 0){
# All checks completed
$timeout_proc->kill();
return 0;
}
# Wait for next process to exit
@ -3023,10 +3017,9 @@ test case was executed:\n";
}
}
elsif ( $proc eq $timeout_proc ) {
$tinfo->{comment}.= "Timeout $timeout_proc for ".
"'check-testcase' expired after ".check_timeout().
" seconds";
elsif ( $proc->{timeout} ) {
$tinfo->{comment}.= "Timeout for 'check-testcase' expired after "
.check_timeout()." seconds";
$result= 4;
}
else {
@ -3041,8 +3034,6 @@ test case was executed:\n";
# Kill any check processes still running
map($_->kill(), values(%started));
$timeout_proc->kill();
return $result;
}
@ -3114,11 +3105,11 @@ sub run_on_all($$)
# Return immediately if no check proceess was started
return 0 unless ( keys %started );
my $timeout_proc= My::SafeProcess->timer(check_timeout());
my $timeout= start_timer(check_timeout());
while (1){
my $result;
my $proc= My::SafeProcess->wait_any();
my $proc= My::SafeProcess->wait_any_timeout($timeout);
mtr_report("Got $proc");
if ( delete $started{$proc->pid()} ) {
@ -3137,17 +3128,15 @@ sub run_on_all($$)
if ( keys(%started) == 0){
# All completed
$timeout_proc->kill();
return 0;
}
# Wait for next process to exit
next;
}
elsif ( $proc eq $timeout_proc ) {
$tinfo->{comment}.= "Timeout $timeout_proc for '$run' ".
"expired after ". check_timeout().
" seconds";
elsif ($proc->{timeout}) {
$tinfo->{comment}.= "Timeout for '$run' expired after "
.check_timeout()." seconds";
}
else {
# Unknown process returned, most likley a crash, abort everything
@ -3159,8 +3148,6 @@ sub run_on_all($$)
# Kill any check processes still running
map($_->kill(), values(%started));
$timeout_proc->kill();
return 1;
}
mtr_error("INTERNAL_ERROR: run_on_all");
@ -3390,7 +3377,7 @@ sub run_testcase ($) {
}
}
my $test_timeout_proc= My::SafeProcess->timer(testcase_timeout());
my $test_timeout= start_timer(testcase_timeout());
do_before_run_mysqltest($tinfo);
@ -3398,9 +3385,6 @@ sub run_testcase ($) {
# Failed to record state of server or server crashed
report_failure_and_restart($tinfo);
# Stop the test case timer
$test_timeout_proc->kill();
return 1;
}
@ -3418,20 +3402,20 @@ sub run_testcase ($) {
if ($proc)
{
mtr_verbose ("Found exited process $proc");
# If that was the timeout, cancel waiting
if ( $proc eq $test_timeout_proc )
{
$keep_waiting_proc = 0;
}
}
else
{
$proc = $keep_waiting_proc;
# Also check if timer has expired, if so cancel waiting
if ( has_expired($test_timeout) )
{
$keep_waiting_proc = 0;
}
}
}
else
if (! $keep_waiting_proc)
{
$proc= My::SafeProcess->wait_any();
$proc= My::SafeProcess->wait_any_timeout($test_timeout);
}
# Will be restored if we need to keep waiting
@ -3448,9 +3432,6 @@ sub run_testcase ($) {
# ----------------------------------------------------
if ($proc eq $test)
{
# Stop the test case timer
$test_timeout_proc->kill();
my $res= $test->exit_status();
if ($res == 0 and $opt_warnings and check_warnings($tinfo) )
@ -3553,7 +3534,7 @@ sub run_testcase ($) {
# ----------------------------------------------------
# Stop the test case timer
# ----------------------------------------------------
$test_timeout_proc->kill();
$test_timeout= 0;
# ----------------------------------------------------
# Check if it was a server that died
@ -3592,7 +3573,7 @@ sub run_testcase ($) {
# ----------------------------------------------------
# Check if testcase timer expired
# ----------------------------------------------------
if ( $proc eq $test_timeout_proc )
if ( $proc->{timeout} )
{
my $log_file_name= $opt_vardir."/log/".$tinfo->{shortname}.".log";
$tinfo->{comment}=
@ -3833,11 +3814,11 @@ sub check_warnings ($) {
# Return immediately if no check proceess was started
return 0 unless ( keys %started );
my $timeout_proc= My::SafeProcess->timer(check_timeout());
my $timeout= start_timer(check_timeout());
while (1){
my $result= 0;
my $proc= My::SafeProcess->wait_any();
my $proc= My::SafeProcess->wait_any_timeout($timeout);
mtr_report("Got $proc");
if ( delete $started{$proc->pid()} ) {
@ -3866,9 +3847,6 @@ sub check_warnings ($) {
if ( keys(%started) == 0){
# All checks completed
$timeout_proc->kill();
return $result;
}
# Wait for next process to exit
@ -3885,10 +3863,9 @@ sub check_warnings ($) {
$result= 2;
}
}
elsif ( $proc eq $timeout_proc ) {
$tinfo->{comment}.= "Timeout $timeout_proc for ".
"'check warnings' expired after ".check_timeout().
" seconds";
elsif ( $proc->{timeout} ) {
$tinfo->{comment}.= "Timeout for 'check warnings' expired after "
.check_timeout()." seconds";
$result= 4;
}
else {
@ -3902,8 +3879,6 @@ sub check_warnings ($) {
# Kill any check processes still running
map($_->kill(), values(%started));
$timeout_proc->kill();
return $result;
}