Commit e06c1c70 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup

parent 39b1dbc4
...@@ -30,7 +30,6 @@ use mtr_match; ...@@ -30,7 +30,6 @@ use mtr_match;
# Options used for the collect phase # Options used for the collect phase
our $start_from; our $start_from;
our $print_testcases;
our $skip_rpl; our $skip_rpl;
our $do_test; our $do_test;
our $skip_test; our $skip_test;
...@@ -86,21 +85,6 @@ sub init_pattern { ...@@ -86,21 +85,6 @@ sub init_pattern {
} }
sub testcase_sort_order {
my ($a, $b, $sort_criteria)= @_;
# Run slow tests first, trying to avoid getting stuck at the end
# with a slow test in one worker and the other workers idle.
return -1 if $a->{'long_test'} && !$b->{'long_test'};
return 1 if !$a->{'long_test'} && $b->{'long_test'};
my $a_sort_criteria= $sort_criteria->{$a->fullname()};
my $b_sort_criteria= $sort_criteria->{$b->fullname()};
my $res= $a_sort_criteria cmp $b_sort_criteria;
return $res if $res;
return $a->fullname() cmp $b->fullname();
}
############################################################################## ##############################################################################
# #
# Collect information about test cases to be run # Collect information about test cases to be run
...@@ -180,42 +164,22 @@ sub collect_test_cases ($$$$) { ...@@ -180,42 +164,22 @@ sub collect_test_cases ($$$$) {
# #
# Append the criteria for sorting, in order of importance. # Append the criteria for sorting, in order of importance.
# #
push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "A" : "B")); push @criteria, ($tinfo->{'long_test'} ? "long" : "short");
push(@criteria, $tinfo->{template_path}); push(@criteria, $tinfo->{template_path});
# Group test with equal options together. for (qw(master_opt slave_opt)) {
# Ending with "~" makes empty sort later than filled # Group test with equal options together.
my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : []; # Ending with "~" makes empty sort later than filled
push(@criteria, join("!", sort @{$opts}) . "~"); my $opts= $tinfo->{$_} ? $tinfo->{$_} : [];
# Add slave opts if any push(@criteria, join("!", sort @{$opts}) . "~");
if ($tinfo->{'slave_opt'})
{
push(@criteria, join("!", sort @{$tinfo->{'slave_opt'}}));
} }
# This sorts tests with force-restart *before* identical tests push @criteria, $tinfo->{name};
push(@criteria, $tinfo->{force_restart} ? "force-restart" : "no-restart");
$tinfo->{criteria}= join(" ", @criteria); $tinfo->{criteria}= join(" ", @criteria);
$sort_criteria{$tinfo->fullname()} = $tinfo->{criteria};
} }
@$cases = sort { testcase_sort_order($a, $b, \%sort_criteria) } @$cases; @$cases = sort { $a->{criteria} cmp $b->{criteria} } @$cases;
# For debugging the sort-order
# foreach my $tinfo (@$cases)
# {
# my $tname= $tinfo->{name} . ' ' . $tinfo->{combination};
# my $crit= $tinfo->{criteria};
# print("$tname\n\t$crit\n");
# }
}
if (defined $print_testcases){
print_testcases(@$cases);
exit(1);
} }
return $cases; return $cases;
} }
...@@ -462,7 +426,6 @@ sub collect_one_suite ...@@ -462,7 +426,6 @@ sub collect_one_suite
if (@combinations) if (@combinations)
{ {
print " - adding combinations for $suite\n"; print " - adding combinations for $suite\n";
#print_testcases(@cases);
my @new_cases; my @new_cases;
TEST: foreach my $test (@cases) TEST: foreach my $test (@cases)
...@@ -513,14 +476,11 @@ sub collect_one_suite ...@@ -513,14 +476,11 @@ sub collect_one_suite
} }
} }
#print_testcases(@new_cases);
@cases= @new_cases; @cases= @new_cases;
#print_testcases(@cases);
} }
} }
optimize_cases(\@cases); optimize_cases(\@cases);
#print_testcases(@cases);
return @cases; return @cases;
} }
...@@ -681,30 +641,6 @@ sub collect_one_test_case { ...@@ -681,30 +641,6 @@ sub collect_one_test_case {
my $local_default_storage_engine= $default_storage_engine; my $local_default_storage_engine= $default_storage_engine;
#print "collect_one_test_case\n";
#print " suitedir: $suitedir\n";
#print " testdir: $testdir\n";
#print " resdir: $resdir\n";
#print " suitename: $suitename\n";
#print " tname: $tname\n";
#print " filename: $filename\n";
# ----------------------------------------------------------------------
# Check --start-from
# ----------------------------------------------------------------------
if ( $start_from && 0)
{
# start_from can be specified as [suite.].testname_prefix
my ($suite, $test)= split_testname($start_from);
if ( $suite and $suitename lt $suite){
return; # Skip silently
}
if ((!$suite || $suitename == $suite) && $tname lt $test ){
return; # Skip silently
}
}
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Set defaults # Set defaults
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
...@@ -1131,16 +1067,5 @@ sub opts_from_file ($) { ...@@ -1131,16 +1067,5 @@ sub opts_from_file ($) {
return @args; return @args;
} }
sub print_testcases {
my (@cases)= @_;
print "=" x 60, "\n";
foreach my $test (@cases){
$test->print_test();
}
print "=" x 60, "\n";
}
1; 1;
...@@ -554,13 +554,6 @@ sub main { ...@@ -554,13 +554,6 @@ sub main {
if ( @$completed != $num_tests){ if ( @$completed != $num_tests){
if ($opt_force){
# All test should have been run, print any that are still in $tests
#foreach my $test ( @$tests ){
# $test->print_test();
#}
}
# Not all tests completed, failure # Not all tests completed, failure
mtr_report(); mtr_report();
mtr_report("Only ", int(@$completed), " of $num_tests completed."); mtr_report("Only ", int(@$completed), " of $num_tests completed.");
...@@ -669,7 +662,6 @@ sub run_test_server ($$$) { ...@@ -669,7 +662,6 @@ sub run_test_server ($$$) {
if ($line eq 'TESTRESULT'){ if ($line eq 'TESTRESULT'){
$result= My::Test::read_test($sock); $result= My::Test::read_test($sock);
# $result->print_test();
# Report test status # Report test status
mtr_report_test($result); mtr_report_test($result);
...@@ -871,8 +863,6 @@ sub run_test_server ($$$) { ...@@ -871,8 +863,6 @@ sub run_test_server ($$$) {
next if (defined $t->{reserved} and $t->{reserved} != $wid); next if (defined $t->{reserved} and $t->{reserved} != $wid);
if (! defined $t->{reserved}) if (! defined $t->{reserved})
{ {
# Force-restart not relevant when comparing *next* test
$t->{criteria} =~ s/force-restart$/no-restart/;
my $criteria= $t->{criteria}; my $criteria= $t->{criteria};
# Reserve similar tests for this worker, but not too many # Reserve similar tests for this worker, but not too many
my $maxres= (@$tests - $i) / $opt_parallel + 1; my $maxres= (@$tests - $i) / $opt_parallel + 1;
...@@ -981,7 +971,6 @@ sub run_worker ($) { ...@@ -981,7 +971,6 @@ sub run_worker ($) {
chomp($line); chomp($line);
if ($line eq 'TESTCASE'){ if ($line eq 'TESTCASE'){
my $test= My::Test::read_test($server); my $test= My::Test::read_test($server);
#$test->print_test();
# Clear comment and logfile, to avoid # Clear comment and logfile, to avoid
# reusing them from previous test # reusing them from previous test
...@@ -998,7 +987,6 @@ sub run_worker ($) { ...@@ -998,7 +987,6 @@ sub run_worker ($) {
run_testcase($test, $server); run_testcase($test, $server);
#$test->{result}= 'MTR_RES_PASSED'; #$test->{result}= 'MTR_RES_PASSED';
# Send it back, now with results set # Send it back, now with results set
#$test->print_test();
$test->write_test($server, 'TESTRESULT'); $test->write_test($server, 'TESTRESULT');
mark_time_used('restart'); mark_time_used('restart');
} }
...@@ -5542,11 +5530,6 @@ sub server_need_restart { ...@@ -5542,11 +5530,6 @@ sub server_need_restart {
return 0; return 0;
} }
if ( $tinfo->{'force_restart'} ) {
mtr_verbose_restart($server, "forced in .opt file");
return 1;
}
if ( $opt_force_restart ) { if ( $opt_force_restart ) {
mtr_verbose_restart($server, "forced restart turned on"); mtr_verbose_restart($server, "forced restart turned on");
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment