Commit 84d455b4 authored by msvensson@shellback.(none)'s avatar msvensson@shellback.(none)

Merge shellback.(none):/home/msvensson/mysql/mysql-4.1-maint

into  shellback.(none):/home/msvensson/mysql/mysql-5.0-maint
parents ffc9538b d45b61b1
......@@ -130,16 +130,11 @@ sub mtr_report_test_failed ($) {
my $tinfo= shift;
$tinfo->{'result'}= 'MTR_RES_FAILED';
if ( $tinfo->{'timeout'} )
if ( defined $tinfo->{'timeout'} )
{
print "[ fail ] timeout\n";
return;
}
elsif ( $tinfo->{'ndb_test'} and $::cluster->[0]->{'installed_ok'} eq "NO")
{
print "[ fail ] ndbcluster start failure\n";
return;
}
else
{
print "[ fail ]\n";
......
......@@ -4,23 +4,22 @@
# and is part of the translation of the Bourne shell script with the
# same name.
use Carp qw(cluck);
use Socket;
use Errno;
use strict;
#use POSIX ":sys_wait_h";
use POSIX 'WNOHANG';
#use POSIX 'WNOHANG';
sub mtr_init_timers ();
sub mtr_timer_start($$$);
sub mtr_timer_stop($$);
sub mtr_timer_stop_all($);
sub mtr_timer_waitpid($$$);
##############################################################################
#
# Initiate a structure shared by all timers
# Initiate the structure shared by all timers
#
##############################################################################
......@@ -35,17 +34,19 @@ sub mtr_init_timers () {
# Start, stop and poll a timer
#
# As alarm() isn't portable to Windows, we use separate processes to
# implement timers. That is why there is a mtr_timer_waitpid(), as this
# is where we catch a timeout.
# implement timers.
#
##############################################################################
sub mtr_timer_start($$$) {
my ($timers,$name,$duration)= @_;
mtr_verbose("mtr_timer_start: $name, $duration");
if ( exists $timers->{'timers'}->{$name} )
{
# We have an old running timer, kill it
mtr_verbose("There is an old timer running");
mtr_timer_stop($timers,$name);
}
......@@ -57,7 +58,7 @@ sub mtr_timer_start($$$) {
{
if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
{
mtr_debug("Got EAGAIN from fork(), sleep 1 second and redo");
mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo");
sleep(1);
redo FORK;
}
......@@ -70,6 +71,7 @@ sub mtr_timer_start($$$) {
if ( $tpid )
{
# Parent, record the information
mtr_verbose("timer parent, record info($name, $tpid, $duration)");
$timers->{'timers'}->{$name}->{'pid'}= $tpid;
$timers->{'timers'}->{$name}->{'duration'}= $duration;
$timers->{'pids'}->{$tpid}= $name;
......@@ -85,6 +87,7 @@ sub mtr_timer_start($$$) {
$SIG{INT}= 'DEFAULT';
$0= "mtr_timer(timers,$name,$duration)";
mtr_verbose("timer child $name, sleep $duration");
sleep($duration);
exit(0);
}
......@@ -95,9 +98,12 @@ sub mtr_timer_start($$$) {
sub mtr_timer_stop ($$) {
my ($timers,$name)= @_;
mtr_verbose("mtr_timer_stop: $name");
if ( exists $timers->{'timers'}->{$name} )
{
my $tpid= $timers->{'timers'}->{$name}->{'pid'};
mtr_verbose("Stopping timer with pid $tpid");
# FIXME as Cygwin reuses pids fast, maybe check that is
# the expected process somehow?!
......@@ -114,7 +120,7 @@ sub mtr_timer_stop ($$) {
}
else
{
mtr_debug("Asked to stop timer \"$name\" not started");
mtr_error("Asked to stop timer \"$name\" not started");
return 0;
}
}
......
......@@ -391,6 +391,8 @@ sub main () {
my ($need_ndbcluster,$need_im);
foreach my $test (@$tests)
{
next if $test->{skip};
$need_ndbcluster||= $test->{ndb_test};
$need_im||= $test->{component_id} eq 'im';
......@@ -2753,10 +2755,9 @@ sub run_testcase_check_skip_test($)
# If test needs this cluster, check it was installed ok
if ( !$cluster->{'installed_ok'} )
{
mtr_tofile($path_timefile,
"Test marked as failed because $cluster->{'name'} " .
"was not installed ok!");
mtr_report_test_name($tinfo);
$tinfo->{comment}=
"Cluster $cluster->{'name'} was not installed ok";
mtr_report_test_failed($tinfo);
return 1;
}
......@@ -2879,10 +2880,8 @@ sub run_testcase ($) {
# Can't restart a running server that may be in use
if ( $glob_use_running_server )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Can't restart a running server";
mtr_report_test_name($tinfo);
$tinfo->{comment}= "Can't restart a running server";
mtr_report_test_skipped($tinfo);
return;
}
......@@ -2932,16 +2931,16 @@ sub run_testcase ($) {
$tinfo->{'timeout'}= 1; # Mark as timeout
report_failure_and_restart($tinfo);
}
elsif ( $res == 1 )
{
# Test case failure reported by mysqltest
report_failure_and_restart($tinfo);
}
else
{
# Test case failed, if in control mysqltest returns 1
if ( $res != 1 )
{
mtr_tofile($path_timefile,
"mysqltest returned unexpected code $res, " .
"it has probably crashed");
}
# mysqltest failed, probably crashed
$tinfo->{comment}=
"mysqltest returned unexpected code $res, it has probably crashed";
report_failure_and_restart($tinfo);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment