Commit 64329b16 authored by unknown's avatar unknown

Add error handling of failure to start server to "run_testcase_start_servers"


mysql-test/lib/mtr_report.pl:
  Use tinfo's comment as primary place to look for error message
parent e16d9851
...@@ -144,9 +144,11 @@ sub mtr_report_test_failed ($) { ...@@ -144,9 +144,11 @@ sub mtr_report_test_failed ($) {
print "[ fail ]\n"; print "[ fail ]\n";
} }
# FIXME Instead of this test, and meaningless error message in 'else' if ( $tinfo->{'comment'} )
# we should write out into $::path_timefile when the error occurs. {
if ( -f $::path_timefile ) print "\nERROR: $tinfo->{'comment'}\n";
}
elsif ( -f $::path_timefile )
{ {
print "\nErrors are (from $::path_timefile) :\n"; print "\nErrors are (from $::path_timefile) :\n";
print mtr_fromfile($::path_timefile); # FIXME print_file() instead print mtr_fromfile($::path_timefile); # FIXME print_file() instead
......
...@@ -2775,6 +2775,9 @@ sub do_after_run_mysqltest($) ...@@ -2775,6 +2775,9 @@ sub do_after_run_mysqltest($)
mtr_appendfile_to_file($path_timefile, $path_mysqltest_log) mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
if -f $path_timefile; if -f $path_timefile;
# Remove the file that mysqltest writes info to
unlink($path_timefile);
} }
...@@ -2807,7 +2810,12 @@ sub run_testcase ($) { ...@@ -2807,7 +2810,12 @@ sub run_testcase ($) {
my $died= mtr_record_dead_children(); my $died= mtr_record_dead_children();
if ($died or $master_restart or $slave_restart) if ($died or $master_restart or $slave_restart)
{ {
run_testcase_start_servers($tinfo); if (run_testcase_start_servers($tinfo))
{
mtr_report_test_name($tinfo);
report_failure_and_restart($tinfo);
return 1;
}
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
...@@ -3748,6 +3756,17 @@ sub run_testcase_stop_servers($$$) { ...@@ -3748,6 +3756,17 @@ sub run_testcase_stop_servers($$$) {
} }
} }
#
# run_testcase_start_servers
#
# Start the servers neede by this test case
#
# RETURN
# 0 OK
# 1 Start failed
#
sub run_testcase_start_servers($) { sub run_testcase_start_servers($) {
my $tinfo= shift; my $tinfo= shift;
...@@ -3755,7 +3774,7 @@ sub run_testcase_start_servers($) { ...@@ -3755,7 +3774,7 @@ sub run_testcase_start_servers($) {
if ( $glob_use_running_server or $glob_use_embedded_server ) if ( $glob_use_running_server or $glob_use_embedded_server )
{ {
return; return 0;
} }
# ------------------------------------------------------- # -------------------------------------------------------
...@@ -3796,10 +3815,9 @@ sub run_testcase_start_servers($) { ...@@ -3796,10 +3815,9 @@ sub run_testcase_start_servers($) {
$master->[0]->{'start_timeout'}, $master->[0]->{'start_timeout'},
$master->[0]->{'pid'})) $master->[0]->{'pid'}))
{ {
mtr_report_test_name($tinfo);
mtr_report("Failed to create 'cluster/apply_status' table"); $tinfo->{'comment'}= "Failed to create 'cluster/apply_status' table";
report_failure_and_restart($tinfo); return 1;
return;
} }
} }
mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
...@@ -3822,13 +3840,10 @@ sub run_testcase_start_servers($) { ...@@ -3822,13 +3840,10 @@ sub run_testcase_start_servers($) {
im_create_defaults_file($instance_manager); im_create_defaults_file($instance_manager);
unless ( mtr_im_start($instance_manager, $tinfo->{im_opts}) ) if ( ! mtr_im_start($instance_manager, $tinfo->{im_opts}) )
{ {
mtr_report_test_name($tinfo); $tinfo->{'comment'}= "Failed to start Instance Manager. ";
report_failure_and_restart($tinfo); return 1;
mtr_report("Failed to start Instance Manager. " .
"The test '$tname' is marked as failed.");
return;
} }
} }
...@@ -3878,7 +3893,8 @@ sub run_testcase_start_servers($) { ...@@ -3878,7 +3893,8 @@ sub run_testcase_start_servers($) {
if (ndbcluster_wait_started($cluster, "")) if (ndbcluster_wait_started($cluster, ""))
{ {
# failed to start # failed to start
mtr_report("Start of $cluster->{'name'} cluster failed, "); $tinfo->{'comment'}= "Start of $cluster->{'name'} cluster failed";
return 1;
} }
} }
...@@ -3890,9 +3906,13 @@ sub run_testcase_start_servers($) { ...@@ -3890,9 +3906,13 @@ sub run_testcase_start_servers($) {
if (mysqld_wait_started($mysqld)) if (mysqld_wait_started($mysqld))
{ {
mtr_warning("Failed to start $mysqld->{'type'} mysqld $mysqld->{'idx'}"); # failed to start
$tinfo->{'comment'}=
"Failed to start $mysqld->{'type'} mysqld $mysqld->{'idx'}";
return 1;
} }
} }
return 0;
} }
# #
......
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