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)
ENDIF()
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)
# [LINK_LIBRARIES lib1...libN]
# [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)
MYSQL_PARSE_ARGUMENTS(ARG
"LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT"
......@@ -236,6 +219,11 @@ MACRO(MYSQL_ADD_PLUGIN)
TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
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()
......
......@@ -13,29 +13,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
IF(INSTALL_MYSQLTESTDIR)
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()
INSTALL_MYSQL_TEST("." ".")
IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
# Enable running mtr from build directory
......
......@@ -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");
}
......@@ -318,12 +332,12 @@ 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),
['storage/*/mysql-test/*', 'plugin/*/mysql-test/*'],
[], NOT_REQUIRED);
[ @plugin_suitedirs ], '*');
for my $d (@dirs) {
next unless -f "$d/suite.pm";
my $sname= basename($d);
......@@ -361,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;
......@@ -426,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
......@@ -1072,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";
......
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