diff options
Diffstat (limited to 'mysql-test/mysql-test-run.pl')
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 72 |
1 files changed, 59 insertions, 13 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index d6aa08a205a..0bf0245325a 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1,5 +1,23 @@ #!/usr/bin/perl # -*- cperl -*- + +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. +# Copyright (c) 2009-2011 Monty Program Ab +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + # ############################################################################## # @@ -168,6 +186,7 @@ my $opt_cursor_protocol; my $opt_view_protocol; our $opt_debug; +our $opt_debug_server; our @opt_cases; # The test cases names in argv our $opt_embedded_server; @@ -995,6 +1014,7 @@ sub command_line_setup { # Debugging 'debug' => \$opt_debug, + 'debug-server' => \$opt_debug_server, 'gdb' => \$opt_gdb, 'client-gdb' => \$opt_client_gdb, 'manual-gdb' => \$opt_manual_gdb, @@ -1153,6 +1173,20 @@ sub command_line_setup { my $path_share= dirname($path_language); $path_charsetsdir= mtr_path_exists("$path_share/charsets"); + # --debug implies we run debug server + $opt_debug_server= 1 if $opt_debug; + + if (using_extern()) + { + # Connect to the running mysqld and find out what it supports + collect_mysqld_features_from_running_server(); + } + else + { + # Run the mysqld to find out what features are available + collect_mysqld_features(); + } + if ( $opt_comment ) { mtr_report(); @@ -1178,7 +1212,7 @@ sub command_line_setup { chomp; # remove comments (# foo) at the beginning of the line, or after a # blank at the end of the line - s/( +|^)#.*$//; + s/(\s+|^)#.*$//; # If @ platform specifier given, use this entry only if it contains # @<platform> or @!<xxx> where xxx != platform if (/\@.*/) @@ -1189,8 +1223,8 @@ sub command_line_setup { s/\@.*$//; } # remove whitespace - s/^ +//; - s/ +$//; + s/^\s+//; + s/\s+$//; # if nothing left, don't need to remember this line if ( $_ eq "" ) { next; @@ -1802,7 +1836,7 @@ sub find_mysqld { my @mysqld_names= ("mysqld", "mysqld-max-nt", "mysqld-max", "mysqld-nt"); - if ( $opt_debug ){ + if ( $opt_debug_server ){ # Put mysqld-debug first in the list of binaries to look for mtr_verbose("Adding mysqld-debug first in list of binaries to look for"); unshift(@mysqld_names, "mysqld-debug"); @@ -1872,9 +1906,12 @@ sub executable_setup () { sub client_debug_arg($$) { my ($args, $client_name)= @_; + # Workaround for Bug #50627: drop any debug opt + return if $client_name =~ /^mysqlbinlog/; + if ( $opt_debug ) { mtr_add_arg($args, - "--debug=d:t:A,%s/log/%s.trace", + "--loose-debug=d:t:A,%s/log/%s.trace", $path_vardir_trace, $client_name) } } @@ -2237,10 +2274,12 @@ sub environment_setup { # mysqlhotcopy # ---------------------------------------------------- my $mysqlhotcopy= - mtr_pl_maybe_exists("$basedir/scripts/mysqlhotcopy"); - # Since mysqltest interprets the real path as "false" in an if, - # use 1 ("true") to indicate "not exists" so it can be tested for - $ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy || 1; + mtr_pl_maybe_exists("$basedir/scripts/mysqlhotcopy") || + mtr_pl_maybe_exists("$path_client_bindir/mysqlhotcopy"); + if ($mysqlhotcopy) + { + $ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy; + } # ---------------------------------------------------- # perror @@ -2534,9 +2573,9 @@ sub check_debug_support ($) { #mtr_report(" - binaries are not debug compiled"); $debug_compiled_binaries= 0; - if ( $opt_debug ) + if ( $opt_debug_server ) { - mtr_error("Can't use --debug, binaries does not support it"); + mtr_error("Can't use --debug[-server], binary does not support it"); } return; } @@ -4627,8 +4666,10 @@ sub check_expected_crash_and_restart { { mtr_verbose("Crash was expected, file '$expect_file' exists"); - for (my $waits = 0; $waits < 50; $waits++) + for (my $waits = 0; $waits < 50; mtr_milli_sleep(100), $waits++) { + # Race condition seen on Windows: try again until file not empty + next if -z $expect_file; # If last line in expect file starts with "wait" # sleep a little and try again, thus allowing the # test script to control when the server should start @@ -4637,10 +4678,11 @@ sub check_expected_crash_and_restart { if ($last_line =~ /^wait/ ) { mtr_verbose("Test says wait before restart") if $waits == 0; - mtr_milli_sleep(100); next; } + # Ignore any partial or unknown command + next unless $last_line =~ /^restart/; # If last line begins "restart:", the rest of the line is read as # extra command line options to add to the restarted mysqld. # Anything other than 'wait' or 'restart:' (with a colon) will @@ -4990,6 +5032,8 @@ sub mysqld_start ($$) { my @all_opts= @$extra_opts; if (exists $mysqld->{'restart_opts'}) { push (@all_opts, @{$mysqld->{'restart_opts'}}); + mtr_verbose(My::Options::toStr("mysqld_start restart", + @{$mysqld->{'restart_opts'}})); } mysqld_arguments($args,$mysqld,\@all_opts); @@ -5960,6 +6004,8 @@ Options for debugging the product client-gdb Start mysqltest client in gdb ddd Start mysqld in ddd debug Dump trace output for all servers and client programs + debug-server Use debug version of server, but without turning on + tracing debugger=NAME Start mysqld in the selected debugger gdb Start the mysqld(s) in gdb manual-debug Let user manually start mysqld in debugger, before |