Commit b16e67fd authored by Sergei Golubchik's avatar Sergei Golubchik

install and package plugin suites.

parent c2839e2c
...@@ -376,3 +376,27 @@ FUNCTION(INSTALL_DEBUG_TARGET target) ...@@ -376,3 +376,27 @@ FUNCTION(INSTALL_DEBUG_TARGET target)
ENDIF() ENDIF()
ENDFUNCTION() ENDFUNCTION()
FUNCTION(INSTALL_MYSQL_TEST from to)
IF(INSTALL_MYSQLTESTDIR)
INSTALL(
DIRECTORY ${from}
DESTINATION "${INSTALL_MYSQLTESTDIR}/${to}"
USE_SOURCE_PERMISSIONS
COMPONENT Test
PATTERN "var/" EXCLUDE
PATTERN "lib/My/SafeProcess" EXCLUDE
PATTERN "lib/t*" EXCLUDE
PATTERN "CPack" EXCLUDE
PATTERN "CMake*" EXCLUDE
PATTERN "mtr.out*" EXCLUDE
PATTERN ".cvsignore" EXCLUDE
PATTERN "*.am" EXCLUDE
PATTERN "*.in" EXCLUDE
PATTERN "*.vcxproj" EXCLUDE
PATTERN "*.vcxproj.filters" EXCLUDE
PATTERN "*.vcxproj.user" EXCLUDE
PATTERN "CTest" EXCLUDE
)
ENDIF()
ENDFUNCTION()
...@@ -27,23 +27,6 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) ...@@ -27,23 +27,6 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
# [LINK_LIBRARIES lib1...libN] # [LINK_LIBRARIES lib1...libN]
# [DEPENDENCIES target1...targetN] # [DEPENDENCIES target1...targetN]
# Append collections files for the plugin to the common files
# Make sure we don't copy twice if running cmake again
MACRO(PLUGIN_APPEND_COLLECTIONS plugin)
SET(fcopied "${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/FilesCopied")
IF(NOT EXISTS ${fcopied})
FILE(GLOB collections ${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/*)
FOREACH(cfile ${collections})
FILE(READ ${cfile} contents)
GET_FILENAME_COMPONENT(fname ${cfile} NAME)
FILE(APPEND ${CMAKE_SOURCE_DIR}/mysql-test/collections/${fname} "${contents}")
FILE(APPEND ${fcopied} "${fname}\n")
MESSAGE(STATUS "Appended ${cfile}")
ENDFOREACH()
ENDIF()
ENDMACRO()
MACRO(MYSQL_ADD_PLUGIN) MACRO(MYSQL_ADD_PLUGIN)
MYSQL_PARSE_ARGUMENTS(ARG MYSQL_PARSE_ARGUMENTS(ARG
"LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT" "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT"
...@@ -236,6 +219,11 @@ MACRO(MYSQL_ADD_PLUGIN) ...@@ -236,6 +219,11 @@ MACRO(MYSQL_ADD_PLUGIN)
TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES}) TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
ENDIF() ENDIF()
GET_FILENAME_COMPONENT(subpath ${CMAKE_CURRENT_SOURCE_DIR} NAME)
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mysql-test")
INSTALL_MYSQL_TEST("${CMAKE_CURRENT_SOURCE_DIR}/mysql-test/" "plugin/${subpath}")
ENDIF()
ENDMACRO() ENDMACRO()
......
...@@ -13,29 +13,7 @@ ...@@ -13,29 +13,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
IF(INSTALL_MYSQLTESTDIR) INSTALL_MYSQL_TEST("." ".")
INSTALL(
DIRECTORY .
DESTINATION ${INSTALL_MYSQLTESTDIR}
USE_SOURCE_PERMISSIONS
COMPONENT Test
PATTERN "var/" EXCLUDE
PATTERN "lib/My/SafeProcess" EXCLUDE
PATTERN "lib/t*" EXCLUDE
PATTERN "CPack" EXCLUDE
PATTERN "CMake*" EXCLUDE
PATTERN "mtr.out*" EXCLUDE
PATTERN ".cvsignore" EXCLUDE
PATTERN "*.am" EXCLUDE
PATTERN "*.in" EXCLUDE
PATTERN "*.vcxproj" EXCLUDE
PATTERN "*.vcxproj.filters" EXCLUDE
PATTERN "*.vcxproj.user" EXCLUDE
PATTERN "CTest" EXCLUDE
)
ENDIF()
IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
# Enable running mtr from build directory # Enable running mtr from build directory
......
...@@ -62,6 +62,21 @@ use My::Suite; ...@@ -62,6 +62,21 @@ use My::Suite;
require "mtr_misc.pl"; 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 # Precompiled regex's for tests to do or skip
my $do_test_reg; my $do_test_reg;
my $skip_test_reg; my $skip_test_reg;
...@@ -263,12 +278,11 @@ sub load_suite_object { ...@@ -263,12 +278,11 @@ sub load_suite_object {
# returns a pair of (suite, suitedir) # returns a pair of (suite, suitedir)
sub load_suite_for_file($) { sub suite_for_file($) {
my ($file) = @_; my ($file) = @_;
return load_suite_object($2, $1) return ($2, $1) if $file =~ m@^(.*/$plugin_suitedir_regex/(\w+))/@o;
if $file =~ m@^(.*/(?:storage|plugin)/\w+/mysql-test/(\w+))/@; return ($2, $1) if $file =~ m@^(.*/mysql-test/suite/(\w+))/@;
return load_suite_object($2, $1) if $file =~ m@^(.*/mysql-test/suite/(\w+))/@; return ('main', $1) if $file =~ m@^(.*/mysql-test)/@;
return load_suite_object('main', $1) if $file =~ m@^(.*/mysql-test)/@;
mtr_error("Cannot determine suite for $file"); mtr_error("Cannot determine suite for $file");
} }
...@@ -318,12 +332,12 @@ sub parse_disabled { ...@@ -318,12 +332,12 @@ sub parse_disabled {
# #
# load suite.pm files from plugin suites # load suite.pm files from plugin suites
# collect the list of default plugin suites. # collect the list of default plugin suites.
# XXX currently it does not support nested suites
# #
sub collect_default_suites(@) sub collect_default_suites(@)
{ {
my @dirs = my_find_dir(dirname($::glob_mysql_test_dir), my @dirs = my_find_dir(dirname($::glob_mysql_test_dir),
['storage/*/mysql-test/*', 'plugin/*/mysql-test/*'], [ @plugin_suitedirs ], '*');
[], NOT_REQUIRED);
for my $d (@dirs) { for my $d (@dirs) {
next unless -f "$d/suite.pm"; next unless -f "$d/suite.pm";
my $sname= basename($d); my $sname= basename($d);
...@@ -361,25 +375,22 @@ sub collect_suite_name($$) ...@@ -361,25 +375,22 @@ sub collect_suite_name($$)
else else
{ {
my @dirs = my_find_dir(dirname($::glob_mysql_test_dir), my @dirs = my_find_dir(dirname($::glob_mysql_test_dir),
["mysql-test/suite", ["mysql-test/suite", @plugin_suitedirs ],
"storage/*/mysql-test", $suitename);
"plugin/*/mysql-test"],
[$suitename]);
# #
# if $suitename contained wildcards, we'll have many suites and # if $suitename contained wildcards, we'll have many suites and
# their overlays here. Let's group them appropriately. # their overlays here. Let's group them appropriately.
# #
for (@dirs) { for (@dirs) {
m@^.*/mysql-test/(?:suite/)?(.*)$@ or confess $_; m@^.*/(?:mysql-test/suite|$plugin_suitedir_regex)/(.*)$@o or confess $_;
push @{$suites{$1}}, $_; push @{$suites{$1}}, $_;
} }
} }
} else { } else {
$suites{$suitename} = [ $::glob_mysql_test_dir, $suites{$suitename} = [ $::glob_mysql_test_dir,
my_find_dir(dirname($::glob_mysql_test_dir), my_find_dir(dirname($::glob_mysql_test_dir),
["storage/*/mysql-test", [ @plugin_suitedirs ],
"plugin/*/mysql-test"], 'main', NOT_REQUIRED) ];
['main'], NOT_REQUIRED) ];
} }
my @cases; my @cases;
...@@ -426,7 +437,7 @@ sub collect_one_suite { ...@@ -426,7 +437,7 @@ sub collect_one_suite {
local %file_combinations = (); local %file_combinations = ();
local %file_in_overlay = (); 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); next unless defined $over and ($over eq '' or $over eq $1);
push @cases, push @cases,
# don't add cases that take *all* data from the parent suite # don't add cases that take *all* data from the parent suite
...@@ -1072,7 +1083,7 @@ sub get_tags_from_file($$) { ...@@ -1072,7 +1083,7 @@ sub get_tags_from_file($$) {
# for combinations we need to make sure that its suite object is loaded, # for combinations we need to make sure that its suite object is loaded,
# even if this file does not belong to a current suite! # even if this file does not belong to a current suite!
my $comb_file = "$suffix.combinations"; 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; my @comb;
unless ($suite->{skip}) { unless ($suite->{skip}) {
my $from = "$prefix[0]$comb_file"; my $from = "$prefix[0]$comb_file";
......
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