Skip to content

Commit e2df423

Browse files
committed
Bug#23151414 - MOVE X PLUGIN TESTS TO RAPID/PLUGIN/X/TEST
Description: X Plugin is located in optional directory, still its tests are located in mysql-test/suite/xplugin. This suite should also be optional. Solution: Test suite was moved to rapid/plugin/x/tests/mtr/*. Right now X Plugin needs to call INSTALL command in CMakeFile.txt (simillar like internal plugins do) for its suite. RB: 12602 Reviewed-by: Bjorn Munch <[email protected]> Reviewed-by: Sayantan Dutta <[email protected]> Reviewed-by: Andrzej Religa <[email protected]>
1 parent 3261952 commit e2df423

File tree

399 files changed

+288
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

399 files changed

+288
-221
lines changed

mysql-test/include/plugin.defs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ test_udf_services plugin/udf_services TESTUDFSERVICES
5959
group_replication plugin/group_replication GROUP_REPLICATION
6060
locking_service sql LOCKING_SERVICE
6161
version_token plugin/version_token VERSION_TOKEN
62-
mysqlx plugin/x MYSQLXPLUGIN
6362
# Test services framework
6463
libtest_services plugin/test_services TESTSERVICES
6564
libtest_services_threaded plugin/test_services TESTSERVICESTHREADED

mysql-test/lib/mtr_cases.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ sub collect_one_suite($)
296296
# Look in plugin specific suite dir
297297
"plugin/$suite/tests",
298298
"internal/plugin/$suite/tests",
299+
"rapid/plugin/$suite/tests",
300+
"rapid/mysql-test/suite",
299301
],
300302
[$suite, "mtr"], ($suite =~ /^i_/));
301303
return unless $suitedir;

mysql-test/mysql-test-run.pl

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ END
164164

165165
# If you add a new suite, please check TEST_DIRS in Makefile.am.
166166
#
167-
my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,gis,rpl,innodb,innodb_gis,innodb_fts,innodb_zip,innodb_undo,perfschema,funcs_1,opt_trace,parts,auth_sec,query_rewrite_plugins,gcol,sysschema,test_service_sql_api,xplugin";
167+
my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,gis,rpl,innodb,innodb_gis,innodb_fts,innodb_zip,innodb_undo,perfschema,funcs_1,opt_trace,parts,auth_sec,query_rewrite_plugins,gcol,sysschema,test_service_sql_api";
168168
my $opt_suites;
169169

170170
our $opt_verbose= 0; # Verbose output, enable with --verbose
@@ -259,6 +259,8 @@ END
259259

260260
my $baseport;
261261
my $mysqlx_baseport;
262+
263+
my $opt_mysqlx_baseport = $ENV{'MYSQLXPLUGIN_PORT'} || "auto";
262264
# $opt_build_thread may later be set from $opt_port_base
263265
my $opt_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
264266
my $opt_port_base= $ENV{'MTR_PORT_BASE'} || "auto";
@@ -432,8 +434,9 @@ sub main {
432434
}
433435
$ENV{MTR_PARALLEL} = $opt_parallel;
434436

435-
if ($opt_parallel > 1 && ($opt_start_exit || $opt_stress)) {
436-
mtr_warning("Parallel cannot be used with --start-and-exit or --stress\n" .
437+
my $is_option_mysqlx_port_set= $opt_mysqlx_baseport ne "auto";
438+
if ($opt_parallel > 1 && ($opt_start_exit || $opt_stress || $is_option_mysqlx_port_set)) {
439+
mtr_warning("Parallel cannot be used neither with --start-and-exit nor --stress nor --mysqlx_port\n" .
437440
"Setting parallel to 1");
438441
$opt_parallel= 1;
439442
}
@@ -465,6 +468,7 @@ sub main {
465468
# Also read from any plugin local or suite specific plugin.defs
466469
for (glob "$basedir/plugin/*/tests/mtr/plugin.defs".
467470
" $basedir/internal/plugin/*/tests/mtr/plugin.defs".
471+
" $basedir/rapid/plugin/*/tests/mtr/plugin.defs".
468472
" suite/*/plugin.defs") {
469473
read_plugin_defs($_);
470474
}
@@ -1116,8 +1120,9 @@ sub command_line_setup {
11161120
'skip-im' => \&ignore_option,
11171121

11181122
# Specify ports
1119-
'build-thread|mtr-build-thread=i' => \$opt_build_thread,
1120-
'port-base|mtr-port-base=i' => \$opt_port_base,
1123+
'build-thread|mtr-build-thread=i' => \$opt_build_thread,
1124+
'mysqlx-port=i' => \$opt_mysqlx_baseport,
1125+
'port-base|mtr-port-base=i' => \$opt_port_base,
11211126

11221127
# Test case authoring
11231128
'record' => \$opt_record,
@@ -1830,7 +1835,6 @@ sub command_line_setup {
18301835
check_debug_support(\%mysqld_variables);
18311836

18321837
executable_setup();
1833-
18341838
}
18351839

18361840

@@ -1881,8 +1885,12 @@ ($)
18811885

18821886
# Calculate baseport
18831887
$baseport= $build_thread * 10 + 10000;
1884-
$mysqlx_baseport = $baseport + 9;
1885-
if ( $baseport < 5001 or $mysqlx_baseport + 9 >= 32767 )
1888+
1889+
my $should_generate_value= $opt_mysqlx_baseport eq "auto";
1890+
1891+
$mysqlx_baseport= $should_generate_value ? $baseport + 9 : $opt_mysqlx_baseport;
1892+
1893+
if ( $baseport < 5001 or $baseport + 9 >= 32767)
18861894
{
18871895
mtr_error("MTR_BUILD_THREAD number results in a port",
18881896
"outside 5001 - 32767",
File renamed without changes.

rapid/plugin/x/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,19 @@ ELSE()
217217
ADD_DEFINITIONS(-DMYSQLXTEST_EXPORTS)
218218
ENDIF()
219219

220+
IF(INSTALL_MYSQLTESTDIR)
221+
INSTALL(
222+
FILES tests/mtr/plugin.defs
223+
DESTINATION "${INSTALL_MYSQLTESTDIR}/suite/x"
224+
COMPONENT Test
225+
)
226+
INSTALL(
227+
DIRECTORY tests/mtr/t tests/mtr/r tests/mtr/include
228+
DESTINATION "${INSTALL_MYSQLTESTDIR}/suite/x"
229+
USE_SOURCE_PERMISSIONS
230+
COMPONENT Test
231+
PATTERN "collections" EXCLUDE
232+
)
233+
ENDIF()
220234
ENDIF()
235+

rapid/plugin/x/mysqlxtest_src/mysqlxtest.cc

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static std::list<Stack_frame> script_stack;
9797
static std::map<std::string, std::string> variables;
9898
static std::list<std::string> variables_to_unreplace;
9999

100-
void replace_all(std::string &input, const std::string &to_find, const std::string &change_to)
100+
static void replace_all(std::string &input, const std::string &to_find, const std::string &change_to)
101101
{
102102
size_t position = input.find(to_find);
103103

@@ -108,7 +108,7 @@ void replace_all(std::string &input, const std::string &to_find, const std::stri
108108
}
109109
}
110110

111-
void replace_variables(std::string &s)
111+
static void replace_variables(std::string &s)
112112
{
113113
for (std::map<std::string, std::string>::const_iterator sub = variables.begin();
114114
sub != variables.end(); ++sub)
@@ -123,7 +123,7 @@ void replace_variables(std::string &s)
123123
}
124124
}
125125

126-
std::string unreplace_variables(const std::string &in, bool clear)
126+
static std::string unreplace_variables(const std::string &in, bool clear)
127127
{
128128
std::string s = in;
129129
for (std::list<std::string>::const_iterator sub = variables_to_unreplace.begin();
@@ -1765,10 +1765,13 @@ class Command
17651765
return Stop_with_failure;
17661766
}
17671767

1768-
std::ifstream file(argl[1].c_str());
1768+
std::string path_to_file = argl[1];
1769+
replace_variables(path_to_file);
1770+
1771+
std::ifstream file(path_to_file.c_str());
17691772
if (!file.is_open())
17701773
{
1771-
std::cerr << "Coult not open file " << argl[1]<<"\n";
1774+
std::cerr << "Couldn't not open file " << path_to_file <<"\n";
17721775
return Stop_with_failure;
17731776
}
17741777

@@ -2914,7 +2917,7 @@ class My_command_line_options : public Command_line_options
29142917
}
29152918
};
29162919

2917-
std::vector<Block_processor_ptr> create_macro_block_processors(Connection_manager *cm)
2920+
static std::vector<Block_processor_ptr> create_macro_block_processors(Connection_manager *cm)
29182921
{
29192922
std::vector<Block_processor_ptr> result;
29202923

@@ -2926,7 +2929,7 @@ std::vector<Block_processor_ptr> create_macro_block_processors(Connection_manage
29262929
return result;
29272930
}
29282931

2929-
std::vector<Block_processor_ptr> create_block_processors(Connection_manager *cm)
2932+
static std::vector<Block_processor_ptr> create_block_processors(Connection_manager *cm)
29302933
{
29312934
std::vector<Block_processor_ptr> result;
29322935

@@ -3058,14 +3061,14 @@ static std::istream &get_input(My_command_line_options &opt, std::ifstream &file
30583061
}
30593062

30603063

3061-
inline void unable_daemonize()
3064+
static void unable_daemonize()
30623065
{
30633066
std::cerr << "ERROR: Unable to put process in background\n";
30643067
exit(2);
30653068
}
30663069

30673070

3068-
void daemonize()
3071+
static void daemonize()
30693072
{
30703073
#ifdef WIN32
30713074
unable_daemonize();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
perl mysql-test-run.pl --debug-server --timer --force --parallel=auto --comment=x --vardir=var-x --suite=x --experimental=collections/default.experimental
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
perl mysql-test-run.pl --debug-server --timer --force --parallel=auto --comment=x --vardir=var-x --suite=x --experimental=collections/default.experimental
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# For easier human reading (MTR doesn't care), please keep entries
2+
# in alphabetical order. This also helps with merge conflict resolution.
3+
4+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
perl mysql-test-run.pl --debug-server --timer --force --parallel=auto --comment=x --vardir=var-x --suite=x --experimental=collections/default.experimental

0 commit comments

Comments
 (0)