summaryrefslogtreecommitdiff
path: root/mysql-test/mysql-test-run.pl
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/mysql-test-run.pl')
-rwxr-xr-xmysql-test/mysql-test-run.pl506
1 files changed, 272 insertions, 234 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index ba2056e2818..7b6ddf70d53 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -58,7 +58,7 @@ $Devel::Trace::TRACE= 0; # Don't trace boring init stuff
use File::Path;
use File::Basename;
use File::Copy;
-use File::Temp qw / tempdir /;
+use File::Temp qw /tempdir/;
use Cwd;
use Getopt::Long;
use IO::Socket;
@@ -101,8 +101,6 @@ our $glob_mysql_test_dir= undef;
our $glob_mysql_bench_dir= undef;
our $glob_scriptname= undef;
our $glob_timers= undef;
-our $glob_use_running_ndbcluster= 0;
-our $glob_use_running_ndbcluster_slave= 0;
our $glob_use_embedded_server= 0;
our @glob_test_mode;
@@ -110,6 +108,7 @@ our $glob_basedir;
our $path_charsetsdir;
our $path_client_bindir;
+our $path_share;
our $path_language;
our $path_timefile;
our $path_snapshot;
@@ -130,7 +129,7 @@ our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
our $default_vardir;
our $opt_usage;
-our $opt_suite;
+our $opt_suites= "main,binlog,rpl,rpl_ndb,ndb"; # Default suites to run
our $opt_script_debug= 0; # Script debugging, enable with --script-debug
our $opt_verbose= 0; # Verbose output, enable with --verbose
@@ -158,6 +157,7 @@ our $exe_im;
our $exe_my_print_defaults;
our $exe_perror;
our $lib_udf_example;
+our $lib_example_plugin;
our $exe_libtool;
our $opt_bench= 0;
@@ -395,7 +395,7 @@ sub main () {
else
{
# Figure out which tests we are going to run
- my $tests= collect_test_cases($opt_suite);
+ my $tests= collect_test_cases($opt_suites);
# Turn off NDB and other similar options if no tests use it
my ($need_ndbcluster,$need_im);
@@ -403,24 +403,24 @@ sub main () {
{
next if $test->{skip};
- $need_ndbcluster||= $test->{ndb_test};
- $need_im||= $test->{component_id} eq 'im';
-
- # Count max number of slaves used by a test case
- if ( $test->{slave_num} > $max_slave_num)
+ if (!$opt_extern)
{
- $max_slave_num= $test->{slave_num};
- mtr_error("Too many slaves") if $max_slave_num > 3;
- }
+ $need_ndbcluster||= $test->{ndb_test};
+ $need_im||= $test->{component_id} eq 'im';
- # Count max number of masters used by a test case
- if ( $test->{master_num} > $max_master_num)
- {
- $max_master_num= $test->{master_num};
- mtr_error("Too many masters") if $max_master_num > 2;
- mtr_error("Too few masters") if $max_master_num < 1;
- }
+ # Count max number of slaves used by a test case
+ if ( $test->{slave_num} > $max_slave_num) {
+ $max_slave_num= $test->{slave_num};
+ mtr_error("Too many slaves") if $max_slave_num > 3;
+ }
+ # Count max number of masters used by a test case
+ if ( $test->{master_num} > $max_master_num) {
+ $max_master_num= $test->{master_num};
+ mtr_error("Too many masters") if $max_master_num > 2;
+ mtr_error("Too few masters") if $max_master_num < 1;
+ }
+ }
$use_innodb||= $test->{'innodb_test'};
}
@@ -449,7 +449,7 @@ sub main () {
run_report_features();
}
- run_suite($opt_suite, $tests);
+ run_tests($tests);
}
mtr_exit(0);
@@ -465,7 +465,6 @@ sub command_line_setup () {
# These are defaults for things that are set on the command line
- $opt_suite= "main"; # Special default suite
my $opt_comment;
$opt_master_myport= 9306;
@@ -525,7 +524,7 @@ sub command_line_setup () {
'skip-slave-binlog' => \$opt_skip_slave_binlog,
'do-test=s' => \$opt_do_test,
'start-from=s' => \$opt_start_from,
- 'suite=s' => \$opt_suite,
+ 'suite|suites=s' => \$opt_suites,
'skip-rpl' => \$opt_skip_rpl,
'skip-im' => \$opt_skip_im,
'skip-test=s' => \$opt_skip_test,
@@ -653,6 +652,7 @@ sub command_line_setup () {
$glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
chomp($glob_mysql_test_dir);
}
+ $default_vardir= "$glob_mysql_test_dir/var";
# In most cases, the base directory we find everything relative to,
# is the parent directory of the "mysql-test" directory. For source
@@ -680,6 +680,37 @@ sub command_line_setup () {
$glob_timers= mtr_init_timers();
+ # --------------------------------------------------------------------------
+ # Embedded server flag
+ # --------------------------------------------------------------------------
+ if ( $opt_embedded_server )
+ {
+ $glob_use_embedded_server= 1;
+ # Add the location for libmysqld.dll to the path.
+ if ( $glob_win32 )
+ {
+ my $lib_mysqld=
+ mtr_path_exists(vs_config_dirs('libmysqld',''));
+ $lib_mysqld= $glob_cygwin_perl ? ":".`cygpath "$lib_mysqld"`
+ : ";".$lib_mysqld;
+ chomp($lib_mysqld);
+ $ENV{'PATH'}="$ENV{'PATH'}".$lib_mysqld;
+ }
+
+ push(@glob_test_mode, "embedded");
+ $opt_skip_rpl= 1; # We never run replication with embedded
+ $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
+ $opt_skip_ssl= 1; # Turn off use of SSL
+
+ # Turn off use of bin log
+ push(@opt_extra_mysqld_opt, "--skip-log-bin");
+
+ if ( $opt_extern )
+ {
+ mtr_error("Can't use --extern with --embedded-server");
+ }
+ }
+
#
# Find the mysqld executable to be able to find the mysqld version
# number as early as possible
@@ -692,6 +723,15 @@ sub command_line_setup () {
"$glob_basedir/client",
"$glob_basedir/bin");
+ # Look for language files and charsetsdir, use same share
+ $path_share= mtr_path_exists("$glob_basedir/share/mysql",
+ "$glob_basedir/sql/share",
+ "$glob_basedir/share");
+
+ $path_language= mtr_path_exists("$path_share/english");
+ $path_charsetsdir= mtr_path_exists("$path_share/charsets");
+
+
if (!$opt_extern)
{
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
@@ -750,14 +790,14 @@ sub command_line_setup () {
# Find out type of logging that are being used
# --------------------------------------------------------------------------
# NOTE if the default binlog format is changed, this has to be changed
- $used_binlog_format= "stmt";
+ $used_binlog_format= "statement";
if (!$opt_extern && $mysql_version_id >= 50100 )
{
$used_binlog_format= "mixed"; # Default value for binlog format
foreach my $arg ( @opt_extra_mysqld_opt )
{
- if ( $arg =~ /binlog-format=(\S+)/ )
+ if ( $arg =~ /binlog[-_]format=(\S+)/ )
{
$used_binlog_format= $1;
}
@@ -815,7 +855,6 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Set the "var/" directory, as it is the base for everything else
# --------------------------------------------------------------------------
- $default_vardir= "$glob_mysql_test_dir/var";
if ( ! $opt_vardir )
{
$opt_vardir= $default_vardir;
@@ -881,26 +920,6 @@ sub command_line_setup () {
mtr_error("Will not run in record mode without a specific test case");
}
- # --------------------------------------------------------------------------
- # Embedded server flag
- # --------------------------------------------------------------------------
- if ( $opt_embedded_server )
- {
- $glob_use_embedded_server= 1;
- push(@glob_test_mode, "embedded");
- $opt_skip_rpl= 1; # We never run replication with embedded
- $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
- $opt_skip_ssl= 1; # Turn off use of SSL
-
- # Turn off use of bin log
- push(@opt_extra_mysqld_opt, "--skip-log-bin");
-
- if ( $opt_extern )
- {
- mtr_error("Can't use --extern with --embedded-server");
- }
- }
-
# --------------------------------------------------------------------------
# ps protcol flag
@@ -911,40 +930,6 @@ sub command_line_setup () {
}
# --------------------------------------------------------------------------
- # Ndb cluster flags
- # --------------------------------------------------------------------------
-
- if ( $opt_ndbconnectstring )
- {
- $glob_use_running_ndbcluster= 1;
- mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
- if $opt_skip_ndbcluster;
- mtr_error("Can't specify --ndb-connectstring and --ndbcluster-port")
- if $opt_ndbcluster_port;
- }
- else
- {
- # Set default connect string
- $opt_ndbconnectstring= "host=localhost:$opt_ndbcluster_port";
- }
-
- if ( $opt_ndbconnectstring_slave )
- {
- $glob_use_running_ndbcluster_slave= 1;
- mtr_error("Can't specify ndb-connectstring_slave and " .
- "--skip-ndbcluster-slave")
- if $opt_skip_ndbcluster;
- mtr_error("Can't specify --ndb-connectstring-slave and " .
- "--ndbcluster-port-slave")
- if $opt_ndbcluster_port_slave;
- }
- else
- {
- # Set default connect string
- $opt_ndbconnectstring_slave= "host=localhost:$opt_ndbcluster_port_slave";
- }
-
- # --------------------------------------------------------------------------
# Bench flags
# --------------------------------------------------------------------------
if ( $opt_small_bench )
@@ -1187,7 +1172,7 @@ sub command_line_setup () {
nodes => 2,
port => "$opt_ndbcluster_port",
data_dir => "$data_dir",
- connect_string => "$opt_ndbconnectstring",
+ connect_string => "host=localhost:$opt_ndbcluster_port",
path_pid => "$data_dir/ndb_3.pid", # Nodes + 1
pid => 0, # pid of ndb_mgmd
installed_ok => 0,
@@ -1200,7 +1185,7 @@ sub command_line_setup () {
nodes => 1,
port => "$opt_ndbcluster_port_slave",
data_dir => "$data_dir",
- connect_string => "$opt_ndbconnectstring_slave",
+ connect_string => "host=localhost:$opt_ndbcluster_port_slave",
path_pid => "$data_dir/ndb_2.pid", # Nodes + 1
pid => 0, # pid of ndb_mgmd
installed_ok => 0,
@@ -1222,6 +1207,9 @@ sub command_line_setup () {
}
}
+ # --------------------------------------------------------------------------
+ # extern
+ # --------------------------------------------------------------------------
if ( $opt_extern )
{
# Turn off features not supported when running with extern server
@@ -1238,6 +1226,38 @@ sub command_line_setup () {
if $opt_socket;
}
+
+ # --------------------------------------------------------------------------
+ # ndbconnectstring and ndbconnectstring_slave
+ # --------------------------------------------------------------------------
+ if ( $opt_ndbconnectstring )
+ {
+ # ndbconnectstring was supplied by user, the tests shoudl be run
+ # against an already started cluster, change settings
+ my $cluster= $clusters->[0]; # Master cluster
+ $cluster->{'connect_string'}= $opt_ndbconnectstring;
+ $cluster->{'use_running'}= 1;
+
+ mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
+ if $opt_skip_ndbcluster;
+ }
+ $ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'};
+
+
+ if ( $opt_ndbconnectstring_slave )
+ {
+ # ndbconnectstring-slave was supplied by user, the tests should be run
+ # agains an already started slave cluster, change settings
+ my $cluster= $clusters->[1]; # Slave cluster
+ $cluster->{'connect_string'}= $opt_ndbconnectstring_slave;
+ $cluster->{'use_running'}= 1;
+
+ mtr_error("Can't specify ndb-connectstring_slave and " .
+ "--skip-ndbcluster-slave")
+ if $opt_skip_ndbcluster_slave;
+ }
+
+
$path_timefile= "$opt_vardir/log/mysqltest-time";
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
$path_current_test_log= "$opt_vardir/log/current_test";
@@ -1336,10 +1356,15 @@ sub collect_mysqld_features () {
my $found_variable_list_start= 0;
#
- # Execute "mysqld --no-defaults --help --verbose" to get a
+ # Execute "mysqld --help --verbose" to get a list
# list of all features and settings
#
- my $list= `$exe_mysqld --no-defaults --verbose --help`;
+ # --no-defaults and --skip-grant-tables are to avoid loading
+ # system-wide configs and plugins
+ #
+ # --datadir must exist, mysqld will chdir into it
+ #
+ my $list= `$exe_mysqld --no-defaults --datadir=$path_language --language=$path_language --skip-grant-tables --verbose --help`;
foreach my $line (split('\n', $list))
{
@@ -1502,14 +1527,6 @@ sub executable_setup () {
}
}
- # Look for language files and charsetsdir, use same share
- my $path_share= mtr_path_exists("$glob_basedir/share/mysql",
- "$glob_basedir/sql/share",
- "$glob_basedir/share");
-
- $path_language= mtr_path_exists("$path_share/english");
- $path_charsetsdir= mtr_path_exists("$path_share/charsets");
-
# Look for my_print_defaults
$exe_my_print_defaults=
mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
@@ -1532,7 +1549,6 @@ sub executable_setup () {
if (!$opt_extern)
{
-
# Look for SQL scripts directory
if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "")
{
@@ -1545,48 +1561,61 @@ sub executable_setup () {
"$glob_basedir/scripts");
}
- if ( $mysql_version_id >= 50100 ) {
+ if ( $mysql_version_id >= 50100 )
+ {
$exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
}
- if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server ) {
+ if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
+ {
$exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
- } else {
+ }
+ else
+ {
$exe_mysql_upgrade= "";
}
- if ( ! $glob_win32 ) {
+ if ( ! $glob_win32 )
+ {
# Look for mysql_fix_system_table script
$exe_mysql_fix_system_tables=
- mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
- "$path_client_bindir/mysql_fix_privilege_tables");
+ mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
+ "$path_client_bindir/mysql_fix_privilege_tables");
}
# Look for mysql_fix_privilege_tables.sql script
$file_mysql_fix_privilege_tables=
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
- "$glob_basedir/share/mysql_fix_privilege_tables.sql");
+ "$glob_basedir/share/mysql_fix_privilege_tables.sql");
- if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) {
+ if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
+ {
mtr_warning("Could not find all required ndb binaries, " .
- "all ndb tests will fail, use --skip-ndbcluster to " .
- "skip testing it.");
+ "all ndb tests will fail, use --skip-ndbcluster to " .
+ "skip testing it.");
- foreach my $cluster (@{$clusters}) {
- $cluster->{"executable_setup_failed"}= 1;
+ foreach my $cluster (@{$clusters})
+ {
+ $cluster->{"executable_setup_failed"}= 1;
}
}
- if ( ! $opt_skip_im and executable_setup_im()) {
+ if ( ! $opt_skip_im and executable_setup_im())
+ {
mtr_warning("Could not find all required instance manager binaries, " .
- "all im tests will fail, use --skip-im to " .
- "continue without instance manager");
+ "all im tests will fail, use --skip-im to " .
+ "continue without instance manager");
$instance_manager->{"executable_setup_failed"}= 1;
}
# Look for the udf_example library
$lib_udf_example=
mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
- "$glob_basedir/sql/.libs/udf_example.so",);
+ "$glob_basedir/sql/.libs/udf_example.so",);
+
+ # Look for the ha_example library
+ $lib_example_plugin=
+ mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
+ "$glob_basedir/storage/example/.libs/ha_example.so",);
}
@@ -1632,7 +1661,7 @@ sub generate_cmdline_mysqldump ($) {
my($mysqld) = @_;
return
mtr_native_path($exe_mysqldump) .
- " --no-defaults -uroot " .
+ " --no-defaults -uroot --debug-check " .
"--port=$mysqld->{'port'} " .
"--socket=$mysqld->{'path_sock'} --password=";
}
@@ -1745,14 +1774,6 @@ sub environment_setup () {
}
# --------------------------------------------------------------------------
- # Add the path where mysqld will find udf_example.so
- # --------------------------------------------------------------------------
- if ( $lib_udf_example )
- {
- push(@ld_library_paths, dirname($lib_udf_example));
- }
-
- # --------------------------------------------------------------------------
# Valgrind need to be run with debug libraries otherwise it's almost
# impossible to add correct supressions, that means if "/usr/lib/debug"
# is available, it should be added to
@@ -1853,7 +1874,6 @@ sub environment_setup () {
$ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
$ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
$ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log;
- $ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring;
if ( $mysql_version_id >= 50000 )
{
@@ -1894,9 +1914,9 @@ sub environment_setup () {
# ----------------------------------------------------
my $cmdline_mysqlcheck=
mtr_native_path($exe_mysqlcheck) .
- " --no-defaults -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
+ " --no-defaults --debug-check -uroot " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password=";
if ( $opt_debug )
{
@@ -1931,8 +1951,7 @@ sub environment_setup () {
mtr_native_path($exe_mysqlslap) .
" -uroot " .
"--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password= " .
- "--lock-directory=$opt_tmpdir";
+ "--socket=$master->[0]->{'path_sock'} --password= ";
if ( $opt_debug )
{
@@ -1947,7 +1966,7 @@ sub environment_setup () {
# ----------------------------------------------------
my $cmdline_mysqlimport=
mtr_native_path($exe_mysqlimport) .
- " -uroot " .
+ " -uroot --debug-check " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
@@ -1964,7 +1983,7 @@ sub environment_setup () {
# ----------------------------------------------------
my $cmdline_mysqlshow=
mtr_native_path($exe_mysqlshow) .
- " -uroot " .
+ " -uroot --debug-check " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} --password=";
@@ -1980,8 +1999,8 @@ sub environment_setup () {
# ----------------------------------------------------
my $cmdline_mysqlbinlog=
mtr_native_path($exe_mysqlbinlog) .
- " --no-defaults";
- if (!$opt_extern && $mysql_version_id >= 50000 )
+ " --no-defaults --disable-force-if-open --debug-check";
+ if ( !$opt_extern && $mysql_version_id >= 50000 )
{
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
}
@@ -1998,7 +2017,7 @@ sub environment_setup () {
# ----------------------------------------------------
my $cmdline_mysql=
mtr_native_path($exe_mysql) .
- " --no-defaults --host=localhost --user=root --password= " .
+ " --no-defaults --debug-check --host=localhost --user=root --password= " .
"--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'} ".
"--character-sets-dir=$path_charsetsdir";
@@ -2059,11 +2078,16 @@ sub environment_setup () {
# ----------------------------------------------------
$ENV{'UDF_EXAMPLE_LIB'}=
($lib_udf_example ? basename($lib_udf_example) : "");
+ $ENV{'UDF_EXAMPLE_LIB_OPT'}=
+ ($lib_udf_example ? "--plugin_dir=" . dirname($lib_udf_example) : "");
- $ENV{'LD_LIBRARY_PATH'}=
- ($lib_udf_example ? dirname($lib_udf_example) : "") .
- ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
-
+ # ----------------------------------------------------
+ # Add the path where mysqld will find ha_example.so
+ # ----------------------------------------------------
+ $ENV{'EXAMPLE_PLUGIN'}=
+ ($lib_example_plugin ? basename($lib_example_plugin) : "");
+ $ENV{'EXAMPLE_PLUGIN_OPT'}=
+ ($lib_example_plugin ? "--plugin_dir=" . dirname($lib_example_plugin) : "");
# ----------------------------------------------------
# We are nice and report a bit about our settings
@@ -2500,7 +2524,7 @@ sub ndbcluster_start_install ($) {
else
{
$ndb_no_ord=32;
- $ndb_con_op=5000;
+ $ndb_con_op=10000;
$ndb_dmem="20M";
$ndb_imem="1M";
$ndb_pbmem="4M";
@@ -2696,7 +2720,7 @@ sub ndbcluster_start ($$) {
mtr_verbose("ndbcluster_start '$cluster->{'name'}'");
- if ( $glob_use_running_ndbcluster )
+ if ( $cluster->{'use_running'} )
{
return 0;
}
@@ -2719,8 +2743,8 @@ sub ndbcluster_start ($$) {
sub rm_ndbcluster_tables ($) {
my $dir= shift;
- foreach my $bin ( glob("$dir/mysql/apply_status*"),
- glob("$dir/mysql/schema*"))
+ foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"),
+ glob("$dir/mysql/ndb_schema*"))
{
unlink($bin);
}
@@ -2793,19 +2817,17 @@ sub run_benchmarks ($) {
##############################################################################
#
-# Run the test suite
+# Run the tests
#
##############################################################################
-sub run_suite () {
- my ($suite, $tests)= @_;
+sub run_tests () {
+ my ($tests)= @_;
mtr_print_thick_line();
mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout);
- mtr_report("Starting Tests in the '$suite' suite");
-
mtr_report_tests_not_skipped_though_disabled($tests);
mtr_print_header();
@@ -2867,10 +2889,7 @@ sub initialize_servers () {
}
else
{
- if ($opt_verbose)
- {
- mtr_report("No need to create '$opt_vardir' it already exists");
- }
+ mtr_verbose("No need to create '$opt_vardir' it already exists");
}
}
else
@@ -2919,30 +2938,34 @@ sub mysql_install_db () {
my $cluster_started_ok= 1; # Assume it can be started
- if ($opt_skip_ndbcluster || $glob_use_running_ndbcluster ||
- $clusters->[0]->{executable_setup_failed})
+ my $cluster= $clusters->[0]; # Master cluster
+ if ($opt_skip_ndbcluster ||
+ $cluster->{'use_running'} ||
+ $cluster->{executable_setup_failed})
{
# Don't install master cluster
}
- elsif (ndbcluster_start_install($clusters->[0]))
+ elsif (ndbcluster_start_install($cluster))
{
- mtr_warning("Failed to start install of $clusters->[0]->{name}");
+ mtr_warning("Failed to start install of $cluster->{name}");
$cluster_started_ok= 0;
}
+ $cluster= $clusters->[1]; # Slave cluster
if ($max_slave_num == 0 ||
- $opt_skip_ndbcluster_slave || $glob_use_running_ndbcluster_slave ||
- $clusters->[1]->{executable_setup_failed})
+ $opt_skip_ndbcluster_slave ||
+ $cluster->{'use_running'} ||
+ $cluster->{executable_setup_failed})
{
# Don't install slave cluster
}
- elsif (ndbcluster_start_install($clusters->[1]))
+ elsif (ndbcluster_start_install($cluster))
{
- mtr_warning("Failed to start install of $clusters->[1]->{name}");
+ mtr_warning("Failed to start install of $cluster->{name}");
$cluster_started_ok= 0;
}
- foreach my $cluster (@{$clusters})
+ foreach $cluster (@{$clusters})
{
next if !$cluster->{'pid'};
@@ -3000,8 +3023,8 @@ sub install_db ($$) {
mtr_add_arg($args, "--bootstrap");
mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
mtr_add_arg($args, "--datadir=%s", $data_dir);
- mtr_add_arg($args, "--skip-innodb");
- mtr_add_arg($args, "--skip-ndbcluster");
+ mtr_add_arg($args, "--loose-skip-innodb");
+ mtr_add_arg($args, "--loose-skip-ndbcluster");
mtr_add_arg($args, "--tmpdir=.");
mtr_add_arg($args, "--core-file");
@@ -3147,8 +3170,8 @@ basedir = $path_my_basedir
server_id = $server_id
shutdown-delay = 10
skip-stack-trace
-skip-innodb
-skip-ndbcluster
+loose-skip-innodb
+loose-skip-ndbcluster
EOF
;
if ( $mysql_version_id < 50100 )
@@ -3222,9 +3245,16 @@ sub run_testcase_check_skip_test($)
{
foreach my $cluster (@{$clusters})
{
+ # Slave cluster is skipped and thus not
+ # installed, no need to perform checks
last if ($opt_skip_ndbcluster_slave and
$cluster->{'name'} eq 'Slave');
+ # Using running cluster - no need
+ # to check if test should be skipped
+ # will be done by test itself
+ last if ($cluster->{'use_running'});
+
# If test needs this cluster, check binaries was found ok
if ( $cluster->{'executable_setup_failed'} )
{
@@ -3268,18 +3298,14 @@ sub run_testcase_check_skip_test($)
sub do_before_run_mysqltest($)
{
my $tinfo= shift;
- my $tname= $tinfo->{'name'};
# Remove old files produced by mysqltest
- my $result_dir= "r";
- if ( $opt_suite ne "main" )
- {
- $result_dir= "suite/$opt_suite/r";
- }
- unlink("$result_dir/$tname.reject");
- unlink("$result_dir/$tname.progress");
- unlink("$result_dir/$tname.log");
- unlink("$result_dir/$tname.warnings");
+ my $base_file= mtr_match_extension($tinfo->{'result_file'},
+ "result"); # Trim extension
+ unlink("$base_file.reject");
+ unlink("$base_file.progress");
+ unlink("$base_file.log");
+ unlink("$base_file.warnings");
if (!$opt_extern)
{
@@ -3298,23 +3324,18 @@ sub do_before_run_mysqltest($)
sub do_after_run_mysqltest($)
{
my $tinfo= shift;
- my $tname= $tinfo->{'name'};
# Save info from this testcase run to mysqltest.log
mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log)
if -f $path_current_test_log;
mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
if -f $path_timefile;
-
- # Remove the file that mysqltest writes info to
- unlink($path_timefile);
-
}
-sub run_testcase_mark_logs($)
+sub run_testcase_mark_logs($$)
{
- my ($log_msg)= @_;
+ my ($tinfo, $log_msg)= @_;
# Write a marker to all log files
@@ -3327,6 +3348,12 @@ sub run_testcase_mark_logs($)
mtr_tofile($mysqld->{path_myerr}, $log_msg);
}
+ if ( $tinfo->{'component_id'} eq 'im')
+ {
+ mtr_tofile($instance_manager->{path_err}, $log_msg);
+ mtr_tofile($instance_manager->{path_log}, $log_msg);
+ }
+
# ndbcluster log file
mtr_tofile($path_ndb_testrun_log, $log_msg);
@@ -3406,7 +3433,7 @@ sub run_testcase ($) {
}
# Write to all log files to indicate start of testcase
- run_testcase_mark_logs("CURRENT_TEST: $tinfo->{name}\n");
+ run_testcase_mark_logs($tinfo, "CURRENT_TEST: $tinfo->{name}\n");
my $died= mtr_record_dead_children();
if ($died or $master_restart or $slave_restart)
@@ -3418,6 +3445,10 @@ sub run_testcase ($) {
return 1;
}
}
+ elsif ($glob_use_embedded_server)
+ {
+ run_master_init_script($tinfo);
+ }
# ----------------------------------------------------------------------
# If --start-and-exit or --start-dirty given, stop here to let user manually
@@ -3435,6 +3466,9 @@ sub run_testcase ($) {
my $res= run_mysqltest($tinfo);
mtr_report_test_name($tinfo);
+
+ do_after_run_mysqltest($tinfo);
+
if ( $res == 0 )
{
mtr_report_test_passed($tinfo);
@@ -3464,15 +3498,16 @@ sub run_testcase ($) {
"mysqltest returned unexpected code $res, it has probably crashed";
report_failure_and_restart($tinfo);
}
-
- do_after_run_mysqltest($tinfo);
}
+ # Remove the file that mysqltest writes info to
+ unlink($path_timefile);
+
# ----------------------------------------------------------------------
# Stop Instance Manager if we are processing an IM-test case.
# ----------------------------------------------------------------------
if ( $tinfo->{'component_id'} eq 'im' and
- !mtr_im_stop($instance_manager, $tinfo->{'name'}) )
+ !mtr_im_stop($instance_manager, $tinfo->{'name'}))
{
mtr_error("Failed to stop Instance Manager.")
}
@@ -3584,6 +3619,23 @@ sub report_failure_and_restart ($) {
}
+sub run_master_init_script ($) {
+ my ($tinfo)= @_;
+ my $init_script= $tinfo->{'master_sh'};
+
+ # Run master initialization shell script if one exists
+ if ( $init_script )
+ {
+ my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
+ if ( $ret != 0 )
+ {
+ # FIXME rewrite those scripts to return 0 if successful
+ # mtr_warning("$init_script exited with code $ret");
+ }
+ }
+}
+
+
##############################################################################
#
# Start and stop servers
@@ -3595,7 +3647,6 @@ sub do_before_start_master ($) {
my ($tinfo)= @_;
my $tname= $tinfo->{'name'};
- my $init_script= $tinfo->{'master_sh'};
# FIXME what about second master.....
@@ -3614,16 +3665,7 @@ sub do_before_start_master ($) {
unlink("$master->[1]->{'path_myddir'}/master.info");
unlink("$master->[1]->{'path_myddir'}/relay-log.info");
- # Run master initialization shell script if one exists
- if ( $init_script )
- {
- my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
- if ( $ret != 0 )
- {
- # FIXME rewrite those scripts to return 0 if successful
- # mtr_warning("$init_script exited with code $ret");
- }
- }
+ run_master_init_script($tinfo);
}
@@ -3689,15 +3731,7 @@ sub mysqld_arguments ($$$$) {
if ( $mysql_version_id >= 50036)
{
# By default, prevent the started mysqld to access files outside of vardir
- my $secure_file_dir= $opt_vardir;
- if ( $opt_suite ne "main" )
- {
- # When running a suite other than default allow the mysqld
- # access to subdirs of mysql-test/ in order to make it possible
- # to "load data" from the suites data/ directory.
- $secure_file_dir= $glob_mysql_test_dir;
- }
- mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $secure_file_dir);
+ mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
}
if ( $mysql_version_id >= 50000 )
@@ -3756,23 +3790,19 @@ sub mysqld_arguments ($$$$) {
mtr_add_arg($args, "%s--server-id=%d", $prefix,
$idx > 0 ? $idx + 101 : 1);
- mtr_add_arg($args, "%s--innodb_data_file_path=ibdata1:10M:autoextend",
+ mtr_add_arg($args, "%s--loose-innodb_data_file_path=ibdata1:10M:autoextend",
$prefix);
mtr_add_arg($args, "%s--local-infile", $prefix);
if ( $idx > 0 or !$use_innodb)
{
- mtr_add_arg($args, "%s--skip-innodb", $prefix);
+ mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
}
my $cluster= $clusters->[$mysqld->{'cluster'}];
- if ( $opt_skip_ndbcluster ||
- !$cluster->{'pid'})
- {
- mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
- }
- else
+ if ( $cluster->{'pid'} || # Cluster is started
+ $cluster->{'use_running'} ) # Using running cluster
{
mtr_add_arg($args, "%s--ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
@@ -3782,6 +3812,10 @@ sub mysqld_arguments ($$$$) {
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
}
}
+ else
+ {
+ mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
+ }
}
else
{
@@ -3804,7 +3838,7 @@ sub mysqld_arguments ($$$$) {
mtr_add_arg($args, "%s--report-port=%d", $prefix,
$mysqld->{'port'});
mtr_add_arg($args, "%s--report-user=root", $prefix);
- mtr_add_arg($args, "%s--skip-innodb", $prefix);
+ mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
mtr_add_arg($args, "%s--skip-slave-start", $prefix);
# Directory where slaves find the dumps generated by "load data"
@@ -3824,36 +3858,38 @@ sub mysqld_arguments ($$$$) {
}
else
{
- mtr_add_arg($args, "%s--master-user=root", $prefix);
- mtr_add_arg($args, "%s--master-connect-retry=1", $prefix);
- mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix);
- mtr_add_arg($args, "%s--master-password=", $prefix);
- mtr_add_arg($args, "%s--master-port=%d", $prefix,
- $master->[0]->{'port'}); # First master
-
+ if ($mysql_version_id < 50200)
+ {
+ mtr_add_arg($args, "%s--master-user=root", $prefix);
+ mtr_add_arg($args, "%s--master-connect-retry=1", $prefix);
+ mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix);
+ mtr_add_arg($args, "%s--master-password=", $prefix);
+ mtr_add_arg($args, "%s--master-port=%d", $prefix,
+ $master->[0]->{'port'}); # First master
+ }
my $slave_server_id= 2 + $idx;
my $slave_rpl_rank= $slave_server_id;
mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
}
- if ( $opt_skip_ndbcluster_slave ||
- $mysqld->{'cluster'} == -1 ||
- !$clusters->[$mysqld->{'cluster'}]->{'pid'} )
- {
- mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
- }
- else
+ my $cluster= $clusters->[$mysqld->{'cluster'}];
+ if ( $cluster->{'pid'} || # Slave cluster is started
+ $cluster->{'use_running'} ) # Using running slave cluster
{
mtr_add_arg($args, "%s--ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
- $clusters->[$mysqld->{'cluster'}]->{'connect_string'});
+ $cluster->{'connect_string'});
if ( $mysql_version_id >= 50100 )
{
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
}
}
+ else
+ {
+ mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
+ }
} # end slave
@@ -4049,7 +4085,7 @@ sub stop_all_servers () {
my $pid;
# Start shutdown of all started masters
- foreach my $mysqld (@{$master}, @{$slave})
+ foreach my $mysqld (@{$slave}, @{$master})
{
if ( $mysqld->{'pid'} )
{
@@ -4058,11 +4094,11 @@ sub stop_all_servers () {
push(@kill_pids,{
pid => $mysqld->{'pid'},
- real_pid => $mysqld->{'real_pid'},
+ real_pid => $mysqld->{'real_pid'},
pidfile => $mysqld->{'path_pid'},
sockfile => $mysqld->{'path_sock'},
port => $mysqld->{'port'},
- errfile => $mysqld->{'path_myerr'},
+ errfile => $mysqld->{'path_myerr'},
});
$mysqld->{'pid'}= 0; # Assume we are done with it
@@ -4260,7 +4296,7 @@ sub run_testcase_stop_servers($$$) {
{
if ( $mysqld->{'pid'} )
{
- $pid= mtr_mysqladmin_start($mysqld, "shutdown", 70);
+ $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20);
$admin_pids{$pid}= 1;
@@ -4312,7 +4348,7 @@ sub run_testcase_stop_servers($$$) {
{
if ( $mysqld->{'pid'} )
{
- $pid= mtr_mysqladmin_start($mysqld, "shutdown", 70);
+ $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20);
$admin_pids{$pid}= 1;
@@ -4412,7 +4448,8 @@ sub run_testcase_start_servers($) {
}
- if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} and
+ if ( $clusters->[0]->{'pid'} || $clusters->[0]->{'use_running'}
+ and ! $master->[1]->{'pid'} and
$tinfo->{'master_num'} > 1 )
{
# Test needs cluster, start an extra mysqld connected to cluster
@@ -4423,12 +4460,12 @@ sub run_testcase_start_servers($) {
# tables ok FIXME This is a workaround so that only one mysqld
# create the tables
if ( ! sleep_until_file_created(
- "$master->[0]->{'path_myddir'}/mysql/apply_status.ndb",
+ "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb",
$master->[0]->{'start_timeout'},
$master->[0]->{'pid'}))
{
- $tinfo->{'comment'}= "Failed to create 'mysql/apply_status' table";
+ $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table";
return 1;
}
}
@@ -5077,7 +5114,9 @@ Options to control what test suites or cases to run
ndb-extra Run extra tests from ndb directory
do-test=PREFIX Run test cases which name are prefixed with PREFIX
start-from=PREFIX Run test cases starting from test prefixed with PREFIX
- suite=NAME Run the test suite named NAME. The default is "main"
+ suite[s]=NAME1,..,NAMEN Collect tests in suites from the comma separated
+ list of suite names.
+ The default is: "$opt_suites"
skip-rpl Skip the replication test cases.
skip-im Don't start IM, and skip the IM test cases
skip-test=PREFIX Skip test cases which name are prefixed with PREFIX
@@ -5175,4 +5214,3 @@ HERE
mtr_exit(1);
}
-