Commit e06c1c70 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup

parent 39b1dbc4
......@@ -30,7 +30,6 @@ use mtr_match;
# Options used for the collect phase
our $start_from;
our $print_testcases;
our $skip_rpl;
our $do_test;
our $skip_test;
......@@ -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
......@@ -180,42 +164,22 @@ sub collect_test_cases ($$$$) {
#
# 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});
for (qw(master_opt slave_opt)) {
# Group test with equal options together.
# Ending with "~" makes empty sort later than filled
my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : [];
my $opts= $tinfo->{$_} ? $tinfo->{$_} : [];
push(@criteria, join("!", sort @{$opts}) . "~");
# Add slave opts if any
if ($tinfo->{'slave_opt'})
{
push(@criteria, join("!", sort @{$tinfo->{'slave_opt'}}));
}
# This sorts tests with force-restart *before* identical tests
push(@criteria, $tinfo->{force_restart} ? "force-restart" : "no-restart");
push @criteria, $tinfo->{name};
$tinfo->{criteria}= join(" ", @criteria);
$sort_criteria{$tinfo->fullname()} = $tinfo->{criteria};
}
@$cases = sort { testcase_sort_order($a, $b, \%sort_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);
@$cases = sort { $a->{criteria} cmp $b->{criteria} } @$cases;
}
return $cases;
}
......@@ -462,7 +426,6 @@ sub collect_one_suite
if (@combinations)
{
print " - adding combinations for $suite\n";
#print_testcases(@cases);
my @new_cases;
TEST: foreach my $test (@cases)
......@@ -513,14 +476,11 @@ sub collect_one_suite
}
}
#print_testcases(@new_cases);
@cases= @new_cases;
#print_testcases(@cases);
}
}
optimize_cases(\@cases);
#print_testcases(@cases);
return @cases;
}
......@@ -681,30 +641,6 @@ sub collect_one_test_case {
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
# ----------------------------------------------------------------------
......@@ -1131,16 +1067,5 @@ sub opts_from_file ($) {
return @args;
}
sub print_testcases {
my (@cases)= @_;
print "=" x 60, "\n";
foreach my $test (@cases){
$test->print_test();
}
print "=" x 60, "\n";
}
1;
......@@ -554,13 +554,6 @@ sub main {
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
mtr_report();
mtr_report("Only ", int(@$completed), " of $num_tests completed.");
......@@ -669,7 +662,6 @@ sub run_test_server ($$$) {
if ($line eq 'TESTRESULT'){
$result= My::Test::read_test($sock);
# $result->print_test();
# Report test status
mtr_report_test($result);
......@@ -871,8 +863,6 @@ sub run_test_server ($$$) {
next if (defined $t->{reserved} and $t->{reserved} != $wid);
if (! defined $t->{reserved})
{
# Force-restart not relevant when comparing *next* test
$t->{criteria} =~ s/force-restart$/no-restart/;
my $criteria= $t->{criteria};
# Reserve similar tests for this worker, but not too many
my $maxres= (@$tests - $i) / $opt_parallel + 1;
......@@ -981,7 +971,6 @@ sub run_worker ($) {
chomp($line);
if ($line eq 'TESTCASE'){
my $test= My::Test::read_test($server);
#$test->print_test();
# Clear comment and logfile, to avoid
# reusing them from previous test
......@@ -998,7 +987,6 @@ sub run_worker ($) {
run_testcase($test, $server);
#$test->{result}= 'MTR_RES_PASSED';
# Send it back, now with results set
#$test->print_test();
$test->write_test($server, 'TESTRESULT');
mark_time_used('restart');
}
......@@ -5542,11 +5530,6 @@ sub server_need_restart {
return 0;
}
if ( $tinfo->{'force_restart'} ) {
mtr_verbose_restart($server, "forced in .opt file");
return 1;
}
if ( $opt_force_restart ) {
mtr_verbose_restart($server, "forced restart turned on");
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