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.pl126
1 files changed, 91 insertions, 35 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 06dd3864212..13ce7ccc66e 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -256,7 +256,7 @@ our $opt_result_ext;
our $opt_skip;
our $opt_skip_rpl;
-our $use_slaves;
+our $max_slave_num= 0;
our $opt_skip_test;
our $opt_skip_im;
@@ -267,7 +267,7 @@ our $opt_sleep_time_for_delete= 10;
our $opt_testcase_timeout;
our $opt_suite_timeout;
my $default_testcase_timeout= 15; # 15 min max
-my $default_suite_timeout= 120; # 2 hours max
+my $default_suite_timeout= 180; # 3 hours max
our $opt_socket;
@@ -410,7 +410,13 @@ sub main () {
{
$need_ndbcluster||= $test->{ndb_test};
$need_im||= $test->{component_id} eq 'im';
- $use_slaves||= $test->{slave_num};
+
+ # 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;
+ }
}
$opt_with_ndbcluster= 0 unless $need_ndbcluster;
$opt_skip_im= 1 unless $need_im;
@@ -845,13 +851,13 @@ sub command_line_setup () {
if ( ! $opt_testcase_timeout )
{
$opt_testcase_timeout= $default_testcase_timeout;
- $opt_testcase_timeout*= 10 if defined $opt_valgrind;
+ $opt_testcase_timeout*= 10 if $opt_valgrind;
}
if ( ! $opt_suite_timeout )
{
$opt_suite_timeout= $default_suite_timeout;
- $opt_suite_timeout*= 4 if defined $opt_valgrind;
+ $opt_suite_timeout*= 6 if $opt_valgrind;
}
# Increase times to wait for executables to start if using valgrind
@@ -996,11 +1002,9 @@ sub snapshot_setup () {
$master->[0]->{'path_myddir'},
$master->[1]->{'path_myddir'});
- if ($use_slaves)
+ for (my $idx= 0; $idx < $max_slave_num; $idx++)
{
- push @data_dir_lst, ($slave->[0]->{'path_myddir'},
- $slave->[1]->{'path_myddir'},
- $slave->[2]->{'path_myddir'});
+ push(@data_dir_lst, $slave->[$idx]->{'path_myddir'});
}
unless ($opt_skip_im)
@@ -1194,7 +1198,7 @@ sub executable_setup () {
sub environment_setup () {
- my $extra_ld_library_paths;
+ my @ld_library_paths;
# --------------------------------------------------------------------------
# Setup LD_LIBRARY_PATH so the libraries from this distro/clone
@@ -1202,25 +1206,40 @@ sub environment_setup () {
# --------------------------------------------------------------------------
if ( $opt_source_dist )
{
- $extra_ld_library_paths= "$glob_basedir/libmysql/.libs/";
+ push(@ld_library_paths, "$glob_basedir/libmysql/.libs/")
}
else
{
- $extra_ld_library_paths= "$glob_basedir/lib";
+ push(@ld_library_paths, "$glob_basedir/lib")
}
# --------------------------------------------------------------------------
# Add the path where mysqld will find udf_example.so
# --------------------------------------------------------------------------
- $extra_ld_library_paths .= ":" .
- ($lib_udf_example ? dirname($lib_udf_example) : "");
+ 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
+ # LD_LIBRARY_PATH
+ # --------------------------------------------------------------------------
+ my $debug_libraries_path= "/usr/lib/debug";
+ if ( $opt_valgrind and -d $debug_libraries_path )
+ {
+ push(@ld_library_paths, $debug_libraries_path);
+ }
- $ENV{'LD_LIBRARY_PATH'}=
- "$extra_ld_library_paths" .
- ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
- $ENV{'DYLD_LIBRARY_PATH'}=
- "$extra_ld_library_paths" .
- ($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : "");
+ $ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
+ split(':', $ENV{'LD_LIBRARY_PATH'}));
+ mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
+
+ $ENV{'DYLD_LIBRARY_PATH'}= join(":", @ld_library_paths,
+ split(':', $ENV{'DYLD_LIBRARY_PATH'}));
+ mtr_debug("DYLD_LIBRARY_PATH: $ENV{'DYLD_LIBRARY_PATH'}");
# --------------------------------------------------------------------------
# Also command lines in .opt files may contain env vars
@@ -1314,7 +1333,7 @@ sub kill_running_server () {
{
# Ensure that no old mysqld test servers are running
# This is different from terminating processes we have
- # started from ths run of the script, this is terminating
+ # started from this run of the script, this is terminating
# leftovers from previous runs.
mtr_kill_leftovers();
@@ -1721,15 +1740,13 @@ sub initialize_servers () {
sub mysql_install_db () {
- # FIXME not exactly true I think, needs improvements
- install_db('master', $master->[0]->{'path_myddir'});
- install_db('master', $master->[1]->{'path_myddir'});
+ install_db('master1', $master->[0]->{'path_myddir'});
+ copy_install_db('master2', $master->[1]->{'path_myddir'});
- if ( $use_slaves )
+ # Install the number of slave databses needed
+ for (my $idx= 0; $idx < $max_slave_num; $idx++)
{
- install_db('slave', $slave->[0]->{'path_myddir'});
- install_db('slave', $slave->[1]->{'path_myddir'});
- install_db('slave', $slave->[2]->{'path_myddir'});
+ copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'});
}
if ( ! $opt_skip_im )
@@ -1759,6 +1776,17 @@ sub mysql_install_db () {
}
+sub copy_install_db ($$) {
+ my $type= shift;
+ my $data_dir= shift;
+
+ mtr_report("Installing \u$type Database");
+
+ # Just copy the installed db from first master
+ mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir);
+
+}
+
sub install_db ($$) {
my $type= shift;
my $data_dir= shift;
@@ -1805,6 +1833,12 @@ sub install_db ($$) {
mtr_add_arg($args, "--skip-ndbcluster");
mtr_add_arg($args, "--skip-bdb");
+ if ( $opt_debug )
+ {
+ mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace",
+ $opt_vardir_trace, $type);
+ }
+
if ( ! $opt_netware )
{
mtr_add_arg($args, "--language=%s", $path_language);
@@ -1913,13 +1947,33 @@ sub im_prepare_data_dir($) {
foreach my $instance (@{$instance_manager->{'instances'}})
{
- install_db(
+ copy_install_db(
'im_mysqld_' . $instance->{'server_id'},
$instance->{'path_datadir'});
}
}
+#
+# Restore snapshot of the installed slave databases
+# if the snapshot exists
+#
+sub restore_slave_databases () {
+
+ if ( -d $path_snapshot)
+ {
+ # Restore the number of slave databases being used
+ for (my $idx= 0; $idx < $max_slave_num; $idx++)
+ {
+ my $data_dir= $slave->[$idx]->{'path_myddir'};
+ my $name= basename($data_dir);
+ rmtree($data_dir);
+ mtr_copy_dir("$path_snapshot/$name", $data_dir);
+ }
+ }
+}
+
+
##############################################################################
#
# Run a single test case
@@ -2020,6 +2074,7 @@ sub run_testcase ($) {
# ----------------------------------------------------------------------
stop_slaves();
+ restore_slave_databases();
}
# ----------------------------------------------------------------------
@@ -2410,7 +2465,7 @@ sub do_before_start_slave ($$) {
sub mysqld_arguments ($$$$$$) {
my $args= shift;
- my $type= shift; # master/slave/bootstrap
+ my $type= shift; # master/slave
my $idx= shift;
my $extra_opt= shift;
my $slave_master_info= shift;
@@ -2639,7 +2694,7 @@ sub mysqld_arguments ($$$$$$) {
##############################################################################
sub mysqld_start ($$$$$) {
- my $type= shift; # master/slave/bootstrap
+ my $type= shift; # master/slave
my $idx= shift;
my $extra_opt= shift;
my $slave_master_info= shift;
@@ -2660,7 +2715,7 @@ sub mysqld_start ($$$$$) {
}
else
{
- $exe= $exe_mysqld;
+ mtr_error("Unknown 'type' passed to mysqld_start");
}
mtr_init_args(\$args);
@@ -2762,7 +2817,7 @@ sub stop_masters () {
my @args;
- for ( my $idx; $idx < 2; $idx++ )
+ for ( my $idx= 0; $idx < 2; $idx++ )
{
# FIXME if we hit ^C before fully started, this test will prevent
# the mysqld process from being killed
@@ -2793,7 +2848,7 @@ sub stop_slaves () {
my @args;
- for ( my $idx; $idx < 3; $idx++ )
+ for ( my $idx= 0; $idx < $max_slave_num; $idx++ )
{
if ( $slave->[$idx]->{'pid'} )
{
@@ -2911,7 +2966,8 @@ sub run_mysqltest ($) {
my $cmdline_mysql=
"$exe_mysql --host=localhost --user=root --password= " .
"--port=$master->[0]->{'path_myport'} " .
- "--socket=$master->[0]->{'path_mysock'}";
+ "--socket=$master->[0]->{'path_mysock'} ".
+ "--character-sets-dir=$path_charsetsdir";
my $cmdline_mysql_client_test=
"$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .