From b6707f8c7f39878c86347acff495337eb9bdef22 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Aug 2006 09:53:04 +0200 Subject: [PATCH 1/6] Break out and create new function 'run_testcase_check_skip_test' --- mysql-test/mysql-test-run.pl | 73 +++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 31 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index af59c39cda7..507258c5d65 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -360,6 +360,7 @@ sub install_db ($$); sub run_testcase ($); sub run_testcase_stop_servers ($$$); sub run_testcase_start_servers ($); +sub run_testcase_check_skip_test($); sub report_failure_and_restart ($); sub do_before_start_master ($$); sub do_before_start_slave ($$); @@ -2156,6 +2157,8 @@ sub run_suite () { foreach my $tinfo ( @$tests ) { + next if run_testcase_check_skip_test($tinfo); + mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout); run_testcase($tinfo); mtr_timer_stop($glob_timers,"testcase"); @@ -2440,6 +2443,45 @@ sub im_prepare_data_dir($) { } } +sub run_testcase_check_skip_test($) +{ + my ($tinfo)= @_; + + # ---------------------------------------------------------------------- + # If marked to skip, just print out and return. + # Note that a test case not marked as 'skip' can still be + # skipped later, because of the test case itself in cooperation + # with the mysqltest program tells us so. + # ---------------------------------------------------------------------- + + if ( $tinfo->{'skip'} ) + { + mtr_report_test_name($tinfo); + mtr_report_test_skipped($tinfo); + return 1; + } + + # If test needs cluster, check that master installed ok + if ( $tinfo->{'ndb_test'} and $clusters->[0]->{'installed_ok'} eq "NO" ) + { + mtr_report_test_name($tinfo); + mtr_report_test_failed($tinfo); + return 1; + } + + # If test needs slave cluster, check that it installed ok + if ( $tinfo->{'ndb_test'} and $tinfo->{'slave_num'} and + $clusters->[1]->{'installed_ok'} eq "NO" ) + { + mtr_report_test_name($tinfo); + mtr_report_test_failed($tinfo); + return 1; + } + + return 0; +} + + ############################################################################## # @@ -2467,37 +2509,6 @@ sub run_testcase ($) { # output current test to ndbcluster log file to enable diagnostics mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n"); - # ---------------------------------------------------------------------- - # If marked to skip, just print out and return. - # Note that a test case not marked as 'skip' can still be - # skipped later, because of the test case itself in cooperation - # with the mysqltest program tells us so. - # ---------------------------------------------------------------------- - - if ( $tinfo->{'skip'} ) - { - mtr_report_test_name($tinfo); - mtr_report_test_skipped($tinfo); - return; - } - - # If test needs cluster, check that master installed ok - if ( $tinfo->{'ndb_test'} and $clusters->[0]->{'installed_ok'} eq "NO" ) - { - mtr_report_test_name($tinfo); - mtr_report_test_failed($tinfo); - return; - } - - # If test needs slave cluster, check that it installed ok - if ( $tinfo->{'ndb_test'} and $tinfo->{'slave_num'} and - $clusters->[1]->{'installed_ok'} eq "NO" ) - { - mtr_report_test_name($tinfo); - mtr_report_test_failed($tinfo); - return; - } - my $master_restart= run_testcase_need_master_restart($tinfo); my $slave_restart= run_testcase_need_slave_restart($tinfo); From f76c1536008bee12a46eb6fb65c3065936181240 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Aug 2006 09:53:49 +0200 Subject: [PATCH 2/6] Turn on reorder by default --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 507258c5d65..26f9bcda889 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -216,7 +216,7 @@ our $opt_embedded_server; our $opt_extern; our $opt_fast; our $opt_force; -our $opt_reorder; +our $opt_reorder= 1; our $opt_enable_disabled; our $opt_gcov; From c3867a251b4881f5a04ee76b67a8771041bdf024 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Aug 2006 15:35:24 +0200 Subject: [PATCH 3/6] Break out functions do_before_run_mysqltest and do_after_run_mysqltest --- mysql-test/mysql-test-run.pl | 94 ++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 26f9bcda889..6865cd55398 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2157,7 +2157,10 @@ sub run_suite () { foreach my $tinfo ( @$tests ) { - next if run_testcase_check_skip_test($tinfo); + if (run_testcase_check_skip_test($tinfo)) + { + next; + } mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout); run_testcase($tinfo); @@ -2482,6 +2485,47 @@ sub run_testcase_check_skip_test($) } +sub do_before_run_mysqltest($) +{ + my $tinfo= shift; + my $tname= $tinfo->{'name'}; + + # Remove old reject file + if ( $opt_suite eq "main" ) + { + unlink("r/$tname.reject"); + } + else + { + unlink("suite/$opt_suite/r/$tname.reject"); + } + + +# MASV cleanup... + mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are + + # output current test to ndbcluster log file to enable diagnostics + mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n"); + + mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n"); + if ( $master->[1]->{'pid'} ) + { + mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); + } +} + +sub do_after_run_mysqltest($) +{ + my $tinfo= shift; + my $tname= $tinfo->{'name'}; + + #MASV cleanup + # Save info from this testcase run to mysqltest.log + my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile; + mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n"); + mtr_tofile($path_mysqltest_log, $testcase_log); + } + ############################################################################## # @@ -2502,13 +2546,6 @@ sub run_testcase_check_skip_test($) sub run_testcase ($) { my $tinfo= shift; - my $tname= $tinfo->{'name'}; - - mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are - - # output current test to ndbcluster log file to enable diagnostics - mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n"); - my $master_restart= run_testcase_need_master_restart($tinfo); my $slave_restart= run_testcase_need_slave_restart($tinfo); @@ -2517,26 +2554,7 @@ sub run_testcase ($) { run_testcase_stop_servers($tinfo, $master_restart, $slave_restart); } - # ---------------------------------------------------------------------- - # Prepare to start masters. Even if we use embedded, we want to run - # the preparation. - # ---------------------------------------------------------------------- - - mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n"); - if ( $master->[1]->{'pid'} ) - { - mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); - } - - # ---------------------------------------------------------------------- - # If any mysqld servers running died, we have to know - # ---------------------------------------------------------------------- - my $died= mtr_record_dead_children(); - - # ---------------------------------------------------------------------- - # Start masters needed by the testcase - # ---------------------------------------------------------------------- if ($died or $master_restart or $slave_restart) { run_testcase_start_servers($tinfo); @@ -2546,28 +2564,14 @@ sub run_testcase ($) { # If --start-and-exit or --start-dirty given, stop here to let user manually # run tests # ---------------------------------------------------------------------- - if ( $opt_start_and_exit or $opt_start_dirty ) { mtr_report("\nServers started, exiting"); exit(0); } - # ---------------------------------------------------------------------- - # Run the test case - # ---------------------------------------------------------------------- - { - # remove the old reject file - if ( $opt_suite eq "main" ) - { - unlink("r/$tname.reject"); - } - else - { - unlink("suite/$opt_suite/r/$tname.reject"); - } - unlink($path_timefile); + do_before_run_mysqltest($tinfo); my $res= run_mysqltest($tinfo); mtr_report_test_name($tinfo); @@ -2603,10 +2607,8 @@ sub run_testcase ($) { report_failure_and_restart($tinfo); } - # Save info from this testcase run to mysqltest.log - my $testcase_log= mtr_fromfile($path_timefile) if -f $path_timefile; - mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n"); - mtr_tofile($path_mysqltest_log, $testcase_log); + + do_after_run_mysqltest($tinfo); } # ---------------------------------------------------------------------- From 97fb42a06e7ca419bb4b3ce5ab725afa26516f3b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Aug 2006 15:41:52 +0200 Subject: [PATCH 4/6] Fix VC 2005 compile problem sql/handler.cc: Cast to "byte*" on both sides of equal sign Fix spelling error --- sql/handler.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/handler.cc b/sql/handler.cc index d67acf69d14..c92f7dcb16d 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3513,10 +3513,10 @@ int handler::ha_external_lock(THD *thd, int lock_type) int handler::ha_reset() { DBUG_ENTER("ha_reset"); - /* Check that we have called all proper delallocation functions */ + /* Check that we have called all proper deallocation functions */ DBUG_ASSERT((byte*) table->def_read_set.bitmap + table->s->column_bitmap_size == - (char*) table->def_write_set.bitmap); + (byte*) table->def_write_set.bitmap); DBUG_ASSERT(bitmap_is_set_all(&table->s->all_set)); DBUG_ASSERT(table->key_read == 0); /* ensure that ha_index_end / ha_rnd_end has been called */ From 5ba4f53c64b5e7dbfb4205cc13b16e20ef35f3c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Aug 2006 10:18:55 +0200 Subject: [PATCH 5/6] Add check in 'spawn_impl' that we are not trying to span when the path to the executable is empty or undefined --- mysql-test/lib/mtr_process.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index a71a1e7d2e4..f74665d1646 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -94,6 +94,8 @@ sub spawn_impl ($$$$$$$$) { my $pid_file= shift; # FIXME my $spawn_opts= shift; + mtr_error("Can't spawn with empty \"path\"") unless defined $path; + if ( $::opt_script_debug ) { print STDERR "\n"; From abc4c3dc1d77cb801d9a13c9feb33bf970eeba3f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Aug 2006 10:28:48 +0200 Subject: [PATCH 6/6] Bug#21721 Test suite does not start with NDB, hangs forever; problem around "ndb_mgmd" - Wait for ndb_mgmd with timeout mysql-test/mysql-test-run.pl: Add new function 'ndb_mgmd_wait_started' that will wait with timeout until ndb_mgmd has been started Don't bother to save the return value from 'ndb_mgmd_start' in local var as it's not used. --- mysql-test/mysql-test-run.pl | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 6865cd55398..c949c2e1966 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1955,6 +1955,23 @@ sub mysqld_wait_started($){ } +sub ndb_mgmd_wait_started($) { + my ($cluster)= @_; + + my $retries= 100; + while (ndbcluster_wait_started($cluster, "--no-contact") and + $retries) + { + # Millisceond sleep emulated with select + select(undef, undef, undef, (0.1)); + + $retries--; + } + + return $retries == 0; + +} + sub ndb_mgmd_start ($) { my $cluster= shift; @@ -1975,13 +1992,12 @@ sub ndb_mgmd_start ($) { "", { append_log_file => 1 }); - # FIXME Should not be needed # Unfortunately the cluster nodes will fail to start # if ndb_mgmd has not started properly - while (ndbcluster_wait_started($cluster, "--no-contact")) + if (ndb_mgmd_wait_started($cluster)) { - select(undef, undef, undef, 0.1); + mtr_error("Failed to wait for start of ndb_mgmd"); } # Remember pid of ndb_mgmd @@ -2046,7 +2062,7 @@ sub ndbcluster_start ($$) { mtr_error("Cluster '$cluster->{'name'}' already started"); } - my $pid= ndb_mgmd_start($cluster); + ndb_mgmd_start($cluster); for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ ) {