From b6707f8c7f39878c86347acff495337eb9bdef22 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Aug 2006 09:53:04 +0200 Subject: Break out and create new function 'run_testcase_check_skip_test' --- mysql-test/mysql-test-run.pl | 69 +++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 29 deletions(-) (limited to 'mysql-test') 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,32 +2443,9 @@ sub im_prepare_data_dir($) { } } - -############################################################################## -# -# Run a single test case -# -############################################################################## - -# When we get here, we have already filtered out test cases that doesn't -# apply to the current setup, for example if we use a running server, test -# cases that restart the server are dropped. So this function should mostly -# be about doing things, not a lot of logic. - -# We don't start and kill the servers for each testcase. But some -# testcases needs a restart, because they specify options to start -# mysqld with. After that testcase, we need to restart again, to set -# back the normal options. - -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"); +sub run_testcase_check_skip_test($) +{ + my ($tinfo)= @_; # ---------------------------------------------------------------------- # If marked to skip, just print out and return. @@ -2478,7 +2458,7 @@ sub run_testcase ($) { { mtr_report_test_name($tinfo); mtr_report_test_skipped($tinfo); - return; + return 1; } # If test needs cluster, check that master installed ok @@ -2486,7 +2466,7 @@ sub run_testcase ($) { { mtr_report_test_name($tinfo); mtr_report_test_failed($tinfo); - return; + return 1; } # If test needs slave cluster, check that it installed ok @@ -2495,9 +2475,40 @@ sub run_testcase ($) { { mtr_report_test_name($tinfo); mtr_report_test_failed($tinfo); - return; + return 1; } + return 0; +} + + + +############################################################################## +# +# Run a single test case +# +############################################################################## + +# When we get here, we have already filtered out test cases that doesn't +# apply to the current setup, for example if we use a running server, test +# cases that restart the server are dropped. So this function should mostly +# be about doing things, not a lot of logic. + +# We don't start and kill the servers for each testcase. But some +# testcases needs a restart, because they specify options to start +# mysqld with. After that testcase, we need to restart again, to set +# back the normal options. + +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); -- cgit v1.2.1 From f76c1536008bee12a46eb6fb65c3065936181240 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Aug 2006 09:53:49 +0200 Subject: Turn on reorder by default --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test') 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; -- cgit v1.2.1 From c3867a251b4881f5a04ee76b67a8771041bdf024 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Aug 2006 15:35:24 +0200 Subject: 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(-) (limited to 'mysql-test') 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); } # ---------------------------------------------------------------------- -- cgit v1.2.1 From 5ba4f53c64b5e7dbfb4205cc13b16e20ef35f3c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Aug 2006 10:18:55 +0200 Subject: 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(+) (limited to 'mysql-test') 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"; -- cgit v1.2.1 From abc4c3dc1d77cb801d9a13c9feb33bf970eeba3f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Aug 2006 10:28:48 +0200 Subject: 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(-) (limited to 'mysql-test') 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++ ) { -- cgit v1.2.1