diff options
author | cmiller@maint1.mysql.com <> | 2006-09-01 21:58:07 +0200 |
---|---|---|
committer | cmiller@maint1.mysql.com <> | 2006-09-01 21:58:07 +0200 |
commit | ba0df1ca7eff9699e326fbd439f8ee06c59dd7ce (patch) | |
tree | 9eab9193eceb2fac6ad9873cf08e8545b3d9e8cd | |
parent | ba7035ab55adc834a507af353b2c5de9246a0d09 (diff) | |
parent | 8cacf3f54cd1afeffaac6cd05d52700e1ca197d3 (diff) | |
download | mariadb-git-ba0df1ca7eff9699e326fbd439f8ee06c59dd7ce.tar.gz |
Merge maint1.mysql.com:/data/localhome/cmiller/mtr_reorder/my51-mtr_reorder
into maint1.mysql.com:/data/localhome/cmiller/mysql-5.1-maint
-rw-r--r-- | mysql-test/lib/mtr_cases.pl | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index daed111dfce..cfd07abb9e0 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -102,7 +102,7 @@ sub collect_test_cases ($) { if ( $mysqld_test_exists and $im_test_exists ) { - mtr_error("Ambiguos test case name ($tname)"); + mtr_error("Ambiguous test case name ($tname)"); } elsif ( ! $mysqld_test_exists and ! $im_test_exists ) { @@ -157,34 +157,38 @@ sub collect_test_cases ($) { if ( $::opt_reorder ) { - @$cases = sort { - if ( ! $a->{'master_restart'} and ! $b->{'master_restart'} ) - { - return $a->{'name'} cmp $b->{'name'}; - } - if ( $a->{'master_restart'} and $b->{'master_restart'} ) - { - my $cmp= mtr_cmp_opts($a->{'master_opt'}, $b->{'master_opt'}); - if ( $cmp == 0 ) - { - return $a->{'name'} cmp $b->{'name'}; - } - else - { - return $cmp; - } - } + my %sort_criteria; + my $tinfo; - if ( $a->{'master_restart'} ) - { - return 1; # Is greater - } - else - { - return -1; # Is less - } - } @$cases; + # Make a mapping of test name to a string that represents how that test + # should be sorted among the other tests. Put the most important criterion + # first, then a sub-criterion, then sub-sub-criterion, et c. + foreach $tinfo (@$cases) + { + my @this_criteria = (); + + # Append the criteria for sorting, in order of importance. + push(@this_criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~"); # Ending with "~" makes empty sort later than filled + push(@this_criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0")); + push(@this_criteria, "restart=" . ($tinfo->{'master_restart'} ? "1" : "0")); + push(@this_criteria, "big_test=" . ($tinfo->{'big_test'} ? "1" : "0")); + push(@this_criteria, join("|", sort keys %{$tinfo})); # Group similar things together. The values may differ substantially. FIXME? + push(@this_criteria, $tinfo->{'name'}); # Finally, order by the name + + $sort_criteria{$tinfo->{"name"}} = join(" ", @this_criteria); + } + + @$cases = sort { $sort_criteria{$a->{"name"}} cmp $sort_criteria{$b->{"name"}}; } @$cases; + +### For debugging the sort-order +# foreach $tinfo (@$cases) +# { +# print $sort_criteria{$tinfo->{"name"}}; +# print " -> \t"; +# print $tinfo->{"name"}; +# print "\n"; +# } } return $cases; |