summaryrefslogtreecommitdiff
path: root/mysql-test/lib
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-12-15 15:57:26 +0100
committerSergei Golubchik <sergii@pisem.net>2013-12-15 15:57:26 +0100
commit6bf10fac445d73fb796d4863612c87bff5f28b66 (patch)
tree4d51e193684163c21e47e9de6536cd8dae0613eb /mysql-test/lib
parent8efaff4959efe32ff9bc47c1bf1710cfe9ab21b5 (diff)
parent39a8d7965d912d8fb32436735449ce04e85583d1 (diff)
downloadmariadb-git-6bf10fac445d73fb796d4863612c87bff5f28b66.tar.gz
5.5 merge
Diffstat (limited to 'mysql-test/lib')
-rw-r--r--mysql-test/lib/My/Suite.pm1
-rw-r--r--mysql-test/lib/mtr_cases.pm67
2 files changed, 51 insertions, 17 deletions
diff --git a/mysql-test/lib/My/Suite.pm b/mysql-test/lib/My/Suite.pm
index b5870ea1e16..a603008fabe 100644
--- a/mysql-test/lib/My/Suite.pm
+++ b/mysql-test/lib/My/Suite.pm
@@ -3,6 +3,7 @@
package My::Suite;
+sub is_default { 0 }
sub config_files { () }
sub servers { () }
sub skip_combinations { () }
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index 1327afdb426..870df115f58 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -23,7 +23,7 @@ package mtr_cases;
use strict;
use base qw(Exporter);
-our @EXPORT= qw(collect_option collect_test_cases);
+our @EXPORT= qw(collect_option collect_test_cases collect_default_suites);
use Carp;
@@ -62,6 +62,21 @@ use My::Suite;
require "mtr_misc.pl";
+# locate plugin suites, depending on whether it's a build tree or installed
+my @plugin_suitedirs;
+my $plugin_suitedir_regex;
+my $overlay_regex;
+
+if (-d '../sql') {
+ @plugin_suitedirs= ('storage/*/mysql-test', 'plugin/*/mysql-test');
+ $overlay_regex= '\b(?:storage|plugin)/(\w+)/mysql-test\b';
+} else {
+ @plugin_suitedirs= ('mysql-test/plugin/*');
+ $overlay_regex= '\bmysql-test/plugin/(\w+)\b';
+}
+$plugin_suitedir_regex= $overlay_regex;
+$plugin_suitedir_regex=~ s/\Q(\w+)\E/\\w+/;
+
# Precompiled regex's for tests to do or skip
my $do_test_reg;
my $skip_test_reg;
@@ -263,12 +278,11 @@ sub load_suite_object {
# returns a pair of (suite, suitedir)
-sub load_suite_for_file($) {
+sub suite_for_file($) {
my ($file) = @_;
- return load_suite_object($2, $1)
- if $file =~ m@^(.*/(?:storage|plugin)/\w+/mysql-test/(\w+))/@;
- return load_suite_object($2, $1) if $file =~ m@^(.*/mysql-test/suite/(\w+))/@;
- return load_suite_object('main', $1) if $file =~ m@^(.*/mysql-test)/@;
+ return ($2, $1) if $file =~ m@^(.*/$plugin_suitedir_regex/(\w+))/@o;
+ return ($2, $1) if $file =~ m@^(.*/mysql-test/suite/(\w+))/@;
+ return ('main', $1) if $file =~ m@^(.*/mysql-test)/@;
mtr_error("Cannot determine suite for $file");
}
@@ -316,10 +330,32 @@ sub parse_disabled {
}
#
+# load suite.pm files from plugin suites
+# collect the list of default plugin suites.
+# XXX currently it does not support nested suites
+#
+sub collect_default_suites(@)
+{
+ my @dirs = my_find_dir(dirname($::glob_mysql_test_dir),
+ [ @plugin_suitedirs ], '*');
+ for my $d (@dirs) {
+ next unless -f "$d/suite.pm";
+ my $sname= basename($d);
+ # ignore overlays here, otherwise we'd need accurate
+ # duplicate detection with overlay support for the default suite list
+ next if $sname eq 'main' or -d "$::glob_mysql_test_dir/suite/$sname";
+ my $s = load_suite_object($sname, $d);
+ push @_, $sname if $s->is_default();
+ }
+ return @_;
+}
+
+
+#
# processes one user-specified suite name.
# it could contain wildcards, e.g engines/*
#
-sub collect_suite_name
+sub collect_suite_name($$)
{
my $suitename= shift; # Test suite name
my $opt_cases= shift;
@@ -339,25 +375,22 @@ sub collect_suite_name
else
{
my @dirs = my_find_dir(dirname($::glob_mysql_test_dir),
- ["mysql-test/suite",
- "storage/*/mysql-test",
- "plugin/*/mysql-test"],
- [$suitename]);
+ ["mysql-test/suite", @plugin_suitedirs ],
+ $suitename);
#
# if $suitename contained wildcards, we'll have many suites and
# their overlays here. Let's group them appropriately.
#
for (@dirs) {
- m@^.*/mysql-test/(?:suite/)?(.*)$@ or confess $_;
+ m@^.*/(?:mysql-test/suite|$plugin_suitedir_regex)/(.*)$@o or confess $_;
push @{$suites{$1}}, $_;
}
}
} else {
$suites{$suitename} = [ $::glob_mysql_test_dir,
my_find_dir(dirname($::glob_mysql_test_dir),
- ["storage/*/mysql-test",
- "plugin/*/mysql-test"],
- ['main'], NOT_REQUIRED) ];
+ [ @plugin_suitedirs ],
+ 'main', NOT_REQUIRED) ];
}
my @cases;
@@ -404,7 +437,7 @@ sub collect_one_suite {
local %file_combinations = ();
local %file_in_overlay = ();
- confess $_ unless m@/(?:storage|plugin)/(\w+)/mysql-test/[\w/]*\w$@;
+ confess $_ unless m@/$overlay_regex/@o;
next unless defined $over and ($over eq '' or $over eq $1);
push @cases,
# don't add cases that take *all* data from the parent suite
@@ -1050,7 +1083,7 @@ sub get_tags_from_file($$) {
# for combinations we need to make sure that its suite object is loaded,
# even if this file does not belong to a current suite!
my $comb_file = "$suffix.combinations";
- $suite = load_suite_for_file($comb_file) if $prefix[0] eq '';
+ $suite = load_suite_object(suite_for_file($comb_file)) if $prefix[0] eq '';
my @comb;
unless ($suite->{skip}) {
my $from = "$prefix[0]$comb_file";