Commit b6707f8c authored by unknown's avatar unknown
Browse files

Break out and create new function 'run_testcase_check_skip_test'

parent ae705221
Loading
Loading
Loading
Loading
+40 −29
Original line number Diff line number Diff line
@@ -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);