diff options
Diffstat (limited to 'mysql-test/mysql-test-run.pl')
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 71 |
1 files changed, 57 insertions, 14 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 711185e9453..1557170f3cf 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -111,12 +111,24 @@ my $path_vardir_trace; # unix formatted opt_vardir for trace files my $opt_tmpdir; # Path to use for tmp/ dir my $opt_tmpdir_pid; +my $opt_start; +my $opt_start_dirty; +my $opt_start_exit; +my $start_only; + END { if ( defined $opt_tmpdir_pid and $opt_tmpdir_pid == $$ ) { - # Remove the tempdir this process has created - mtr_verbose("Removing tmpdir '$opt_tmpdir"); - rmtree($opt_tmpdir); + if (!$opt_start_exit) + { + # Remove the tempdir this process has created + mtr_verbose("Removing tmpdir $opt_tmpdir"); + rmtree($opt_tmpdir); + } + else + { + mtr_warning("tmpdir $opt_tmpdir should be removed after the server has finished"); + } } } @@ -216,20 +228,16 @@ my $opt_suite_timeout = $ENV{MTR_SUITE_TIMEOUT} || 360; # minutes my $opt_shutdown_timeout= $ENV{MTR_SHUTDOWN_TIMEOUT} || 10; # seconds my $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds -sub testcase_timeout { return $opt_testcase_timeout * 60; }; sub suite_timeout { return $opt_suite_timeout * 60; }; sub check_timeout { return $opt_testcase_timeout * 6; }; -my $opt_start; -my $opt_start_dirty; -my $opt_start_exit; -my $start_only; my $opt_wait_all; my $opt_user_args; my $opt_repeat= 1; my $opt_retry= 1; my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2); my $opt_reorder= 1; +my $opt_force_restart= 0; my $opt_strace_client; @@ -247,9 +255,21 @@ my $opt_callgrind; my %mysqld_logs; my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions. +sub testcase_timeout ($) { + my ($tinfo)= @_; + if (exists $tinfo->{'case-timeout'}) { + # Return test specific timeout if *longer* that the general timeout + my $test_to= $tinfo->{'case-timeout'}; + $test_to*= 10 if $opt_valgrind; + return $test_to * 60 if $test_to > $opt_testcase_timeout; + } + return $opt_testcase_timeout * 60; +} + our $opt_warnings= 1; -our $opt_skip_ndbcluster= 0; +our $opt_include_ndbcluster= 0; +our $opt_skip_ndbcluster= 1; my $exe_ndbd; my $exe_ndb_mgmd; @@ -903,6 +923,7 @@ sub command_line_setup { # Control what test suites or cases to run 'force' => \$opt_force, 'with-ndbcluster-only' => \&collect_option, + 'include-ndbcluster' => \$opt_include_ndbcluster, 'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster, 'suite|suites=s' => \$opt_suites, 'skip-rpl' => \&collect_option, @@ -986,6 +1007,7 @@ sub command_line_setup { 'report-features' => \$opt_report_features, 'comment=s' => \$opt_comment, 'fast' => \$opt_fast, + 'force-restart' => \$opt_force_restart, 'reorder!' => \$opt_reorder, 'enable-disabled' => \&collect_option, 'verbose+' => \$opt_verbose, @@ -2181,6 +2203,12 @@ sub environment_setup { # Create an environment variable to make it possible # to detect that valgrind is being used from test cases $ENV{'VALGRIND_TEST'}= $opt_valgrind; + + # Add dir of this perl to aid mysqltest in finding perl + my $perldir= dirname($^X); + my $pathsep= ":"; + $pathsep= ";" if IS_WINDOWS && ! IS_CYGWIN; + $ENV{'PATH'}= "$ENV{'PATH'}".$pathsep.$perldir; } @@ -2505,6 +2533,11 @@ sub fix_vs_config_dir () { sub check_ndbcluster_support ($) { my $mysqld_variables= shift; + if ($opt_include_ndbcluster) + { + $opt_skip_ndbcluster= 0; + } + if ($opt_skip_ndbcluster) { mtr_report(" - skipping ndbcluster"); @@ -3844,7 +3877,7 @@ sub run_testcase ($$) { } } - my $test_timeout= start_timer(testcase_timeout()); + my $test_timeout= start_timer(testcase_timeout($tinfo)); do_before_run_mysqltest($tinfo); @@ -3949,6 +3982,9 @@ sub run_testcase ($$) { # Try to get reason from test log file find_testcase_skipped_reason($tinfo); mtr_report_test_skipped($tinfo); + # Restart if skipped due to missing perl, it may have had side effects + stop_all_servers($opt_shutdown_timeout) + if ($tinfo->{'comment'} =~ /^perl not found/); } elsif ( $res == 65 ) { @@ -4055,7 +4091,7 @@ sub run_testcase ($$) { { my $log_file_name= $opt_vardir."/log/".$tinfo->{shortname}.".log"; $tinfo->{comment}= - "Test case timeout after ".testcase_timeout(). + "Test case timeout after ".testcase_timeout($tinfo). " seconds\n\n"; # Add 20 last executed commands from test case log file if (-e $log_file_name) @@ -4064,7 +4100,7 @@ sub run_testcase ($$) { "== $log_file_name == \n". mtr_lastlinesfromfile($log_file_name, 20)."\n"; } - $tinfo->{'timeout'}= testcase_timeout(); # Mark as timeout + $tinfo->{'timeout'}= testcase_timeout($tinfo); # Mark as timeout run_on_all($tinfo, 'analyze-timeout'); report_failure_and_restart($tinfo); @@ -5020,6 +5056,11 @@ sub server_need_restart { return 1; } + if ( $opt_force_restart ) { + mtr_verbose_restart($server, "forced restart turned on"); + return 1; + } + if ( $tinfo->{template_path} ne $current_config_name) { mtr_verbose_restart($server, "using different config file"); @@ -5726,7 +5767,8 @@ Options to control what test suites or cases to run force Continue to run the suite after failure with-ndbcluster-only Run only tests that include "ndb" in the filename - skip-ndb[cluster] Skip all tests that need cluster + skip-ndb[cluster] Skip all tests that need cluster. Default. + include-ndb[cluster] Enable all tests that need cluster do-test=PREFIX or REGEX Run test cases which name are prefixed with PREFIX or fulfills REGEX @@ -5850,7 +5892,8 @@ Misc options servers to exit before finishing the process fast Run as fast as possible, dont't wait for servers to shutdown etc. - parallel=N Run tests in N parallel threads (default 1) + force-restart Always restart servers between tests + parallel=N Run tests in N parallel threads (default=1) Use parallel=auto for auto-setting of N repeat=N Run each test N number of times retry=N Retry tests that fail up to N times (default $opt_retry). |