diff options
Diffstat (limited to 'mysql-test/mysql-test-run.pl')
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 453 |
1 files changed, 267 insertions, 186 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index fbd1ed4df5b..4ed1686a121 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -300,9 +300,12 @@ our $path_ndb_examples_dir; our $exe_ndb_example; our $path_ndb_testrun_log; +our $path_sql_dir; + our @data_dir_lst; our $used_binlog_format; +our $used_default_engine; our $debug_compiled_binaries; our $glob_tot_real_time= 0; @@ -352,11 +355,12 @@ sub do_before_start_slave ($); sub ndbd_start ($$$); sub ndb_mgmd_start ($); sub mysqld_start ($$$); -sub mysqld_arguments ($$$$$); +sub mysqld_arguments ($$$$); sub stop_all_servers (); sub run_mysqltest ($); sub usage ($); + ###################################################################### # # Main program @@ -409,24 +413,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'}; } @@ -517,7 +521,7 @@ sub command_line_setup () { 'compress' => \$opt_compress, 'bench' => \$opt_bench, 'small-bench' => \$opt_small_bench, - 'with-ndbcluster' => \$opt_with_ndbcluster, + 'with-ndbcluster|ndb' => \$opt_with_ndbcluster, 'vs-config' => \$opt_vs_config, # Control what test suites or cases to run @@ -766,7 +770,7 @@ sub command_line_setup () { foreach my $arg ( @opt_extra_mysqld_opt ) { - if ( $arg =~ /binlog-format=(\S+)/ ) + if ( $arg =~ /binlog[-_]format=(\S+)/ ) { $used_binlog_format= $1; } @@ -774,6 +778,26 @@ sub command_line_setup () { mtr_report("Using binlog format '$used_binlog_format'"); } + + # -------------------------------------------------------------------------- + # Find out default storage engine being used(if any) + # -------------------------------------------------------------------------- + if ( $opt_with_ndbcluster ) + { + # --ndb or --with-ndbcluster turns on --default-storage-engine=ndbcluster + push(@opt_extra_mysqld_opt, "--default-storage-engine=ndbcluster"); + } + + foreach my $arg ( @opt_extra_mysqld_opt ) + { + if ( $arg =~ /default-storage-engine=(\S+)/ ) + { + $used_default_engine= $1; + } + } + mtr_report("Using default engine '$used_default_engine'") + if defined $used_default_engine; + # -------------------------------------------------------------------------- # Check if we should speed up tests by trying to run on tmpfs # -------------------------------------------------------------------------- @@ -846,20 +870,22 @@ sub command_line_setup () { # -------------------------------------------------------------------------- # Check im suport # -------------------------------------------------------------------------- - if (!$opt_extern) + if ($opt_extern) { - if ( $mysql_version_id < 50000 ) { - # Instance manager is not supported until 5.0 - $opt_skip_im= 1; - - } - - if ( $glob_win32 ) { - mtr_report("Disable Instance manager - not supported on Windows"); - $opt_skip_im= 1; - } - + mtr_report("Disable instance manager when running with extern mysqld"); + $opt_skip_im= 1; + } + elsif ( $mysql_version_id < 50000 ) + { + # Instance manager is not supported until 5.0 + $opt_skip_im= 1; + } + elsif ( $glob_win32 ) + { + mtr_report("Disable Instance manager - testing not supported on Windows"); + $opt_skip_im= 1; } + # -------------------------------------------------------------------------- # Record flag # -------------------------------------------------------------------------- @@ -897,10 +923,6 @@ sub command_line_setup () { # -------------------------------------------------------------------------- # Ndb cluster flags # -------------------------------------------------------------------------- - if ( $opt_with_ndbcluster and !$opt_bench) - { - mtr_error("Can only use --with-ndbcluster togheter with --bench"); - } if ( $opt_ndbconnectstring ) { @@ -1053,8 +1075,6 @@ sub command_line_setup () { # socket path names. $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) > 80 ); - # Put this into a hash, will be a C struct - $master->[0]= { pid => 0, @@ -1062,7 +1082,6 @@ sub command_line_setup () { idx => 0, path_myddir => "$opt_vardir/master-data", path_myerr => "$opt_vardir/log/master.err", - path_mylog => "$opt_vardir/log/master.log", path_pid => "$opt_vardir/run/master.pid", path_sock => "$sockdir/master.sock", port => $opt_master_myport, @@ -1078,7 +1097,6 @@ sub command_line_setup () { idx => 1, path_myddir => "$opt_vardir/master1-data", path_myerr => "$opt_vardir/log/master1.err", - path_mylog => "$opt_vardir/log/master1.log", path_pid => "$opt_vardir/run/master1.pid", path_sock => "$sockdir/master1.sock", port => $opt_master_myport + 1, @@ -1094,7 +1112,6 @@ sub command_line_setup () { idx => 0, path_myddir => "$opt_vardir/slave-data", path_myerr => "$opt_vardir/log/slave.err", - path_mylog => "$opt_vardir/log/slave.log", path_pid => "$opt_vardir/run/slave.pid", path_sock => "$sockdir/slave.sock", port => $opt_slave_myport, @@ -1111,7 +1128,6 @@ sub command_line_setup () { idx => 1, path_myddir => "$opt_vardir/slave1-data", path_myerr => "$opt_vardir/log/slave1.err", - path_mylog => "$opt_vardir/log/slave1.log", path_pid => "$opt_vardir/run/slave1.pid", path_sock => "$sockdir/slave1.sock", port => $opt_slave_myport + 1, @@ -1127,7 +1143,6 @@ sub command_line_setup () { idx => 2, path_myddir => "$opt_vardir/slave2-data", path_myerr => "$opt_vardir/log/slave2.err", - path_mylog => "$opt_vardir/log/slave2.log", path_pid => "$opt_vardir/run/slave2.pid", path_sock => "$sockdir/slave2.sock", port => $opt_slave_myport + 2, @@ -1331,7 +1346,7 @@ sub collect_mysqld_features () { # # Execute "mysqld --help --verbose" to get a list - # of all features and settings + # list of all features and settings # # --no-defaults and --skip-grant-tables are to avoid loading # system-wide configs and plugins @@ -1398,6 +1413,40 @@ sub collect_mysqld_features () { } +sub run_query($$) { + my ($mysqld, $query)= @_; + + my $args; + mtr_init_args(\$args); + + mtr_add_arg($args, "--no-defaults"); + mtr_add_arg($args, "--user=%s", $opt_user); + mtr_add_arg($args, "--port=%d", $mysqld->{'port'}); + mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'}); + mtr_add_arg($args, "--silent"); # Tab separated output + mtr_add_arg($args, "-e '%s'", $query); + + my $cmd= "$exe_mysql " . join(' ', @$args); + mtr_verbose("cmd: $cmd"); + return `$cmd`; +} + + +sub collect_mysqld_features_from_running_server () +{ + my $list= run_query($master->[0], "use mysql; SHOW VARIABLES"); + + foreach my $line (split('\n', $list)) + { + # Put variables into hash + if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ ) + { + print "$1=\"$2\"\n"; + $mysqld_variables{$1}= $2; + } + } +} + sub executable_setup_im () { # Look for instance manager binary - mysqlmanager @@ -1495,6 +1544,18 @@ sub executable_setup () { if (!$opt_extern) { + # Look for SQL scripts directory + if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "") + { + # The SQL scripts are in path_share + $path_sql_dir= $path_share; + } + else + { + $path_sql_dir= mtr_path_exists("$glob_basedir/share", + "$glob_basedir/scripts"); + } + if ( $mysql_version_id >= 50100 ) { $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap"); @@ -1588,7 +1649,8 @@ sub executable_setup () { sub generate_cmdline_mysqldump ($) { my($mysqld) = @_; return - "$exe_mysqldump --no-defaults --debug-info -uroot " . + mtr_native_path($exe_mysqldump) . + " --no-defaults -uroot --debug-info " . "--port=$mysqld->{'port'} " . "--socket=$mysqld->{'path_sock'} --password="; } @@ -1730,7 +1792,7 @@ sub environment_setup () { my $deb_version; if ( $opt_valgrind and -d $debug_libraries_path and (! -e '/etc/debian_version' or - ($deb_version= mtr_grab_file('/etc/debian_version')) == 0 or + ($deb_version= mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or $deb_version > 3.1 ) ) { push(@ld_library_paths, $debug_libraries_path); @@ -1834,7 +1896,8 @@ sub environment_setup () { # Setup env so childs can execute mysqlcheck # ---------------------------------------------------- my $cmdline_mysqlcheck= - "$exe_mysqlcheck --no-defaults --debug-info -uroot " . + mtr_native_path($exe_mysqlcheck) . + " --no-defaults --debug-info -uroot " . "--port=$master->[0]->{'port'} " . "--socket=$master->[0]->{'path_sock'} --password="; @@ -1868,10 +1931,10 @@ sub environment_setup () { if ( $exe_mysqlslap ) { my $cmdline_mysqlslap= - "$exe_mysqlslap -uroot " . + 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 ) { @@ -1885,7 +1948,8 @@ sub environment_setup () { # Setup env so childs can execute mysqlimport # ---------------------------------------------------- my $cmdline_mysqlimport= - "$exe_mysqlimport --debug-info -uroot " . + mtr_native_path($exe_mysqlimport) . + " -uroot --debug-info " . "--port=$master->[0]->{'port'} " . "--socket=$master->[0]->{'path_sock'} --password="; @@ -1901,7 +1965,8 @@ sub environment_setup () { # Setup env so childs can execute mysqlshow # ---------------------------------------------------- my $cmdline_mysqlshow= - "$exe_mysqlshow --debug-info -uroot " . + mtr_native_path($exe_mysqlshow) . + " -uroot --debug-info " . "--port=$master->[0]->{'port'} " . "--socket=$master->[0]->{'path_sock'} --password="; @@ -1916,8 +1981,8 @@ sub environment_setup () { # Setup env so childs can execute mysqlbinlog # ---------------------------------------------------- my $cmdline_mysqlbinlog= - "$exe_mysqlbinlog" . - " --no-defaults --disable-force-if-open --debug-info --local-load=$opt_tmpdir"; + mtr_native_path($exe_mysqlbinlog) . + " --no-defaults --disable-force-if-open --debug-info"; if ( !$opt_extern && $mysql_version_id >= 50000 ) { $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir"; @@ -1934,7 +1999,8 @@ sub environment_setup () { # Setup env so childs can execute mysql # ---------------------------------------------------- my $cmdline_mysql= - "$exe_mysql --no-defaults --debug-info --host=localhost --user=root --password= " . + mtr_native_path($exe_mysql) . + " --no-defaults --debug-info --host=localhost --user=root --password= " . "--port=$master->[0]->{'port'} " . "--socket=$master->[0]->{'path_sock'} ". "--character-sets-dir=$path_charsetsdir"; @@ -1966,6 +2032,7 @@ sub environment_setup () { "--port=$master->[0]->{'port'} " . "--socket=$master->[0]->{'path_sock'}"; $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; + } if (!$opt_extern) { @@ -1975,17 +2042,17 @@ sub environment_setup () { # ---------------------------------------------------- # Setup env so childs can execute my_print_defaults # ---------------------------------------------------- - $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults; + $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults); # ---------------------------------------------------- # Setup env so childs can execute mysqladmin # ---------------------------------------------------- - $ENV{'MYSQLADMIN'}= $exe_mysqladmin; + $ENV{'MYSQLADMIN'}= mtr_native_path($exe_mysqladmin); # ---------------------------------------------------- # Setup env so childs can execute perror # ---------------------------------------------------- - $ENV{'MY_PERROR'}= $exe_perror; + $ENV{'MY_PERROR'}= mtr_native_path($exe_perror); # ---------------------------------------------------- # Add the path where mysqld will find udf_example.so @@ -2144,6 +2211,16 @@ sub remove_stale_vardir () { mtr_verbose("Removing $opt_vardir/"); rmtree("$opt_vardir/"); } + + if ( $opt_mem ) + { + # A symlink from var/ to $opt_mem will be set up + # remove the $opt_mem dir to assure the symlink + # won't point at an old directory + mtr_verbose("Removing $opt_mem"); + rmtree($opt_mem); + } + } else { @@ -2774,10 +2851,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 @@ -2895,42 +2969,13 @@ sub install_db ($$) { my $type= shift; my $data_dir= shift; - my $init_db_sql= "lib/init_db.sql"; - my $init_db_sql_tmp= "/tmp/init_db.sql$$"; - my $args; - mtr_report("Installing \u$type Database"); - open(IN, $init_db_sql) - or mtr_error("Can't open $init_db_sql: $!"); - open(OUT, ">", $init_db_sql_tmp) - or mtr_error("Can't write to $init_db_sql_tmp: $!"); - while (<IN>) - { - chomp; - s/\@HOSTNAME\@/$glob_hostname/; - if ( /^\s*$/ ) - { - print OUT "\n"; - } - elsif (/;$/) - { - print OUT "$_\n"; - } - else - { - print OUT "$_ "; - } - } - close OUT; - close IN; + my $args; mtr_init_args(\$args); - mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--bootstrap"); - mtr_add_arg($args, "--console"); - mtr_add_arg($args, "--skip-grant-tables"); mtr_add_arg($args, "--basedir=%s", $path_my_basedir); mtr_add_arg($args, "--datadir=%s", $data_dir); mtr_add_arg($args, "--loose-skip-innodb"); @@ -2957,21 +3002,55 @@ sub install_db ($$) { # --bootstrap, to accommodate this. my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || $exe_mysqld; + # ---------------------------------------------------------------------- + # export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args> + # ---------------------------------------------------------------------- + $ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args); + + # ---------------------------------------------------------------------- + # Create the bootstrap.sql file + # ---------------------------------------------------------------------- + my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql"; + + # Use the mysql database for system tables + mtr_tofile($bootstrap_sql_file, "use mysql"); + + # Add the offical mysql system tables + # for a production system + mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql", + $bootstrap_sql_file); + + # Add the mysql system tables initial data + # for a production system + mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables_data.sql", + $bootstrap_sql_file); + + # Add test data for timezone - this is just a subset, on a real + # system these tables will be populated either by mysql_tzinfo_to_sql + # or by downloading the timezone table package from our website + mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql", + $bootstrap_sql_file); + + # Fill help tables, just an empty file when running from bk repo + # but will be replaced by a real fill_help_tables.sql when + # building the source dist + mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql", + $bootstrap_sql_file); + # Log bootstrap command my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; mtr_tofile($path_bootstrap_log, "$exe_mysqld_bootstrap " . join(" ", @$args) . "\n"); - if ( mtr_run($exe_mysqld_bootstrap, $args, $init_db_sql_tmp, + if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file, $path_bootstrap_log, $path_bootstrap_log, "", { append_log_file => 1 }) != 0 ) { - unlink($init_db_sql_tmp); mtr_error("Error executing mysqld --bootstrap\n" . - "Could not install $type test DBs"); + "Could not install system database from $bootstrap_sql_file\n" . + "see $path_bootstrap_log for errors"); } - unlink($init_db_sql_tmp); } @@ -3039,6 +3118,7 @@ language = $path_language character-sets-dir = $path_charsetsdir basedir = $path_my_basedir server_id = $server_id +shutdown-delay = 10 skip-stack-trace loose-skip-innodb loose-skip-ndbcluster @@ -3601,21 +3681,20 @@ sub do_before_start_slave ($) { } -sub mysqld_arguments ($$$$$) { +sub mysqld_arguments ($$$$) { my $args= shift; - my $type= shift; - my $idx= shift; + my $mysqld= shift; my $extra_opt= shift; my $slave_master_info= shift; + my $idx= $mysqld->{'idx'}; my $sidx= ""; # Index as string, 0 is empty string - if ( $idx > 0 ) + if ( $idx> 0 ) { - $sidx= "$idx"; + $sidx= $idx; } my $prefix= ""; # If mysqltest server arg - if ( $glob_use_embedded_server ) { $prefix= "--server-arg="; @@ -3627,6 +3706,20 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir); mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir); + 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); + } + if ( $mysql_version_id >= 50000 ) { mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix); @@ -3646,36 +3739,55 @@ sub mysqld_arguments ($$$$$) { } } + mtr_add_arg($args, "%s--pid-file=%s", $prefix, + $mysqld->{'path_pid'}); + + mtr_add_arg($args, "%s--port=%d", $prefix, + $mysqld->{'port'}); + + mtr_add_arg($args, "%s--socket=%s", $prefix, + $mysqld->{'path_sock'}); + + mtr_add_arg($args, "%s--datadir=%s", $prefix, + $mysqld->{'path_myddir'}); + + + if ( $mysql_version_id >= 50106 ) + { + # Turn on logging to bothe tables and file + mtr_add_arg($args, "%s--log-output=table,file", $prefix); + } + + my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx"; + mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path); + mtr_add_arg($args, + "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path); + # Check if "extra_opt" contains --skip-log-bin my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt); - if ( $type eq 'master' ) + if ( $mysqld->{'type'} eq 'master' ) { - my $id= $idx > 0 ? $idx + 101 : 1; - if (! ($opt_skip_master_binlog || $skip_binlog) ) { mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix, $opt_vardir, $sidx); } - mtr_add_arg($args, "%s--pid-file=%s", $prefix, - $master->[$idx]->{'path_pid'}); - mtr_add_arg($args, "%s--port=%d", $prefix, - $master->[$idx]->{'port'}); - mtr_add_arg($args, "%s--server-id=%d", $prefix, $id); - mtr_add_arg($args, "%s--socket=%s", $prefix, - $master->[$idx]->{'path_sock'}); - mtr_add_arg($args, "%s--innodb_data_file_path=ibdata1:10M:autoextend", $prefix); + + 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", + $prefix); + mtr_add_arg($args, "%s--local-infile", $prefix); - mtr_add_arg($args, "%s--datadir=%s", $prefix, - $master->[$idx]->{'path_myddir'}); if ( $idx > 0 or !$use_innodb) { mtr_add_arg($args, "%s--skip-innodb", $prefix); } - my $cluster= $clusters->[$master->[$idx]->{'cluster'}]; + my $cluster= $clusters->[$mysqld->{'cluster'}]; if ( $opt_skip_ndbcluster || !$cluster->{'pid'}) { @@ -3692,28 +3804,14 @@ sub mysqld_arguments ($$$$$) { } } - if ( $mysql_version_id <= 50106 ) - { - # Force mysqld to use log files up until 5.1.6 - mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'}); - } - else - { - # Turn on logging, will be sent to tables - mtr_add_arg($args, "%s--log=", $prefix); - } - mtr_add_arg($args, "%s--plugin_dir=%s", $prefix, dirname($lib_example_plugin)); } - - if ( $type eq 'slave' ) + else { - my $slave_server_id= 2 + $idx; - my $slave_rpl_rank= $slave_server_id; + mtr_error("unknown mysqld type") + unless $mysqld->{'type'} eq 'slave'; - mtr_add_arg($args, "%s--datadir=%s", $prefix, - $slave->[$idx]->{'path_myddir'}); mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix); if (! ( $opt_skip_slave_binlog || $skip_binlog )) { @@ -3723,18 +3821,14 @@ sub mysqld_arguments ($$$$$) { } mtr_add_arg($args, "%s--master-retry-count=10", $prefix); - mtr_add_arg($args, "%s--pid-file=%s", $prefix, - $slave->[$idx]->{'path_pid'}); - mtr_add_arg($args, "%s--port=%d", $prefix, - $slave->[$idx]->{'port'}); + mtr_add_arg($args, "%s--relay-log=%s/log/slave%s-relay-bin", $prefix, $opt_vardir, $sidx); mtr_add_arg($args, "%s--report-host=127.0.0.1", $prefix); mtr_add_arg($args, "%s--report-port=%d", $prefix, - $slave->[$idx]->{'port'}); + $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-ndbcluster", $prefix); mtr_add_arg($args, "%s--skip-slave-start", $prefix); # Directory where slaves find the dumps generated by "load data" @@ -3743,8 +3837,6 @@ sub mysqld_arguments ($$$$$) { my $slave_load_path= "../tmp"; mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix, $slave_load_path); - mtr_add_arg($args, "%s--socket=%s", $prefix, - $slave->[$idx]->{'path_sock'}); mtr_add_arg($args, "%s--set-variable=slave_net_timeout=10", $prefix); if ( @$slave_master_info ) @@ -3762,13 +3854,16 @@ sub mysqld_arguments ($$$$$) { 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 || - $slave->[$idx]->{'cluster'} == -1 || - !$clusters->[$slave->[$idx]->{'cluster'}]->{'pid'} ) + $mysqld->{'cluster'} == -1 || + !$clusters->[$mysqld->{'cluster'}]->{'pid'} ) { mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix); } @@ -3776,41 +3871,21 @@ sub mysqld_arguments ($$$$$) { { mtr_add_arg($args, "%s--ndbcluster", $prefix); mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix, - $clusters->[$slave->[$idx]->{'cluster'}]->{'connect_string'}); + $clusters->[$mysqld->{'cluster'}]->{'connect_string'}); + if ( $mysql_version_id >= 50100 ) { mtr_add_arg($args, "%s--ndb-extra-logging", $prefix); } } - - if ( $mysql_version_id <= 50106 ) - { - # Force mysqld to use log files up until 5.1.6 - mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'}); - } - else - { - # Turn on logging, will be sent to tables - mtr_add_arg($args, "%s--log=", $prefix); - } - } # end slave if ( $opt_debug ) { - if ( $type eq 'master' ) - { - mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/master%s.trace", - $prefix, $path_vardir_trace, $sidx); - } - if ( $type eq 'slave' ) - { - mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/slave%s.trace", - $prefix, $path_vardir_trace, $sidx); - } + mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace", + $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx); } - # FIXME always set nowdays??? SMALL_SERVER mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix); mtr_add_arg($args, "%s--sort_buffer=256K", $prefix); mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix); @@ -3836,18 +3911,10 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--gdb", $prefix); } - # If we should run all tests cases, we will use a local server for that - - if ( -w "/" ) - { - # We are running as root; We need to add the --root argument - mtr_add_arg($args, "%s--user=root", $prefix); - } - my $found_skip_core= 0; foreach my $arg ( @opt_extra_mysqld_opt, @$extra_opt ) { - # Allow --skip-core-file to be set in master.opt file + # Allow --skip-core-file to be set in <testname>-[master|slave].opt file if ($arg eq "--skip-core-file") { $found_skip_core= 1; @@ -3871,7 +3938,7 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--rpl-recovery-rank=1", $prefix); mtr_add_arg($args, "%s--init-rpl-role=master", $prefix); } - elsif ( $type eq 'master' ) + elsif ( $mysqld->{'type'} eq 'master' ) { mtr_add_arg($args, "%s--open-files-limit=1024", $prefix); } @@ -3922,7 +3989,7 @@ sub mysqld_start ($$$) { valgrind_arguments($args, \$exe); } - mysqld_arguments($args,$type,$idx,$extra_opt,$slave_master_info); + mysqld_arguments($args,$mysqld,$extra_opt,$slave_master_info); if ( $opt_gdb || $opt_manual_gdb) { @@ -4667,13 +4734,14 @@ sub run_mysqltest ($) { if ( $glob_use_embedded_server ) { - mysqld_arguments($args,'master',0,$tinfo->{'master_opt'},[]); + mysqld_arguments($args,$master->[0],$tinfo->{'master_opt'},[]); } # ---------------------------------------------------------------------- # export MYSQL_TEST variable containing <path>/mysqltest <args> # ---------------------------------------------------------------------- - $ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args); + $ENV{'MYSQL_TEST'}= + mtr_native_path($exe_mysqltest) . " " . join(" ", @$args); # ---------------------------------------------------------------------- # Add arguments that should not go into the MYSQL_TEST env var @@ -4884,9 +4952,7 @@ sub debugger_arguments { my $exe= shift; my $debugger= $opt_debugger || $opt_client_debugger; - # FIXME Need to change the below "eq"'s to - # "case unsensitive string contains" - if ( $debugger eq "vcexpress" or $debugger eq "vc") + if ( $debugger =~ /vcexpress|vc|devenv/ ) { # vc[express] /debugexe exe arg1 .. argn @@ -4894,22 +4960,37 @@ sub debugger_arguments { unshift(@$$args, "/debugexe"); unshift(@$$args, "$$exe"); + # Set exe to debuggername + $$exe= $debugger; + } - elsif ( $debugger eq "windbg" ) + elsif ( $debugger =~ /windbg/ ) { # windbg exe arg1 .. argn # Add name of the exe before args unshift(@$$args, "$$exe"); + # Set exe to debuggername + $$exe= $debugger; + + } + elsif ( $debugger eq "dbx" ) + { + # xterm -e dbx -r exe arg1 .. argn + + unshift(@$$args, $$exe); + unshift(@$$args, "-r"); + unshift(@$$args, $debugger); + unshift(@$$args, "-e"); + + $$exe= "xterm"; + } else { mtr_error("Unknown argument \"$debugger\" passed to --debugger"); } - - # Set exe to debuggername - $$exe= $debugger; } @@ -4983,7 +5064,7 @@ Options to control what engine/variation to run skip-ssl Dont start server with support for ssl connections bench Run the benchmark suite small-bench Run the benchmarks with --small-tests --small-tables - with-ndbcluster Use cluster as default table type for benchmark + ndb|with-ndbcluster Use cluster as default table type vs-config Visual Studio configuration used to create executables (default: MTR_VS_CONFIG environment variable) |