From 329264140a6e99f7bd97a535201b973b5cb42a9e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Mar 2006 19:44:58 +0100 Subject: [PATCH 1/2] Bug#17574 Detect cluster start failure and "fail" ndb_* tests mysql-test/lib/mtr_cases.pl: Always set "ndb_test" if tets name contains ndb. Set to skipped if "--skip-ndbcluster" mysql-test/lib/mtr_report.pl: Print special error message for ndb_test that are failed due to failure to start or install ndbcluster mysql-test/mysql-test-run.pl: Remove mtr_error call from ndbcluster_install, instead check after ndbcluster_install if test run should continue or if it should be aborted Faile ndb test and print special error message if it's a ndb test and flag_ndb_status_ok is not ok --- mysql-test/lib/mtr_cases.pl | 9 ++------- mysql-test/lib/mtr_report.pl | 5 +++++ mysql-test/mysql-test-run.pl | 24 ++++++++++++++++++++---- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 568b44d2e59..fc32c56536f 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -253,19 +253,14 @@ sub collect_one_test_case($$$$$$$) { } # Cluster is needed by test case if testname contains ndb - if ( ( $::opt_with_ndbcluster or $::glob_use_running_ndbcluster ) and - defined mtr_match_substring($tname,"ndb") ) + if ( defined mtr_match_substring($tname,"ndb") ) { + $tinfo->{'ndb_test'}= 1; if ( $::opt_skip_ndbcluster ) { - $tinfo->{'ndb_test'}= 0; $tinfo->{'skip'}= 1; return; } - else - { - $tinfo->{'ndb_test'}= 1; - } } else { diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index 88ddbf63d0f..92ce7437365 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -114,6 +114,11 @@ sub mtr_report_test_failed ($) { { print "[ fail ] timeout\n"; } + elsif ( $tinfo->{'ndb_test'} and !$::flag_ndb_status_ok) + { + print "[ fail ] ndbcluster start failure\n"; + return; + } else { print "[ fail ]\n"; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 905a2b2af37..f56d66365c9 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1396,7 +1396,6 @@ sub ndbcluster_install () { "--initial"], "", "", "", "") ) { - mtr_error("Error ndbcluster_install"); return 1; } @@ -1603,9 +1602,19 @@ sub mysql_install_db () { if ( ndbcluster_install() ) { - # failed to install, disable usage but flag that its no ok - $opt_with_ndbcluster= 0; - $flag_ndb_status_ok= 0; + if ( $opt_force) + { + # failed to install, disable usage and flag that its no ok + mtr_report("ndbcluster_install failed, continuing without cluster"); + $opt_with_ndbcluster= 0; + $flag_ndb_status_ok= 0; + } + else + { + print "Aborting: Failed to install ndb cluster\n"; + print "To continue, re-run with '--force'.\n"; + mtr_exit(1); + } } return 0; @@ -1805,6 +1814,13 @@ sub run_testcase ($) { return; } + if ( $tinfo->{'ndb_test'} and ! $flag_ndb_status_ok ) + { + mtr_report_test_name($tinfo); + mtr_report_test_failed($tinfo); + return; + } + # ---------------------------------------------------------------------- # If not using a running servers we may need to stop and restart. # We restart in the case we have initiation scripts, server options From f0f8f114f54cc542b51bfd8ac6368e835117ea54 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Mar 2006 20:35:59 +0100 Subject: [PATCH 2/2] Bug#17574 Detect cluster start failure and "fail" ndb_* tests - Update for 5.1 mysql-test/mysql-test-run.pl: Remove mtr_error call from ndbcluster_install_slave Check if ndbcluster_install_slave failed after it's been called. continu with disabled slave cluster if --force is used. --- mysql-test/mysql-test-run.pl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4138e14afba..50047a8903b 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1563,7 +1563,6 @@ sub ndbcluster_install_slave () { "--core"], "", "", "", "") ) { - mtr_error("Error ndbcluster_install_slave"); return 1; } @@ -1793,9 +1792,20 @@ sub mysql_install_db () { if ( ndbcluster_install_slave() ) { - # failed to install, disable usage but flag that its no ok - $opt_with_ndbcluster_slave= 0; - $flag_ndb_slave_status_ok= 0; + if ( $opt_force) + { + # failed to install, disable usage and flag that its no ok + mtr_report("ndbcluster_install_slave failed, " . + "continuing without slave cluster"); + $opt_with_ndbcluster_slave= 0; + $flag_ndb_slave_status_ok= 0; + } + else + { + print "Aborting: Failed to install ndb cluster\n"; + print "To continue, re-run with '--force'.\n"; + mtr_exit(1); + } } return 0;