diff options
Diffstat (limited to 'mysql-test/mysql-test-run.pl')
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 167 |
1 files changed, 121 insertions, 46 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index b342421ca2e..530d8cd83cb 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -135,7 +135,7 @@ our $default_vardir; our $opt_usage; our $opt_suites; -our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb"; # Default suites to run +our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb,maria"; # Default suites to run our $opt_script_debug= 0; # Script debugging, enable with --script-debug our $opt_verbose= 0; # Verbose output, enable with --verbose @@ -173,6 +173,7 @@ our @opt_combinations; our $opt_skip_combination; our @opt_extra_mysqld_opt; +our @opt_extra_mysqltest_opt; our $opt_compress; our $opt_ssl; @@ -432,7 +433,7 @@ sub main () { my $tests= collect_test_cases($opt_suites); # Turn off NDB and other similar options if no tests use it - my ($need_ndbcluster,$need_im); + my ($need_ndbcluster,$need_im, $need_debug); foreach my $test (@$tests) { next if $test->{skip}; @@ -440,6 +441,7 @@ sub main () { if (!$opt_extern) { $need_ndbcluster||= $test->{ndb_test}; + $need_debug||=$test->{need_debug}; $need_im||= $test->{component_id} eq 'im'; # Count max number of slaves used by a test case @@ -465,6 +467,11 @@ sub main () { $opt_skip_ndbcluster_slave= 1; } + if ( !$need_debug && !$opt_debug) + { + $opt_debug=0; + } + # Check if slave cluster can be skipped if ($max_slave_num == 0) { @@ -601,6 +608,9 @@ sub command_line_setup () { # Extra options used when starting mysqld 'mysqld=s' => \@opt_extra_mysqld_opt, + # Extra options used when starting mysqld + 'mysqltest=s' => \@opt_extra_mysqltest_opt, + # Run test on running server 'extern' => \$opt_extern, 'ndb-connectstring=s' => \$opt_ndbconnectstring, @@ -978,7 +988,7 @@ sub command_line_setup () { # -------------------------------------------------------------------------- if ($opt_extern) { - mtr_report("Disable instance manager when running with extern mysqld"); + # mtr_report("Disable instance manager when running with extern mysqld"); $opt_skip_im= 1; } elsif ( $mysql_version_id < 50000 ) @@ -1351,19 +1361,6 @@ sub command_line_setup () { $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log"; $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/"; - - if ( $opt_valgrind and $opt_debug ) - { - # When both --valgrind and --debug is selected, send - # all output to the trace file, making it possible to - # see the exact location where valgrind complains - foreach my $mysqld (@{$master}, @{$slave}) - { - my $sidx= $mysqld->{idx} ? "$mysqld->{idx}" : ""; - $mysqld->{path_myerr}= - "$opt_vardir/log/" . $mysqld->{type} . "$sidx.trace"; - } - } } # @@ -2166,7 +2163,10 @@ sub environment_setup () { $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; } - $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; + if ( !$opt_extern ) + { + $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; + } # ---------------------------------------------------- # Setup env so childs can execute my_print_defaults @@ -2216,6 +2216,22 @@ sub environment_setup () { "$glob_basedir/myisam/myisampack")); # ---------------------------------------------------- + # Setup env so childs can execute maria_pack and maria_chk + # ---------------------------------------------------- + $ENV{'MARIA_CHK'}= mtr_native_path(mtr_exe_maybe_exists( + vs_config_dirs('storage/maria', 'maria_chk'), + vs_config_dirs('maria', 'maria_chk'), + "$path_client_bindir/maria_chk", + "$glob_basedir/storage/maria/maria_chk", + "$glob_basedir/maria/maria_chk")); + $ENV{'MARIA_PACK'}= mtr_native_path(mtr_exe_maybe_exists( + vs_config_dirs('storage/maria', 'maria_pack'), + vs_config_dirs('maria', 'maria_pack'), + "$path_client_bindir/maria_pack", + "$glob_basedir/storage/maria/maria_pack", + "$glob_basedir/maria/maria_pack")); + + # ---------------------------------------------------- # We are nice and report a bit about our settings # ---------------------------------------------------- if (!$opt_extern) @@ -2466,6 +2482,25 @@ sub setup_vardir() { { unlink($name); } + if ( $opt_valgrind and $opt_debug ) + { + # When both --valgrind and --debug is selected, send + # all output to the trace file, making it possible to + # see the exact location where valgrind complains + foreach my $mysqld (@{$master}, @{$slave}) + { + my $sidx= $mysqld->{idx} ? "$mysqld->{idx}" : ""; + my $trace_name= "$opt_vardir/log/" . $mysqld->{type} . "$sidx.trace"; + open(LOG, ">$mysqld->{path_myerr}") or die "Can't create $mysqld->{path_myerr}\n"; + print LOG " +NOTE: When running with --valgrind --debug the output from the .err file is +stored together with the trace file to make it easier to find the exact +position for valgrind errors. +See trace file $trace_name.\n"; + close(LOG); + $mysqld->{path_myerr}= $trace_name; + } + } } @@ -3142,8 +3177,8 @@ sub install_db ($$) { mtr_report("Installing \u$type Database"); - my $args; + my $cmd_args; mtr_init_args(\$args); mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--bootstrap"); @@ -3151,9 +3186,17 @@ sub install_db ($$) { mtr_add_arg($args, "--datadir=%s", $data_dir); mtr_add_arg($args, "--loose-skip-innodb"); mtr_add_arg($args, "--loose-skip-ndbcluster"); + mtr_add_arg($args, "--disable-sync-frm"); + mtr_add_arg($args, "--loose-disable-debug"); mtr_add_arg($args, "--tmpdir=."); mtr_add_arg($args, "--core-file"); + # + # Setup args for bootstrap.test + # + mtr_init_args(\$cmd_args); + mtr_add_arg($cmd_args, "--loose-skip-maria"); + if ( $opt_debug ) { mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace", @@ -3176,7 +3219,8 @@ sub install_db ($$) { # ---------------------------------------------------------------------- # export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args> # ---------------------------------------------------------------------- - $ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args); + $ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args) . + " " . join(" ", @$cmd_args); # ---------------------------------------------------------------------- # Create the bootstrap.sql file @@ -3287,9 +3331,11 @@ socket = $instance->{path_sock} pid-file = $instance->{path_pid} port = $instance->{port} datadir = $instance->{path_datadir} -log = $instance->{path_datadir}/mysqld$server_id.log +general-log-file = $instance->{path_datadir}/mysqld$server_id.log +general-log = 1 log-error = $instance->{path_datadir}/mysqld$server_id.err.log -log-slow-queries = $instance->{path_datadir}/mysqld$server_id.slow.log +slow-query-log-file = $instance->{path_datadir}/mysqld$server_id.slow.log +slow-query-log = 1 language = $path_language character-sets-dir = $path_charsetsdir basedir = $path_my_basedir @@ -3354,6 +3400,24 @@ sub run_testcase_check_skip_test($) my ($tinfo)= @_; # ---------------------------------------------------------------------- + # Skip some tests silently + # ---------------------------------------------------------------------- + + if ( $::opt_start_from ) + { + if ($tinfo->{'name'} eq $::opt_start_from ) + { + ## Found parting test. Run this test and all tests after this one + $::opt_start_from= ""; + } + else + { + $tinfo->{'result'}= 'MTR_RES_SKIPPED'; + return 1; + } + } + + # ---------------------------------------------------------------------- # If marked to skip, just print out and return. # Note that a test case not marked as 'skip' can still be # skipped later, because of the test case itself in cooperation @@ -3886,15 +3950,17 @@ 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) + if (!$opt_extern) { - # By default, prevent the started mysqld to access files outside of vardir - mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir); - } + if ( $mysql_version_id >= 50036) + { + # Prevent the started mysqld to access files outside of vardir + mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir); + } - if ( $mysql_version_id >= 50000 ) - { - mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix); + if ( $mysql_version_id >= 50000 ) { + mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix); + } } mtr_add_arg($args, "%s--default-character-set=latin1", $prefix); @@ -3937,17 +4003,22 @@ sub mysqld_arguments ($$$$) { mtr_add_arg($args, "%s--datadir=%s", $prefix, $mysqld->{'path_myddir'}); + mtr_add_arg($args, "%s--disable-sync-frm", $prefix); # Faster test - if ( $mysql_version_id >= 50106 ) + if (!$opt_extern and $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--general-log-file=%s.log", + $prefix, $log_base_path); + mtr_add_arg($args, "--general-log"); mtr_add_arg($args, - "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path); + "%s--slow-query-log-file=%s-slow.log", + $prefix, $log_base_path); + mtr_add_arg($args, "--slow-query-log"); # Check if "extra_opt" contains --skip-log-bin my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt); @@ -4065,10 +4136,17 @@ sub mysqld_arguments ($$$$) { } # end slave - if ( $opt_debug ) + if ( $debug_compiled_binaries && defined $opt_debug ) { - mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace", - $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx); + if ( $opt_debug ) + { + mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace", + $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx); + } + else + { + mtr_add_arg($args, "--disable-debug"); + } } mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix); @@ -4923,6 +5001,11 @@ sub run_mysqltest ($) { mtr_add_arg($args, "--skip-ssl"); } + foreach my $arg ( @opt_extra_mysqltest_opt ) + { + mtr_add_arg($args, "%s", $arg); + } + # ---------------------------------------------------------------------- # If embedded server, we create server args to give mysqltest to pass on # ---------------------------------------------------------------------- @@ -5038,13 +5121,9 @@ sub gdb_arguments { else { # write init file for mysqld - mtr_tofile($gdb_init_file, - "set args $str\n" . - "break mysql_parse\n" . - "commands 1\n" . - "disable 1\n" . - "end\n" . - "run"); + mtr_tofile($gdb_init_file, <<EOGDB ); +set args $str +EOGDB } if ( $opt_manual_gdb ) @@ -5104,11 +5183,7 @@ sub ddd_arguments { # write init file for mysqld mtr_tofile($gdb_init_file, "file $$exe\n" . - "set args $str\n" . - "break mysql_parse\n" . - "commands 1\n" . - "disable 1\n" . - "end"); + "set args $str\n"); } if ( $opt_manual_ddd ) |