From 89000a3c152f3743ccc8eaabcbd30314f6df1e9e Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 16 Jun 2009 15:26:17 +0200 Subject: [PATCH 01/29] Bug #45298 plugin.test is skipped in PB2 on UNIX platforms Added search for example plugin in lib/mysql/plugin --- mysql-test/mysql-test-run.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 2a6a069d81c..4e89fd899ce 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1763,7 +1763,8 @@ sub environment_setup { if ($mysql_version_id >= 50100) { my $lib_example_plugin= mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'), - "$basedir/storage/example/.libs/ha_example.so",); + "$basedir/storage/example/.libs/ha_example.so", + "$basedir/lib/mysql/plugin/ha_example.so",); $ENV{'EXAMPLE_PLUGIN'}= ($lib_example_plugin ? basename($lib_example_plugin) : ""); $ENV{'EXAMPLE_PLUGIN_OPT'}= "--plugin-dir=". From 63910fc2a04baf6376578af6e758037b827cca4e Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 22 Jun 2009 16:27:05 +0200 Subject: [PATCH 02/29] Bug #43780 mysql-test-run uses deprecated server options Updated to use general_log[_file] and slow_query_log[_file] --- mysql-test/lib/My/ConfigFactory.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index 852f706c858..c1e8f7cd826 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -204,8 +204,10 @@ my @mysqld_rules= { 'port' => \&fix_port }, { 'socket' => \&fix_socket }, { '#log-error' => \&fix_log_error }, - { 'log' => \&fix_log }, - { 'log-slow-queries' => \&fix_log_slow_queries }, + { 'general_log' => 1 }, + { 'general_log_file' => \&fix_log }, + { 'slow_query_log' => 1 }, + { 'slow_query_log_file' => \&fix_log_slow_queries }, { '#user' => sub { return shift->{ARGS}->{user} || ""; } }, { '#password' => sub { return shift->{ARGS}->{password} || ""; } }, { 'server-id' => \&fix_server_id, }, From c63b8f402ac0112fb019b40613ea6337fee17ea2 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 22 Jun 2009 16:29:02 +0200 Subject: [PATCH 03/29] Bug #45532 MTR displays wrong option name 'print_testcases' in usage text Fix the name.... --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4e89fd899ce..e6e8a77f3ed 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5113,7 +5113,7 @@ Options to control what test suites or cases to run skip-rpl Skip the replication test cases. big-test Also run tests marked as "big" enable-disabled Run also tests marked as disabled - print_testcases Don't run the tests but print details about all the + print-testcases Don't run the tests but print details about all the selected tests, in the order they would be run. Options that specify ports From 8d6a25a23f8d3453a2d729b79553a5b64a7c4b40 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 15 Jul 2009 14:20:56 +0200 Subject: [PATCH 04/29] Bug #43005 main.init_connect fais on Windows in PB2 Server args containing spaces do not work on Windows Fixed my_safe_rprocess-win to re-apply "" around such args --- mysql-test/lib/My/SafeProcess/safe_process_win.cc | 9 ++++++++- mysql-test/suite/rpl/t/disabled.def | 1 - mysql-test/t/disabled.def | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc index 80c1b7a97f2..d85a9558a62 100755 --- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc @@ -188,7 +188,14 @@ int main(int argc, const char** argv ) die("No real args -> nothing to do"); /* Copy the remaining args to child_arg */ for (int j= i+1; j < argc; j++) { - to+= _snprintf(to, child_args + sizeof(child_args) - to, "%s ", argv[j]); + if (strchr (argv[j], ' ')) { + /* Protect with "" if this arg contains a space */ + to+= _snprintf(to, child_args + sizeof(child_args) - to, + "\"%s\" ", argv[j]); + } else { + to+= _snprintf(to, child_args + sizeof(child_args) - to, + "%s ", argv[j]); + } } break; } else { diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index fcc3d56a9f5..38fc9e21322 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,4 +11,3 @@ ############################################################################## rpl_cross_version : Bug#42311 2009-03-27 joro rpl_cross_version fails on macosx -rpl_init_slave : Bug#44920 2009-05-18 pcrews MTR2 is not processing master.opt input properly on Windows diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index af4eb44b464..6d8f0af0c28 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -12,4 +12,3 @@ kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. innodb_bug39438 : Bug#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently" query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically -init_connect : Bug#44920 2009-05-18 pcrews MTR2 is not processing master.opt input properly on Windows From 0952b9b59b0000c81d1f6e3a234721c5c6e1b434 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 16 Jul 2009 14:05:46 +0200 Subject: [PATCH 05/29] Bug #45698 MTR_VERSION=1 ./mtr --force does not work General problem: some test cannot run in V1, expect more in future Implement general mechanism for listing incompatible tests --- mysql-test/lib/v1/incompatible.tests | 6 ++++++ mysql-test/lib/v1/mtr_cases.pl | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 mysql-test/lib/v1/incompatible.tests diff --git a/mysql-test/lib/v1/incompatible.tests b/mysql-test/lib/v1/incompatible.tests new file mode 100644 index 00000000000..fefdad9ce4c --- /dev/null +++ b/mysql-test/lib/v1/incompatible.tests @@ -0,0 +1,6 @@ +# This file lists tests that cannot run in MTR v1 for some reason. +# They will be skipped. +# Any text following white space after full test name is ignored +# Only exact test names can be used, no regexp. + +main.fulltext_plugin # Refers to $SIMPLE_PARSER_OPT which is not set diff --git a/mysql-test/lib/v1/mtr_cases.pl b/mysql-test/lib/v1/mtr_cases.pl index 4d7b1f4ec70..bed24bcabfb 100644 --- a/mysql-test/lib/v1/mtr_cases.pl +++ b/mysql-test/lib/v1/mtr_cases.pl @@ -32,6 +32,7 @@ sub mtr_options_from_test_file($$); my $do_test; my $skip_test; +my %incompatible; sub init_pattern { my ($from, $what)= @_; @@ -47,6 +48,15 @@ sub init_pattern { } +sub collect_incomp_tests { + open (INCOMP, "lib/v1/incompatible.tests"); + while () + { + next unless /^\w/; + s/\s.*\n//; # Ignore anything from first white space + $incompatible{$_}= 1; + } +} ############################################################################## # @@ -58,6 +68,8 @@ sub collect_test_cases ($) { $do_test= init_pattern($::opt_do_test, "--do-test"); $skip_test= init_pattern($::opt_skip_test, "--skip-test"); + collect_incomp_tests(); + my $suites= shift; # Semicolon separated list of test suites my $cases = []; # Array of hash @@ -528,6 +540,13 @@ sub collect_one_test_case($$$$$$$$$) { $tinfo->{'component_id'} = $component_id; push(@$cases, $tinfo); + if (exists ($incompatible{$tinfo->{'name'}})) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Test cannot run in mtr v1"; + return; + } + # ---------------------------------------------------------------------- # Skip some tests but include in list, just mark them to skip # ---------------------------------------------------------------------- From 53e14eaa0aab03020b7ae268e3a45d03ab6d7ac0 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 17 Jul 2009 10:41:04 +0200 Subject: [PATCH 06/29] Bug #45700 MTR v1 --start-and-exit --default-storage-engine=Innodb is froken Change of variable states in Bug 19027 was not backported to v1 Changed ne "TRUE" to eq "OFF" --- mysql-test/lib/v1/mtr_cases.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/lib/v1/mtr_cases.pl b/mysql-test/lib/v1/mtr_cases.pl index bed24bcabfb..906e330282a 100644 --- a/mysql-test/lib/v1/mtr_cases.pl +++ b/mysql-test/lib/v1/mtr_cases.pl @@ -860,7 +860,7 @@ sub collect_one_test_case($$$$$$$$$) { if ( $tinfo->{'innodb_test'} ) { # This is a test that need innodb - if ( $::mysqld_variables{'innodb'} ne "TRUE" ) + if ( $::mysqld_variables{'innodb'} eq "OFF" ) { # innodb is not supported, skip it $tinfo->{'skip'}= 1; From 2399987a2a53c54b29cb76e574de8676466f77c8 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 23 Jul 2009 19:01:24 +0200 Subject: [PATCH 07/29] Bug #46212 safe_process: FATAL ERROR, Unknown option: --nocore Also fixed mysqld.cc to avoid popup-boxes --- .../lib/My/SafeProcess/safe_process_win.cc | 30 ++++++++++++------- sql/mysqld.cc | 19 ++++++------ 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc index d85a9558a62..455262b29f5 100755 --- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc @@ -163,6 +163,7 @@ int main(int argc, const char** argv ) HANDLE job_handle; HANDLE wait_handles[NUM_HANDLES]= {0}; PROCESS_INFORMATION process_info= {0}; + BOOL nocore= FALSE; sprintf(safe_process_name, "safe_process[%d]", pid); @@ -199,18 +200,22 @@ int main(int argc, const char** argv ) } break; } else { - if ( strcmp(arg, "--verbose") == 0 ) + if (strcmp(arg, "--verbose") == 0) verbose++; - else if ( strncmp(arg, "--parent-pid", 10) == 0 ) - { - /* Override parent_pid with a value provided by user */ - const char* start; + else if (strncmp(arg, "--parent-pid", 10) == 0) + { + /* Override parent_pid with a value provided by user */ + const char* start; if ((start= strstr(arg, "=")) == NULL) - die("Could not find start of option value in '%s'", arg); - start++; /* Step past = */ - if ((parent_pid= atoi(start)) == 0) - die("Invalid value '%s' passed to --parent-id", start); - } + die("Could not find start of option value in '%s'", arg); + start++; /* Step past = */ + if ((parent_pid= atoi(start)) == 0) + die("Invalid value '%s' passed to --parent-id", start); + } + else if (strcmp(arg, "--nocore") == 0) + { + nocore= TRUE; + } else die("Unknown option: %s", arg); } @@ -248,6 +253,11 @@ int main(int argc, const char** argv ) &jeli, sizeof(jeli)) == 0) message("SetInformationJobObject failed, continue anyway..."); + /* Avoid popup box */ + if (nocore) + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX + | SEM_NOOPENFILEERRORBOX); + #if 0 /* Setup stdin, stdout and stderr redirect */ si.dwFlags= STARTF_USESTDHANDLES; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 080f78993a1..fa8b4a971d7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2103,15 +2103,14 @@ static void init_signals(void) win_install_sigabrt_handler(); if(opt_console) SetConsoleCtrlHandler(console_event_handler,TRUE); - else - { + /* Avoid MessageBox()es*/ - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); - _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); /* Do not use SEM_NOGPFAULTERRORBOX in the following SetErrorMode (), @@ -2120,8 +2119,8 @@ static void init_signals(void) exception filter is not guaranteed to work in all situation (like heap corruption or stack overflow) */ - SetErrorMode(SetErrorMode(0)|SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); - } + SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS + | SEM_NOOPENFILEERRORBOX); SetUnhandledExceptionFilter(my_unhandler_exception_filter); } From ad771f000ca2359c2a16840dc3c4529b661a8738 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 31 Jul 2009 11:22:57 +0200 Subject: [PATCH 08/29] Bug #45698 MTR_VERSION=1 ./mtr --force does not work Small amendment to original fix, as it did not work in azalea Need to handle combinations, would eventually break in 5.1 too --- mysql-test/lib/v1/mtr_cases.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mysql-test/lib/v1/mtr_cases.pl b/mysql-test/lib/v1/mtr_cases.pl index 906e330282a..288e8c22b44 100644 --- a/mysql-test/lib/v1/mtr_cases.pl +++ b/mysql-test/lib/v1/mtr_cases.pl @@ -540,7 +540,11 @@ sub collect_one_test_case($$$$$$$$$) { $tinfo->{'component_id'} = $component_id; push(@$cases, $tinfo); - if (exists ($incompatible{$tinfo->{'name'}})) + # Remove "combinations" part of test name + my $test_base_name= $tinfo->{'name'}; + $test_base_name=~ s/\s.*\n//; + + if (exists ($incompatible{$test_base_name})) { $tinfo->{'skip'}= 1; $tinfo->{'comment'}= "Test cannot run in mtr v1"; From c26dd8e87b4c4b61d990bf3b7ace0344205a23d1 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 5 Aug 2009 09:41:40 +0200 Subject: [PATCH 09/29] Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails Bug is actually in Perl Fixed by trapping and ignoring error from IO::Socket::UNIX --- mysql-test/lib/My/Platform.pm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index 69ffdfbb4ce..7c7741a5c9e 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -126,13 +126,29 @@ sub check_socket_path_length { die "Could not create UNIX domain socket: $!" unless defined $sock; + my $hostpath = eval {$sock->hostpath()}; + if ($@) { + die unless $@ =~ /^Bad arg length for Socket::unpack_sockaddr_un/; + + # Bug on AIX and i5/OS Perl IO::Socket::UNIX which dies with something + # like: + # Bad arg length for Socket::unpack_sockaddr_un, length is 25, + # should be 106 at /path/to/perl/lib/5.8.0/aix/Socket.pm line 380. + # + # Just fake it that everything is fine + $hostpath = $testfile; + } + die "UNIX domain socket path was truncated" - unless ($testfile eq $sock->hostpath()); + unless ($testfile eq $hostpath); $truncated= 0; # Yes, it worked! }; + die "Unexpected failure when checking socket path length: $@" + if $@ and $@ !~ /^UNIX domain socket path was truncated/; + $sock= undef; # Close socket rmtree($tmpdir); # Remove the tempdir and any socket file created return $truncated; From e4b2b9783922db96255143427180526154251be5 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 6 Aug 2009 09:30:53 +0200 Subject: [PATCH 10/29] Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails Bug in Perl Scrap attempt to do this smartly on AIX, just drop the test and assume it's OK This commit undoes the previous push and adds a line to ignore on AIX --- mysql-test/lib/My/Platform.pm | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index 7c7741a5c9e..371120ab644 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -106,10 +106,13 @@ sub check_socket_path_length { my ($path)= @_; return 0 if IS_WINDOWS; + # This may not be true, but we can't test for it on AIX due to Perl bug + # See Bug #45771 + return 0 if ($^O eq 'aix'); require IO::Socket::UNIX; - my $truncated= 1; # Be negative + my $truncated= undef; # Create a tempfile name with same length as "path" my $tmpdir = tempdir( CLEANUP => 0); @@ -122,32 +125,20 @@ sub check_socket_path_length { Local => $testfile, Listen => 1, ); + $truncated= 1; # Be negatvie die "Could not create UNIX domain socket: $!" unless defined $sock; - my $hostpath = eval {$sock->hostpath()}; - if ($@) { - die unless $@ =~ /^Bad arg length for Socket::unpack_sockaddr_un/; - - # Bug on AIX and i5/OS Perl IO::Socket::UNIX which dies with something - # like: - # Bad arg length for Socket::unpack_sockaddr_un, length is 25, - # should be 106 at /path/to/perl/lib/5.8.0/aix/Socket.pm line 380. - # - # Just fake it that everything is fine - $hostpath = $testfile; - } - die "UNIX domain socket path was truncated" - unless ($testfile eq $hostpath); + unless ($testfile eq $sock->hostpath()); $truncated= 0; # Yes, it worked! }; die "Unexpected failure when checking socket path length: $@" - if $@ and $@ !~ /^UNIX domain socket path was truncated/; + if $@ and not defined $truncated; $sock= undef; # Close socket rmtree($tmpdir); # Remove the tempdir and any socket file created From 687612c8c468e35d961b4b2eab12871027ffef6e Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 11 Aug 2009 12:59:43 +0200 Subject: [PATCH 11/29] Bug #44479 mysql-test-run does not detect that external server has Innodb support Variable name mismatch Map variable have_innodb=YES to innodb=ON --- mysql-test/mysql-test-run.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e6e8a77f3ed..06f02afaf5b 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1506,6 +1506,10 @@ sub collect_mysqld_features_from_running_server () } } + # "Convert" innodb flag + $mysqld_variables{'innodb'}= "ON" + if ($mysqld_variables{'have_innodb'} eq "YES"); + # Parse version my $version_str= $mysqld_variables{'version'}; if ( $version_str =~ /^([0-9]*)\.([0-9]*)\.([0-9]*)/ ) From c368771314309ae6afd7642927047e8d5435b82c Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 11 Aug 2009 15:59:05 +0200 Subject: [PATCH 12/29] Bug #45847 make --gdb disable all the timeouts by default Set to one week for testcase and suite timeout Also set one day timeout for PID file creation (not currently needed in 5.1 but might become, and is needed in azalea) --- mysql-test/mysql-test-run.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 06f02afaf5b..6a2e84d9c78 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1241,6 +1241,13 @@ sub command_line_setup { { mtr_error("Can't use --extern when using debugger"); } + # Set one week timeout (check-testcase timeout will be 1/10th) + $opt_testcase_timeout= 7 * 24 * 60; + $opt_suite_timeout= 7 * 24 * 60; + # One day to shutdown + $opt_shutdown_timeout= 24 * 60; + # One day for PID file creation (this is given in seconds not minutes) + $opt_start_timeout= 24 * 60 * 60; } # -------------------------------------------------------------------------- From c32c55eef7241d73df738faba485acffda23061c Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 11 Aug 2009 23:41:44 +0200 Subject: [PATCH 13/29] Bug #44012 mtr: test cases that are not supposed to return output always fail Output would match an empty result file but we don't check Allow empty output IFF there is an empty result file. --- client/mysqltest.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index a39cabdc64d..a40ee1cd1d0 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7987,6 +7987,8 @@ int main(int argc, char **argv) if (parsing_disabled) die("Test ended with parsing disabled"); + my_bool empty_result= FALSE; + /* The whole test has been executed _sucessfully_. Time to compare result or save it to record file. @@ -8027,11 +8029,20 @@ int main(int argc, char **argv) } else { - die("The test didn't produce any output"); + /* Empty output is an error *unless* we also have an empty result file */ + if (! result_file_name || record || + compare_files (log_file.file_name(), result_file_name)) + { + die("The test didn't produce any output"); + } + else + { + empty_result= TRUE; /* Meaning empty was expected */ + } } - if (!command_executed && result_file_name) - die("No queries executed but result file found!"); + if (!command_executed && result_file_name && !empty_result) + die("No queries executed but non-empty result file found!"); verbose_msg("Test has succeeded!"); timer_output(); From 94077809941513dfd32e6a95413a2be02c3133a9 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 13 Aug 2009 15:29:19 +0200 Subject: [PATCH 14/29] Bug #44979 Enhance MTR --experimental to support platform qualifier Adding @ syntax --- mysql-test/collections/README.experimental | 7 +++++++ mysql-test/collections/default.experimental | 1 + mysql-test/mysql-test-run.pl | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/mysql-test/collections/README.experimental b/mysql-test/collections/README.experimental index 9eee2394423..2f5ee7b00ab 100644 --- a/mysql-test/collections/README.experimental +++ b/mysql-test/collections/README.experimental @@ -23,3 +23,10 @@ The syntax is as follows: start with the same characters up to the last letter before the asterisk are considered experimental: main.a* # get rid of main.alias, main.alibaba and main.agliolio + +6) Optionally, the test case may be followed by one or more platform + qualifiers beginning with @ or @!. The test will then be considered + experimental only/except on that platform. Basic OS names as + reported by $^O in Perl, or 'windows' are supported, this includes + solaris, linux, windows, aix, darwin, ... Example: + main.alias @aix @windows # Fails on those diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 103069f79cf..161af45f133 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -1 +1,2 @@ funcs_1.charset_collation_1 # depends on compile-time decisions +main.plugin_load @solaris # Bug #42144 diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 6a2e84d9c78..40fc7446c9e 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -984,6 +984,9 @@ sub command_line_setup { if ( $opt_experimental ) { + # $^O on Windows considered not generic enough + my $plat= (IS_WINDOWS) ? 'windows' : $^O; + # read the list of experimental test cases from the file specified on # the command line open(FILE, "<", $opt_experimental) or mtr_error("Can't read experimental file: $opt_experimental"); @@ -994,6 +997,15 @@ sub command_line_setup { # remove comments (# foo) at the beginning of the line, or after a # blank at the end of the line s/( +|^)#.*$//; + # If @ platform specifier given, use this entry only if it contains + # @ or @! where xxx != platform + if (/\@.*/) + { + next if (/\@!$plat/); + next unless (/\@$plat/ or /\@!/); + # Then remove @ and everything after it + s/\@.*$//; + } # remove whitespace s/^ +//; s/ +$//; From 7cdccfa05b9124a3cbaaccda6ba8d6f39c0b55ec Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 17 Aug 2009 11:21:02 +0200 Subject: [PATCH 15/29] Bug #46755 Wrong grammar in some skip messages: Test need instead of Test needs Fixed in two comments as well --- mysql-test/lib/mtr_cases.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 2a7b07debd0..94a4ab240b4 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -847,14 +847,14 @@ sub collect_one_test_case { if ( $tinfo->{'big_test'} and ! $::opt_big_test ) { $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need 'big-test' option"; + $tinfo->{'comment'}= "Test needs 'big-test' option"; return $tinfo } if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries ) { $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need debug binaries"; + $tinfo->{'comment'}= "Test needs debug binaries"; return $tinfo } @@ -890,14 +890,14 @@ sub collect_one_test_case { if ($tinfo->{'federated_test'}) { - # This is a test that need federated, enable it + # This is a test that needs federated, enable it push(@{$tinfo->{'master_opt'}}, "--loose-federated"); push(@{$tinfo->{'slave_opt'}}, "--loose-federated"); } if ( $tinfo->{'innodb_test'} ) { - # This is a test that need innodb + # This is a test that needs innodb if ( $::mysqld_variables{'innodb'} eq "OFF" || ! exists $::mysqld_variables{'innodb'} ) { @@ -918,7 +918,7 @@ sub collect_one_test_case { if (grep(/^--skip-log-bin/, @::opt_extra_mysqld_opt) ) { $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need binlog"; + $tinfo->{'comment'}= "Test needs binlog"; return $tinfo; } } From 1a0b63c27a1bd7a491787a69ff99608c669f371b Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 18 Aug 2009 09:38:18 +0200 Subject: [PATCH 16/29] Bug #44222 mysql-test-run --start analyses which tests it would skip. This is redundant. Quicker test collection and better output with --start[-dirty] --- mysql-test/lib/mtr_cases.pm | 15 +++++++++++++-- mysql-test/mysql-test-run.pl | 22 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 2a7b07debd0..5ce936352ce 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -41,6 +41,7 @@ our $opt_with_ndbcluster_only; our $defaults_file; our $defaults_extra_file; our $reorder= 1; +our $quick_collect; sub collect_option { my ($opt, $value)= @_; @@ -68,6 +69,9 @@ require "mtr_misc.pl"; my $do_test_reg; my $skip_test_reg; +# If "Quick collect", set to 1 once a test to run has been found. +my $some_test_found; + sub init_pattern { my ($from, $what)= @_; return undef unless defined $from; @@ -102,6 +106,7 @@ sub collect_test_cases ($$) { foreach my $suite (split(",", $suites)) { push(@$cases, collect_one_suite($suite, $opt_cases)); + last if $some_test_found; } if ( @$opt_cases ) @@ -139,7 +144,7 @@ sub collect_test_cases ($$) { } } - if ( $reorder ) + if ( $reorder && !$quick_collect) { # Reorder the test cases in an order that will make them faster to run my %sort_criteria; @@ -386,7 +391,7 @@ sub collect_one_suite($) # Read combinations for this suite and build testcases x combinations # if any combinations exists # ---------------------------------------------------------------------- - if ( ! $skip_combinations ) + if ( ! $skip_combinations && ! $quick_collect ) { my @combinations; my $combination_file= "$suitedir/combinations"; @@ -583,6 +588,12 @@ sub optimize_cases { if ( $default_engine =~ /^innodb/i ); } } + + if ($quick_collect && ! $tinfo->{'skip'}) + { + $some_test_found= 1; + return; + } } } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 40fc7446c9e..28ddd718f16 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -209,6 +209,7 @@ sub check_timeout { return $opt_testcase_timeout * 6; }; my $opt_start; my $opt_start_dirty; +my $start_only; my $opt_wait_all; my $opt_repeat= 1; my $opt_retry= 3; @@ -1262,11 +1263,19 @@ sub command_line_setup { $opt_start_timeout= 24 * 60 * 60; } + # -------------------------------------------------------------------------- + # Modified behavior with --start options + # -------------------------------------------------------------------------- + if ($opt_start or $opt_start_dirty) { + collect_option ('quick-collect', 1); + $start_only= 1; + } + # -------------------------------------------------------------------------- # Check use of wait-all # -------------------------------------------------------------------------- - if ($opt_wait_all && ! ($opt_start_dirty || $opt_start)) + if ($opt_wait_all && ! $start_only) { mtr_error("--wait-all can only be used with --start or --start-dirty"); } @@ -2824,7 +2833,7 @@ sub run_testcase_check_skip_test($) if ( $tinfo->{'skip'} ) { - mtr_report_test_skipped($tinfo); + mtr_report_test_skipped($tinfo) unless $start_only; return 1; } @@ -3311,9 +3320,16 @@ sub run_testcase ($) { # server exits # ---------------------------------------------------------------------- - if ( $opt_start or $opt_start_dirty ) + if ( $start_only ) { mtr_print("\nStarted", started(all_servers())); + mtr_print("Using config for test", $tinfo->{name}); + mtr_print("Port and socket path for server(s):"); + foreach my $mysqld ( mysqlds() ) + { + mtr_print ($mysqld->name() . " " . $mysqld->value('port') . + " " . $mysqld->value('socket')); + } mtr_print("Waiting for server(s) to exit..."); if ( $opt_wait_all ) { My::SafeProcess->wait_all(); From 0211f76d141128363046c000ccdec63b99d09504 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 18 Aug 2009 15:26:17 +0200 Subject: [PATCH 17/29] Bug #46164 memory leak in mysqltest after parse error with --debug Moved some dynstr_free() further up --- client/mysqltest.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index a40ee1cd1d0..fb4b9c6ec13 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7161,6 +7161,10 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) run_query_normal(cn, command, flags, query, query_len, ds, &ds_warnings); + dynstr_free(&ds_warnings); + if (command->type == Q_EVAL) + dynstr_free(&eval_query); + if (display_result_sorted) { /* Sort the result set and append it to result */ @@ -7191,11 +7195,8 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) check_require(ds, command->require_file); } - dynstr_free(&ds_warnings); if (ds == &ds_result) dynstr_free(&ds_result); - if (command->type == Q_EVAL) - dynstr_free(&eval_query); DBUG_VOID_RETURN; } From 3efecb16260d060e9bc28309ff54b044fb8d4027 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 19 Aug 2009 13:48:56 +0200 Subject: [PATCH 18/29] Bug #39003 mtr's diff_files command failed in pushbuild without printing a result diff diff was actually called but result never outputted before exiting Added extra code to dump output *unless* failure was expected --- client/mysqltest.cc | 9 +++++++-- mysql-test/t/mysqltest.test | 12 ------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index a40ee1cd1d0..09b31599268 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3440,12 +3440,17 @@ void do_diff_files(struct st_command *command) die("command \"diff_files\" failed, file '%s' does not exist", ds_filename2.str); - if ((error= compare_files(ds_filename.str, ds_filename2.str))) + if ((error= compare_files(ds_filename.str, ds_filename2.str)) && + match_expected_error(command, error, NULL) < 0) { /* Compare of the two files failed, append them to output - so the failure can be analyzed + so the failure can be analyzed, but only if it was not + expected to fail. */ show_diff(&ds_res, ds_filename.str, ds_filename2.str); + log_file.write(&ds_res); + log_file.flush(); + dynstr_set(&ds_res, 0); } dynstr_free(&ds_filename); diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 578b2bf5c6c..92f39d943b9 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1710,10 +1710,6 @@ EOF --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp --diff_files $MYSQLTEST_VARDIR/tmp/diff2.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp -# Write the below commands to a intermediary file and execute them with -# mysqltest in --exec, since the output will vary depending on what "diff" -# is available it is sent to /dev/null ---write_file $MYSQLTEST_VARDIR/tmp/diff.test # Compare files that differ in size --error 2 --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff3.tmp @@ -1725,13 +1721,6 @@ EOF --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff4.tmp --error 1 --diff_files $MYSQLTEST_VARDIR/tmp/diff4.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp -exit; -EOF - -# Execute the above diffs, and send their output to /dev/null - only -# interesting to see that it returns correct error codes ---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/diff.test > /dev/null 2>&1 - # Compare equal files, again... --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp @@ -1740,7 +1729,6 @@ EOF --remove_file $MYSQLTEST_VARDIR/tmp/diff2.tmp --remove_file $MYSQLTEST_VARDIR/tmp/diff3.tmp --remove_file $MYSQLTEST_VARDIR/tmp/diff4.tmp ---remove_file $MYSQLTEST_VARDIR/tmp/diff.test # ---------------------------------------------------------------------------- From 4994e66783f4d338ffc7c3769ea60d40c74ade18 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 25 Aug 2009 15:56:50 +0200 Subject: [PATCH 19/29] Bug #42408 Faulty regex for detecting [Warning] and [ERROR] in mysqld error log Enabled proper pattern for Warnings and ERRORs Added some suppressions --- mysql-test/include/mtr_warnings.sql | 6 +++++- mysql-test/mysql-test-run.pl | 6 ++---- mysql-test/r/almost_full.result | 1 + mysql-test/r/upgrade.result | 4 ---- mysql-test/suite/rpl/r/rpl_idempotency.result | 3 ++- mysql-test/suite/rpl/t/rpl_idempotency.test | 3 ++- mysql-test/t/almost_full.test | 2 ++ mysql-test/t/upgrade.test | 2 ++ 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 73287900f3c..157244a9b0a 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -132,7 +132,7 @@ INSERT INTO global_suppressions VALUES ("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"), - ("Statement is not safe to log in statement format"), + ("Statement may not be safe to log in statement format"), /* test case for Bug#bug29807 copies a stray frm into database */ ("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"), @@ -172,6 +172,10 @@ INSERT INTO global_suppressions VALUES */ ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"), + /* Added 2009-08-XX after fixing Bug #42408 */ + + ("Slave: Operation DROP USER failed for '.*'@'localhost' Error_code: 1396"), + ("THE_LAST_SUPPRESSION")|| diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 28ddd718f16..c15f3990ec4 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3624,10 +3624,8 @@ sub extract_warning_lines ($) { # and correcting them shows a few additional harmless warnings. # Thus those patterns are temporarily removed from the list # of patterns. For more info see BUG#42408 - # qr/^Warning:|mysqld: Warning|\[Warning\]/, - # qr/^Error:|\[ERROR\]/, - qr/^Warning:|mysqld: Warning/, - qr/^Error:/, + qr/^Warning:|mysqld: Warning|\[Warning\]/, + qr/^Error:|\[ERROR\]/, qr/^==.* at 0x/, qr/InnoDB: Warning|InnoDB: Error/, qr/^safe_mutex:|allocated at line/, diff --git a/mysql-test/r/almost_full.result b/mysql-test/r/almost_full.result index eb28f12fa51..b2d7092aa51 100644 --- a/mysql-test/r/almost_full.result +++ b/mysql-test/r/almost_full.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("The table 't1' is full"); drop table if exists t1; set global myisam_data_pointer_size=2; CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM; diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result index da6201692a9..034242079b1 100644 --- a/mysql-test/r/upgrade.result +++ b/mysql-test/r/upgrade.result @@ -108,11 +108,7 @@ a-b-c show create view `a-b-c`.v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `a`.`f1` AS `f1` from (`a-b-c`.`t1` `a` join `information_schema`.`tables` `b`) where (convert(`a`.`f1` using utf8) = `b`.`TABLE_NAME`) utf8 utf8_general_ci -Warnings: -Note 1600 Creation context of view `a-b-c`.`v1' is invalid select * from `a-b-c`.v1; f1 -Warnings: -Note 1600 Creation context of view `a-b-c`.`v1' is invalid drop database `a-b-c`; use test; diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result index 3341c03db0f..bfdcbc6fa23 100644 --- a/mysql-test/suite/rpl/r/rpl_idempotency.result +++ b/mysql-test/suite/rpl/r/rpl_idempotency.result @@ -4,7 +4,8 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032"); +call mtr.add_suppression("Slave: Can't find record in 't.' Error_code: 1032"); +call mtr.add_suppression("Slave: Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451"); call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); SET @old_slave_exec_mode= @@global.slave_exec_mode; CREATE TABLE t1 (a INT PRIMARY KEY); diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test index bfd1860759e..c96b88a1b1a 100644 --- a/mysql-test/suite/rpl/t/rpl_idempotency.test +++ b/mysql-test/suite/rpl/t/rpl_idempotency.test @@ -8,7 +8,8 @@ connection slave; source include/have_innodb.inc; # Add suppression for expected warning(s) in slaves error log -call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032"); +call mtr.add_suppression("Slave: Can't find record in 't.' Error_code: 1032"); +call mtr.add_suppression("Slave: Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451"); call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); SET @old_slave_exec_mode= @@global.slave_exec_mode; diff --git a/mysql-test/t/almost_full.test b/mysql-test/t/almost_full.test index 5c67ab3c088..24801f9cbc3 100644 --- a/mysql-test/t/almost_full.test +++ b/mysql-test/t/almost_full.test @@ -2,6 +2,8 @@ # Some special cases with empty tables # +call mtr.add_suppression("The table 't1' is full"); + --disable_warnings drop table if exists t1; --enable_warnings diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test index d571a2efc7c..e390e8a1253 100644 --- a/mysql-test/t/upgrade.test +++ b/mysql-test/t/upgrade.test @@ -124,6 +124,8 @@ with_check_option=0 timestamp=2009-04-10 11:53:37 create-version=1 source=select f1 from `a-b-c`.t1 a, information_schema.tables b\nwhere a.f1 = b.table_name +client_cs_name=utf8 +connection_cl_name=utf8_general_ci EOF show databases like '%a-b-c%'; From d458d55755d7acc83db89d6ca0e2cf008000a8c7 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 27 Aug 2009 15:17:09 +0200 Subject: [PATCH 20/29] Bug #46322 Sporadic timeout in mysql_upgrade.test Apparently caused by logging to table Turn on logging to file only, add to .opt file for tests needing log to table --- mysql-test/mysql-test-run.pl | 4 ++-- mysql-test/t/events_logs_tests-master.opt | 2 +- mysql-test/t/log_tables-master.opt | 2 +- mysql-test/t/ps-master.opt | 2 +- mysql-test/t/show_check-master.opt | 2 +- mysql-test/t/status-master.opt | 1 + 6 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 mysql-test/t/status-master.opt diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c15f3990ec4..429fbfe41c6 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4105,8 +4105,8 @@ sub mysqld_arguments ($$$) { if ( $mysql_version_id >= 50106 ) { - # Turn on logging to both tables and file - mtr_add_arg($args, "--log-output=table,file"); + # Turn on logging to file + mtr_add_arg($args, "--log-output=file"); } # Check if "extra_opt" contains skip-log-bin diff --git a/mysql-test/t/events_logs_tests-master.opt b/mysql-test/t/events_logs_tests-master.opt index 35ff7911705..3ece9710a45 100644 --- a/mysql-test/t/events_logs_tests-master.opt +++ b/mysql-test/t/events_logs_tests-master.opt @@ -1 +1 @@ ---log-slow-queries +--log-output=table,file --log-slow-queries diff --git a/mysql-test/t/log_tables-master.opt b/mysql-test/t/log_tables-master.opt index 35ff7911705..3ece9710a45 100644 --- a/mysql-test/t/log_tables-master.opt +++ b/mysql-test/t/log_tables-master.opt @@ -1 +1 @@ ---log-slow-queries +--log-output=table,file --log-slow-queries diff --git a/mysql-test/t/ps-master.opt b/mysql-test/t/ps-master.opt index 3eb98fc3d6b..31c287d2bb5 100644 --- a/mysql-test/t/ps-master.opt +++ b/mysql-test/t/ps-master.opt @@ -1 +1 @@ ---log-slow-queries --log-long-format --log-queries-not-using-indexes +--log-output=table,file --log-slow-queries --log-long-format --log-queries-not-using-indexes diff --git a/mysql-test/t/show_check-master.opt b/mysql-test/t/show_check-master.opt index 7a438da06cc..aab832e2848 100644 --- a/mysql-test/t/show_check-master.opt +++ b/mysql-test/t/show_check-master.opt @@ -1 +1 @@ ---log-slow-queries --log-long-format --log-queries-not-using-indexes --myisam-recover="" +--log-output=table,file --log-slow-queries --log-long-format --log-queries-not-using-indexes --myisam-recover="" diff --git a/mysql-test/t/status-master.opt b/mysql-test/t/status-master.opt new file mode 100644 index 00000000000..eb3bb4fe50d --- /dev/null +++ b/mysql-test/t/status-master.opt @@ -0,0 +1 @@ +--log-output=table,file From 013c46cb36166e0b319c2655b5229b7c6ef319c2 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 28 Aug 2009 15:02:48 +0200 Subject: [PATCH 21/29] Bug #46973 MTR: extract_warning_lines does not check it's extracting lines for current test Rewrote logic (first commit was incomplete, sorry) --- mysql-test/mysql-test-run.pl | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 429fbfe41c6..5a5d063c105 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3571,8 +3571,8 @@ sub run_testcase ($) { # error log and write all lines that look # suspicious into $error_log.warnings # -sub extract_warning_lines ($) { - my ($error_log) = @_; +sub extract_warning_lines ($$) { + my ($error_log, $tname) = @_; # Open the servers .err log file and read all lines # belonging to current tets into @lines @@ -3580,14 +3580,27 @@ sub extract_warning_lines ($) { or mtr_error("Could not open file '$error_log' for reading: $!"); my @lines; + my $found_test= 0; # Set once we've found the log of this test while ( my $line = <$Ferr> ) { - if ( $line =~ /^CURRENT_TEST:/ ) + if ($found_test) { - # Throw away lines from previous tests - @lines = (); + # If test wasn't last after all, discard what we found, test again. + if ( $line =~ /^CURRENT_TEST:/) + { + @lines= (); + $found_test= $line =~ /^CURRENT_TEST: $tname/; + } + else + { + push(@lines, $line); + } + } + else + { + # Search for beginning of test, until found + $found_test= 1 if ($line =~ /^CURRENT_TEST: $tname/); } - push(@lines, $line); } $Ferr = undef; # Close error log file @@ -3665,7 +3678,7 @@ sub start_check_warnings ($$) { my $log_error= $mysqld->value('#log-error'); # To be communicated to the test $ENV{MTR_LOG_ERROR}= $log_error; - extract_warning_lines($log_error); + extract_warning_lines($log_error, $tinfo->{name}); my $args; mtr_init_args(\$args); From dbbf8d83ffd07887f4430acf99ea2cc82bafadfd Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 28 Aug 2009 16:13:27 +0200 Subject: [PATCH 22/29] Bug #42408 Faulty regex for detecting [Warning] and [ERROR] in mysqld error log Some follow-up test fixes after seeing effect in PB2 --- mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test | 2 ++ mysql-test/r/lowercase_table3.result | 2 +- mysql-test/suite/rpl/r/rpl_bug33931.result | 2 +- mysql-test/suite/rpl/r/rpl_extraCol_innodb.result | 1 + mysql-test/suite/rpl/r/rpl_extraCol_myisam.result | 1 + mysql-test/suite/rpl/r/rpl_init_slave_errors.result | 1 + mysql-test/suite/rpl/t/rpl_bug33931.test | 2 +- mysql-test/suite/rpl/t/rpl_init_slave_errors.test | 1 + mysql-test/t/lowercase_table3.test | 2 +- 9 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test index 6890913b7d1..a7b02065144 100644 --- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test +++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test @@ -22,6 +22,8 @@ DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t1 # should stop the slave. # ################################################# +call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); + --echo **** Diff Table Def Start **** ############################################## diff --git a/mysql-test/r/lowercase_table3.result b/mysql-test/r/lowercase_table3.result index 1ef7d04bb1d..22e80aaeb26 100644 --- a/mysql-test/r/lowercase_table3.result +++ b/mysql-test/r/lowercase_table3.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("Cannot find or open table test/BUG29839 from .*"); +call mtr.add_suppression("Cannot find or open table test/BUG29839 from"); DROP TABLE IF EXISTS t1,T1; CREATE TABLE t1 (a INT); SELECT * FROM T1; diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result index 85c8fb0da9c..a17941f6ba9 100644 --- a/mysql-test/suite/rpl/r/rpl_bug33931.result +++ b/mysql-test/suite/rpl/r/rpl_bug33931.result @@ -1,5 +1,5 @@ reset master; -call mtr.add_suppression("Failed during slave thread initialization"); +call mtr.add_suppression("Failed during slave I/O thread initialization"); stop slave; reset slave; SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result index e57daad3342..e2ec78e7adc 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); **** Diff Table Def Start **** *** On Slave *** STOP SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result index 6696ddc7789..ed5b4eac27d 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); **** Diff Table Def Start **** *** On Slave *** STOP SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result index ab957e6d9bc..c6ee82b13f3 100644 --- a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result +++ b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result @@ -9,6 +9,7 @@ reset slave; SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; Reporting the following error: Failed during slave thread initialization +call mtr.add_suppression("Failed during slave I/O thread initialization"); SET GLOBAL debug= ""; stop slave; reset slave; diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test index 13f781c644b..1316ddb7401 100644 --- a/mysql-test/suite/rpl/t/rpl_bug33931.test +++ b/mysql-test/suite/rpl/t/rpl_bug33931.test @@ -15,7 +15,7 @@ reset master; connection slave; # Add suppression for expected warnings in slaves error log -call mtr.add_suppression("Failed during slave thread initialization"); +call mtr.add_suppression("Failed during slave I/O thread initialization"); --disable_warnings stop slave; diff --git a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test index 4ca0de6ec66..180821730ec 100644 --- a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test +++ b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test @@ -57,6 +57,7 @@ source include/wait_for_slave_to_stop.inc; let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1); echo Reporting the following error: $error; +call mtr.add_suppression("Failed during slave I/O thread initialization"); SET GLOBAL debug= ""; diff --git a/mysql-test/t/lowercase_table3.test b/mysql-test/t/lowercase_table3.test index 4748953fe95..f7ca8211288 100644 --- a/mysql-test/t/lowercase_table3.test +++ b/mysql-test/t/lowercase_table3.test @@ -9,7 +9,7 @@ --source include/have_case_insensitive_file_system.inc --source include/not_windows.inc -call mtr.add_suppression("Cannot find or open table test/BUG29839 from .*"); +call mtr.add_suppression("Cannot find or open table test/BUG29839 from"); --disable_warnings DROP TABLE IF EXISTS t1,T1; From bc6ea4ced77ff755ceec1c930622eb9637a5f6a9 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Sat, 29 Aug 2009 10:30:59 +0200 Subject: [PATCH 23/29] A few more suppression fixes after 42408 --- mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result | 1 + mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test | 3 +++ mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result | 1 + 3 files changed, 5 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result index 777f7d8427b..71c17321117 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test index 39f3b700f94..3a1fbe04e17 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -7,6 +7,9 @@ # 1 - Creates a table and populates it through "LOAD DATA INFILE". # 2 - Catches error. ########################################################################## + +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); + --source include/have_binlog_format_mixed_or_statement.inc --source include/have_innodb.inc --source include/have_debug.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result index d51599fd18b..f812509de6f 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); **** Diff Table Def Start **** *** On Slave *** STOP SLAVE; From 7941f3c3a0a4117ee7d8398543bece096e29d38b Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Sat, 29 Aug 2009 23:29:47 +0200 Subject: [PATCH 24/29] even more suppression fixes --- mysql-test/suite/parts/r/partition_recover_myisam.result | 2 ++ mysql-test/suite/parts/t/partition_recover_myisam.test | 4 ++++ mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result | 2 +- mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/parts/r/partition_recover_myisam.result b/mysql-test/suite/parts/r/partition_recover_myisam.result index df737ec2853..49775ee498e 100644 --- a/mysql-test/suite/parts/r/partition_recover_myisam.result +++ b/mysql-test/suite/parts/r/partition_recover_myisam.result @@ -1,3 +1,5 @@ +call mtr.add_suppression("./test/t1_will_crash"); +call mtr.add_suppression("Got an error from unknown thread, ha_myisam.cc"); CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM; INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11); FLUSH TABLES; diff --git a/mysql-test/suite/parts/t/partition_recover_myisam.test b/mysql-test/suite/parts/t/partition_recover_myisam.test index 14604bfeb15..64bc821ac37 100644 --- a/mysql-test/suite/parts/t/partition_recover_myisam.test +++ b/mysql-test/suite/parts/t/partition_recover_myisam.test @@ -1,4 +1,8 @@ # test the auto-recover (--myisam-recover) of partitioned myisam tables + +call mtr.add_suppression("./test/t1_will_crash"); +call mtr.add_suppression("Got an error from unknown thread, ha_myisam.cc"); + --source include/have_partition.inc --disable_warnings --disable_query_log diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result index 71c17321117..bc6fa377dc3 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -1,4 +1,3 @@ -call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; @@ -52,3 +51,4 @@ Last_SQL_Errno 9 Last_SQL_Error Error in Begin_load_query event: write to '../../tmp/SQL_LOAD.data' failed drop table t1; drop table t1; +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test index 3a1fbe04e17..fe1fc730ba8 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -8,8 +8,6 @@ # 2 - Catches error. ########################################################################## -call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); - --source include/have_binlog_format_mixed_or_statement.inc --source include/have_innodb.inc --source include/have_debug.inc @@ -50,3 +48,5 @@ drop table t1; connection slave; drop table t1; + +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); From 2194a927a9e840a6486dc510b8c6621b3ecd76aa Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Sun, 30 Aug 2009 12:01:08 +0200 Subject: [PATCH 25/29] yet another 42408 followup --- mysql-test/suite/rpl/t/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index 38fc9e21322..cb7a2a98925 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,3 +11,4 @@ ############################################################################## rpl_cross_version : Bug#42311 2009-03-27 joro rpl_cross_version fails on macosx +rpl_slave_load_remove_tmpfile Bug#46996, unable to suppress warning From 86a3262d2605a0713ca1b489b49d7aa83e219a66 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 31 Aug 2009 09:24:59 +0200 Subject: [PATCH 26/29] forgot : in rpl's disabled.def --- mysql-test/suite/rpl/t/disabled.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index cb7a2a98925..546c0e6b194 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,4 +11,4 @@ ############################################################################## rpl_cross_version : Bug#42311 2009-03-27 joro rpl_cross_version fails on macosx -rpl_slave_load_remove_tmpfile Bug#46996, unable to suppress warning +rpl_slave_load_remove_tmpfile : Bug#46996, unable to suppress warning From 202984236ac333a46539033e4d6bdb29c4593cc2 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 1 Sep 2009 13:38:17 +0200 Subject: [PATCH 27/29] 46996 workaruond --- mysql-test/include/mtr_warnings.sql | 4 ---- mysql-test/suite/rpl/r/rpl_do_grant.result | 3 +++ .../suite/rpl/r/rpl_slave_load_remove_tmpfile.result | 2 +- mysql-test/suite/rpl/t/disabled.def | 1 - mysql-test/suite/rpl/t/rpl_do_grant.test | 7 ++++++- mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 157244a9b0a..b73234e6142 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -172,10 +172,6 @@ INSERT INTO global_suppressions VALUES */ ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"), - /* Added 2009-08-XX after fixing Bug #42408 */ - - ("Slave: Operation DROP USER failed for '.*'@'localhost' Error_code: 1396"), - ("THE_LAST_SUPPRESSION")|| diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result index 69bcfad4347..0913b1afdbf 100644 --- a/mysql-test/suite/rpl/r/rpl_do_grant.result +++ b/mysql-test/suite/rpl/r/rpl_do_grant.result @@ -166,4 +166,7 @@ DROP FUNCTION upgrade_del_func; DROP FUNCTION upgrade_alter_func; DROP DATABASE bug42217_db; DROP USER 'create_rout_db'@'localhost'; +call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); +USE mtr; +call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); "End of test" diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result index bc6fa377dc3..e2efcf08d7a 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -51,4 +51,4 @@ Last_SQL_Errno 9 Last_SQL_Error Error in Begin_load_query event: write to '../../tmp/SQL_LOAD.data' failed drop table t1; drop table t1; -call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3"); diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index 546c0e6b194..38fc9e21322 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,4 +11,3 @@ ############################################################################## rpl_cross_version : Bug#42311 2009-03-27 joro rpl_cross_version fails on macosx -rpl_slave_load_remove_tmpfile : Bug#46996, unable to suppress warning diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test index 806de780086..a8b15516682 100644 --- a/mysql-test/suite/rpl/t/rpl_do_grant.test +++ b/mysql-test/suite/rpl/t/rpl_do_grant.test @@ -207,5 +207,10 @@ DROP FUNCTION upgrade_del_func; DROP FUNCTION upgrade_alter_func; DROP DATABASE bug42217_db; DROP USER 'create_rout_db'@'localhost'; - + +call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); +connection slave; +USE mtr; +call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); + --echo "End of test" diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test index fe1fc730ba8..437e1ebb92d 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -49,4 +49,4 @@ connection slave; drop table t1; -call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3"); From d65168fddab05ed08d95eb5fead7cb1aad38edd5 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 2 Sep 2009 11:17:33 +0200 Subject: [PATCH 28/29] Bug #32296 mysqltest fails to parse "append_file" inside a "while", it works inside a "if" Bug #41913 mysqltest cannot source files from if inside while Some commands require additional processing which only works first time Keep content for write_file or append_file with the st_command struct Add tests for those cases to mysqltest.test --- client/mysqltest.cc | 56 ++++++++++++++++++++++++++++------- mysql-test/r/mysqltest.result | 19 ++++-------- mysql-test/t/mysqltest.test | 26 ++++++++++++---- 3 files changed, 73 insertions(+), 28 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 0cf7e62ac8c..7965dafb863 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -417,6 +417,7 @@ static struct st_expected_errors saved_expected_errors; struct st_command { char *query, *query_buf,*first_argument,*last_argument,*end; + DYNAMIC_STRING content; int first_word_len, query_len; my_bool abort_on_error; struct st_expected_errors expected_errors; @@ -1138,6 +1139,8 @@ void free_used_memory() { struct st_command **q= dynamic_element(&q_lines, i, struct st_command**); my_free((*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR)); + if ((*q)->content.str) + dynstr_free(&(*q)->content); my_free((*q),MYF(0)); } for (i= 0; i < 10; i++) @@ -3283,21 +3286,30 @@ void do_write_file_command(struct st_command *command, my_bool append) sizeof(write_file_args)/sizeof(struct command_arg), ' '); - /* If no delimiter was provided, use EOF */ - if (ds_delimiter.length == 0) - dynstr_set(&ds_delimiter, "EOF"); - if (!append && access(ds_filename.str, F_OK) == 0) { /* The file should not be overwritten */ die("File already exist: '%s'", ds_filename.str); } - init_dynamic_string(&ds_content, "", 1024, 1024); - read_until_delimiter(&ds_content, &ds_delimiter); - DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str)); - str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append); - dynstr_free(&ds_content); + ds_content= command->content; + /* If it hasn't been done already by a loop iteration, fill it in */ + if (! ds_content.str) + { + /* If no delimiter was provided, use EOF */ + if (ds_delimiter.length == 0) + dynstr_set(&ds_delimiter, "EOF"); + + init_dynamic_string(&ds_content, "", 1024, 1024); + read_until_delimiter(&ds_content, &ds_delimiter); + command->content= ds_content; + } + /* This function could be called even if "false", so check before printing */ + if (cur_block->ok) + { + DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str)); + str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append); + } dynstr_free(&ds_filename); dynstr_free(&ds_delimiter); DBUG_VOID_RETURN; @@ -7684,7 +7696,31 @@ int main(int argc, char **argv) command->type= Q_COMMENT; } - if (cur_block->ok) + my_bool ok_to_do= cur_block->ok; + /* + Some commands need to be "done" the first time if they may get + re-iterated over in a true context. This can only happen if there's + a while loop at some level above the current block. + */ + if (!ok_to_do) + { + if (command->type == Q_SOURCE || + command->type == Q_WRITE_FILE || + command->type == Q_APPEND_FILE || + command->type == Q_PERL) + { + for (struct st_block *stb= cur_block-1; stb >= block_stack; stb--) + { + if (stb->cmd == cmd_while) + { + ok_to_do= 1; + break; + } + } + } + } + + if (ok_to_do) { command->last_argument= command->first_argument; processed = 1; diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 52a1734ea54..f68413264e4 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -314,21 +314,10 @@ here is the sourced script 1 = outer loop variable before dec 0 = outer loop variable after dec - -2 = outer loop variable after while +outer=2 ifval=0 +outer=1 ifval=1 here is the sourced script -2 = outer loop variable before dec - -1 = outer loop variable after dec - -1 = outer loop variable after while -here is the sourced script - -1 = outer loop variable before dec - -0 = outer loop variable after dec - In loop here is the sourced script @@ -538,6 +527,10 @@ mysqltest: At line 1: Missing required argument 'filename' to command 'write_fil mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found Content for test_file1 mysqltest: At line 1: File already exist: 'MYSQLTEST_VARDIR/tmp/test_file1.tmp' +These lines should be repeated, +if things work as expected +These lines should be repeated, +if things work as expected Some data for cat_file command of mysqltest diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 92f39d943b9..9859e73cfae 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -853,16 +853,18 @@ while ($outer) eval SELECT '$outer = outer loop variable after dec' AS ""; } +# Test source in an if in a while which is false on 1st iteration let $outer= 2; # Number of outer loops +let $ifval= 0; # false 1st time while ($outer) { - eval SELECT '$outer = outer loop variable after while' AS ""; + echo outer=$outer ifval=$ifval; - echo here is the sourced script; - - eval SELECT '$outer = outer loop variable before dec' AS ""; + if ($ifval) { + --source $MYSQLTEST_VARDIR/tmp/sourced.inc + } dec $outer; - eval SELECT '$outer = outer loop variable after dec' AS ""; + inc $ifval; } @@ -1663,6 +1665,20 @@ EOF remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; +# Test append_file within while +let $outer= 2; # Number of outer loops +while ($outer) +{ + append_file $MYSQLTEST_VARDIR/tmp/app_while.tmp; +These lines should be repeated, +if things work as expected +EOF + dec $outer; +} + +cat_file $MYSQLTEST_VARDIR/tmp/app_while.tmp; +remove_file $MYSQLTEST_VARDIR/tmp/app_while.tmp; + # ---------------------------------------------------------------------------- # test for cat_file # ---------------------------------------------------------------------------- From 5cdf8392b5d149961c6b7644599f3f0210700992 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 3 Sep 2009 08:19:54 +0200 Subject: [PATCH 29/29] Bug #47075 Wildcards in experimental test names destroyed when tested first time Extract substr into local variable --- mysql-test/lib/mtr_report.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index a246c5bbef6..f2131b9bd76 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -134,8 +134,8 @@ sub mtr_report_test ($) { # an asterisk at the end, determine if the characters up to # but excluding the asterisk are the same if ( $exp ne "" && substr($exp, -1, 1) eq "*" ) { - $exp = substr($exp, 0, length($exp) - 1); - if ( substr($test_name, 0, length($exp)) ne $exp ) { + my $nexp = substr($exp, 0, length($exp) - 1); + if ( substr($test_name, 0, length($nexp)) ne $nexp ) { # no match, try next entry next; }