summaryrefslogtreecommitdiff
path: root/mysql-test/lib/mtr_cases.pm
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/lib/mtr_cases.pm')
-rw-r--r--mysql-test/lib/mtr_cases.pm40
1 files changed, 25 insertions, 15 deletions
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index 631a5d8c348..5b091193bff 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -1,6 +1,6 @@
# -*- cperl -*-
-# Copyright (C) 2005-2006 MySQL AB
-#
+# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
@@ -130,7 +130,7 @@ sub collect_test_cases ($$$$) {
{
last unless $opt_reorder;
# test->{name} is always in suite.name format
- if ( $test->{name} =~ /.*\.$tname/ )
+ if ( $test->{name} =~ /^$sname.*\.$tname$/ )
{
$found= 1;
last;
@@ -157,8 +157,6 @@ sub collect_test_cases ($$$$) {
if ( $opt_reorder && !$quick_collect)
{
# Reorder the test cases in an order that will make them faster to run
- my %sort_criteria;
-
# 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, etc.
@@ -170,24 +168,31 @@ sub collect_test_cases ($$$$) {
# Append the criteria for sorting, in order of importance.
#
push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "A" : "B"));
+ push(@criteria, $tinfo->{template_path});
# Group test with equal options together.
# Ending with "~" makes empty sort later than filled
my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : [];
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");
- $sort_criteria{$tinfo->fullname()} = join(" ", @criteria);
+ $tinfo->{criteria}= join(" ", @criteria);
}
- @$cases = sort {
- $sort_criteria{$a->fullname()} . $a->fullname() cmp
- $sort_criteria{$b->fullname()} . $b->fullname() } @$cases;
+ @$cases = sort {$a->{criteria} cmp $b->{criteria}; } @$cases;
# For debugging the sort-order
# foreach my $tinfo (@$cases)
# {
- # print $sort_criteria{$tinfo->fullname()}," -> \t",$tinfo->fullname(),"\n";
+ # my $tname= $tinfo->{name} . ' ' . $tinfo->{combination};
+ # my $crit= $tinfo->{criteria};
+ # print("$tname\n\t$crit\n");
# }
-
}
if (defined $print_testcases){
@@ -204,8 +209,11 @@ sub collect_test_cases ($$$$) {
sub split_testname {
my ($test_name)= @_;
- # Get rid of directory part and split name on .'s
- my @parts= split(/\./, basename($test_name));
+ # If .test file name is used, get rid of directory part
+ $test_name= basename($test_name) if $test_name =~ /\.test$/;
+
+ # Now split name on .'s
+ my @parts= split(/\./, $test_name);
if (@parts == 1){
# Only testname given, ex: alias
@@ -259,9 +267,11 @@ sub collect_one_suite
"mysql-test/suite",
"mysql-test",
# Look in storage engine specific suite dirs
- "storage/*/mysql-test-suites"
+ "storage/*/mtr",
+ # Look in plugin specific suite dir
+ "plugin/$suite/tests",
],
- [$suite]);
+ [$suite, "mtr"]);
}
mtr_verbose("suitedir: $suitedir");
}