From fe76fb69a03f53273602bbee5771d9a5fb339870 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 23 Oct 2009 13:04:55 +0200 Subject: [PATCH 01/50] Bug #48209 Confusing message "Test has succeeded" after test fails due to warnings There's no need for --verbose for the mysqltest in check-warnings, remove it --- mysql-test/mysql-test-run.pl | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4d8d178e092..11ad4a56eb7 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3739,7 +3739,6 @@ sub start_check_warnings ($$) { mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test"); - mtr_add_arg($args, "--verbose"); if ( $opt_embedded_server ) { From 6c28505e6ed2b9f678165d439670958c03e801ff Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 26 Oct 2009 14:28:51 +0100 Subject: [PATCH 02/50] Bug #48240 "Test suite timeout" and "Too many tests failed" is masked from status page Prepend "Completed", "Timeout" or "Too many failed" to summary line --- mysql-test/lib/mtr_report.pm | 7 +++++-- mysql-test/mysql-test-run.pl | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 937e19111fb..81885c35a44 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -222,8 +222,8 @@ sub mtr_report_test ($) { } -sub mtr_report_stats ($;$) { - my ($tests, $dont_error)= @_; +sub mtr_report_stats ($$;$) { + my ($prefix, $tests, $dont_error)= @_; # ---------------------------------------------------------------------- # Find out how we where doing @@ -328,6 +328,9 @@ sub mtr_report_stats ($;$) { } } + # Print summary line prefix + print "$prefix: "; + # Print a list of testcases that failed if ( $tot_failed != 0 ) { diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4d8d178e092..762fa75ed93 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -411,7 +411,7 @@ sub main { $opt_gcov_msg, $opt_gcov_err); } - mtr_report_stats($completed); + mtr_report_stats("Completed", $completed); exit(0); } @@ -533,7 +533,7 @@ sub run_test_server ($$$) { $num_failed_test >= $opt_max_test_fail) { $suite_timeout_proc->kill(); push(@$completed, $result); - mtr_report_stats($completed, 1); + mtr_report_stats("Too many failed", $completed, 1); mtr_report("Too many tests($num_failed_test) failed!", "Terminating..."); return undef; @@ -665,7 +665,7 @@ sub run_test_server ($$$) { # ---------------------------------------------------- if ( ! $suite_timeout_proc->wait_one(0) ) { - mtr_report_stats($completed, 1); + mtr_report_stats("Timeout", $completed, 1); mtr_report("Test suite timeout! Terminating..."); return undef; } From dd1d0a464456b5d8c71efb675c715ad2e8d89151 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 4 Nov 2009 13:42:22 +0100 Subject: [PATCH 03/50] Bug #47663 mtr --parallel has weird output Some output is written, some is not Finally concluded it's a Perl bug: after running with parallel threads for a while, print suddenly ignores all but the first argument. Workaround: concatenate all the arguments into one, except in output that only comes before we start running tests --- mysql-test/lib/My/SafeProcess.pm | 6 +++--- mysql-test/lib/mtr_report.pm | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm index 7e102b628ca..ee7ed2471c7 100644 --- a/mysql-test/lib/My/SafeProcess.pm +++ b/mysql-test/lib/My/SafeProcess.pm @@ -338,12 +338,12 @@ sub start_kill { $ret= system($safe_kill, $winpid) >> 8; if ($ret == 3){ - print "Couldn't open the winpid: $winpid ", + print "Couldn't open the winpid: $winpid ". "for pid: $pid, try one more time\n"; sleep(1); $winpid= _winpid($pid); $ret= system($safe_kill, $winpid) >> 8; - print "Couldn't open the winpid: $winpid ", + print "Couldn't open the winpid: $winpid ". "for pid: $pid, continue and see what happens...\n"; } } @@ -594,7 +594,7 @@ sub self2str { sub _verbose { return unless $_verbose; - print STDERR " ## ", @_, "\n"; + print STDERR " ## ". @_. "\n"; } diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 81885c35a44..1c4b940bbee 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -69,7 +69,7 @@ sub _mtr_report_test_name ($) { $tname.= " '$tinfo->{combination}'" if defined $tinfo->{combination}; - print _name(), _timestamp(); + print _name(). _timestamp(); printf "%-40s ", $tname; my $worker = $tinfo->{worker}; printf "w$worker " if $worker; @@ -390,13 +390,13 @@ sub mtr_report_stats ($$;$) { ############################################################################## sub mtr_print_line () { - print '-' x 60, "\n"; + print '-' x 60 . "\n"; } sub mtr_print_thick_line { my $char= shift || '='; - print $char x 78, "\n"; + print $char x 78 . "\n"; } @@ -454,7 +454,7 @@ sub _timestamp { # Always print message to screen sub mtr_print (@) { - print _name(), join(" ", @_), "\n"; + print _name(). join(" ", @_). "\n"; } @@ -462,22 +462,22 @@ sub mtr_print (@) { sub mtr_report (@) { if (defined $verbose) { - print _name(), join(" ", @_), "\n"; + print _name(). join(" ", @_). "\n"; } } # Print warning to screen sub mtr_warning (@) { - print STDERR _name(), _timestamp(), - "mysql-test-run: WARNING: ", join(" ", @_), "\n"; + print STDERR _name(). _timestamp(). + "mysql-test-run: WARNING: ". join(" ", @_). "\n"; } # Print error to screen and then exit sub mtr_error (@) { - print STDERR _name(), _timestamp(), - "mysql-test-run: *** ERROR: ", join(" ", @_), "\n"; + print STDERR _name(). _timestamp(). + "mysql-test-run: *** ERROR: ". join(" ", @_). "\n"; if (IS_WINDOWS) { POSIX::_exit(1); @@ -492,8 +492,8 @@ sub mtr_error (@) { sub mtr_debug (@) { if ( $verbose > 2 ) { - print STDERR _name(), - _timestamp(), "####: ", join(" ", @_), "\n"; + print STDERR _name(). + _timestamp(). "####: ". join(" ", @_). "\n"; } } @@ -501,8 +501,8 @@ sub mtr_debug (@) { sub mtr_verbose (@) { if ( $verbose ) { - print STDERR _name(), _timestamp(), - "> ",join(" ", @_),"\n"; + print STDERR _name(). _timestamp(). + "> ".join(" ", @_)."\n"; } } @@ -512,8 +512,8 @@ sub mtr_verbose_restart (@) { my $proc= $server->{proc}; if ( $verbose_restart ) { - print STDERR _name(),_timestamp(), - "> Restart $proc - ",join(" ", @args),"\n"; + print STDERR _name()._timestamp(). + "> Restart $proc - ".join(" ", @args)."\n"; } } From ffdb6be7551fc3c0b6e265d9a1f55fe0e78a9ccc Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 11 Nov 2009 12:46:19 +0100 Subject: [PATCH 04/50] Bug #48671 mysqltest fails on 'perl' in file sourced inside 'while' Actually, fails on 'perl' in any while Fixed essentially the same way as for append_file --- client/mysqltest.cc | 87 +++++++++++++++++++---------------- mysql-test/r/mysqltest.result | 2 + mysql-test/t/mysqltest.test | 14 ++++++ 3 files changed, 64 insertions(+), 39 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 8de2f0c79b0..cfcabb5a5ab 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3632,49 +3632,58 @@ void do_perl(struct st_command *command) sizeof(perl_args)/sizeof(struct command_arg), ' '); - /* If no delimiter was provided, use EOF */ - if (ds_delimiter.length == 0) - dynstr_set(&ds_delimiter, "EOF"); - - init_dynamic_string(&ds_script, "", 1024, 1024); - read_until_delimiter(&ds_script, &ds_delimiter); - - DBUG_PRINT("info", ("Executing perl: %s", ds_script.str)); - - /* Create temporary file name */ - if ((fd= create_temp_file(temp_file_path, getenv("MYSQLTEST_VARDIR"), - "tmp", O_CREAT | O_SHARE | O_RDWR, - MYF(MY_WME))) < 0) - die("Failed to create temporary file for perl command"); - my_close(fd, MYF(0)); - - str_to_file(temp_file_path, ds_script.str, ds_script.length); - - /* Format the "perl " command */ - my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path); - - if (!(res_file= popen(buf, "r")) && command->abort_on_error) - die("popen(\"%s\", \"r\") failed", buf); - - while (fgets(buf, sizeof(buf), res_file)) + ds_script= command->content; + /* If it hasn't been done already by a loop iteration, fill it in */ + if (! ds_script.str) { - if (disable_result_log) - { - buf[strlen(buf)-1]=0; - DBUG_PRINT("exec_result",("%s", buf)); - } - else - { - replace_dynstr_append(&ds_res, buf); - } + /* If no delimiter was provided, use EOF */ + if (ds_delimiter.length == 0) + dynstr_set(&ds_delimiter, "EOF"); + + init_dynamic_string(&ds_script, "", 1024, 1024); + read_until_delimiter(&ds_script, &ds_delimiter); + command->content= ds_script; } - error= pclose(res_file); - /* Remove the temporary file */ - my_delete(temp_file_path, MYF(0)); + /* This function could be called even if "false", so check before doing */ + if (cur_block->ok) + { + DBUG_PRINT("info", ("Executing perl: %s", ds_script.str)); - handle_command_error(command, WEXITSTATUS(error)); - dynstr_free(&ds_script); + /* Create temporary file name */ + if ((fd= create_temp_file(temp_file_path, getenv("MYSQLTEST_VARDIR"), + "tmp", O_CREAT | O_SHARE | O_RDWR, + MYF(MY_WME))) < 0) + die("Failed to create temporary file for perl command"); + my_close(fd, MYF(0)); + + str_to_file(temp_file_path, ds_script.str, ds_script.length); + + /* Format the "perl " command */ + my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path); + + if (!(res_file= popen(buf, "r")) && command->abort_on_error) + die("popen(\"%s\", \"r\") failed", buf); + + while (fgets(buf, sizeof(buf), res_file)) + { + if (disable_result_log) + { + buf[strlen(buf)-1]=0; + DBUG_PRINT("exec_result",("%s", buf)); + } + else + { + replace_dynstr_append(&ds_res, buf); + } + } + error= pclose(res_file); + + /* Remove the temporary file */ + my_delete(temp_file_path, MYF(0)); + + handle_command_error(command, WEXITSTATUS(error)); + } dynstr_free(&ds_delimiter); DBUG_VOID_RETURN; } diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 2e3a9489593..671f88cb00a 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -553,6 +553,8 @@ hello mysqltest: At line 1: Max delimiter length(16) exceeded hello hello +val is 5 +val is 5 mysqltest: At line 1: test of die Some output create table t1( a int, b char(255), c timestamp); diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index bcf33aa8c27..b4ea9202df7 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1905,6 +1905,20 @@ perl; print "hello\n"; EOF +# Test perl within while, also with if being false first iteration +let $outer= 3; +let $ifval= 0; +while ($outer) { + if ($ifval) { + perl UNTIL; + my $val= 5; + print "val is $val\n"; +UNTIL + } + inc $ifval; + dec $outer; +} + # ---------------------------------------------------------------------------- # test for die # ---------------------------------------------------------------------------- From 59940cdcd2049ff92a434ff758d06f99e5e45d72 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 12 Nov 2009 11:04:01 +0100 Subject: [PATCH 05/50] Bug #43418 MTR2: does not notice a memory leak occuring at shutdown of mysqld w/ --valgrind Checking is done before server is terminated Adds post processing of server logs if --valgrind Also had to remove --quiet option to valgrind --- mysql-test/include/mtr_warnings.sql | 8 ++++ mysql-test/mysql-test-run.pl | 71 +++++++++++++++++++++++++++-- 2 files changed, 76 insertions(+), 3 deletions(-) diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 57e7cb97d48..0176c1800e8 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -175,6 +175,14 @@ INSERT INTO global_suppressions VALUES ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"), ("Slave: Unknown table 't1' Error_code: 1051"), + /* Messages from valgrind */ + ("==[0-9]*== Memcheck,"), + ("==[0-9]*== Copyright"), + ("==[0-9]*== Using"), + ("==[0-9]*== For more details"), + /* This comes with innodb plugin tests */ + ("==[0-9]*== Warning: set address range perms: large range .* .defined."), + ("THE_LAST_SUPPRESSION")|| diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c91a74570bd..4ac3beff0a6 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -226,6 +226,7 @@ my @default_valgrind_args= ("--show-reachable=yes"); my @valgrind_args; my $opt_valgrind_path; my $opt_callgrind; +my %mysqld_logs; my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions. our $opt_warnings= 1; @@ -741,6 +742,9 @@ sub run_worker ($) { elsif ($line eq 'BYE'){ mtr_report("Server said BYE"); stop_all_servers($opt_shutdown_timeout); + if ($opt_valgrind_mysqld) { + valgrind_exit_reports(); + } exit(0); } else { @@ -1340,8 +1344,7 @@ sub command_line_setup { push(@valgrind_args, @default_valgrind_args) unless @valgrind_args; - # Make valgrind run in quiet mode so it only print errors - push(@valgrind_args, "--quiet" ); + # Don't add --quiet; you will loose the summary reports. mtr_report("Running valgrind with options \"", join(" ", @valgrind_args), "\""); @@ -3690,7 +3693,7 @@ sub extract_warning_lines ($$) { ( qr/^Warning:|mysqld: Warning|\[Warning\]/, qr/^Error:|\[ERROR\]/, - qr/^==\d*==/, # valgrind errors + qr/^==\d+==\s+\S/, # valgrind errors qr/InnoDB: Warning|InnoDB: Error/, qr/^safe_mutex:|allocated at line/, qr/missing DBUG_RETURN/, @@ -4296,6 +4299,8 @@ sub mysqld_start ($$) { # see the exact location where valgrind complains $output= "$opt_vardir/log/".$mysqld->name().".trace"; } + # Remember this log file for valgrind error report search + $mysqld_logs{$output}= 1 if $opt_valgrind; if ( defined $exe ) { @@ -5148,6 +5153,66 @@ sub valgrind_arguments { } } +# +# Search server logs for valgrind reports printed at mysqld termination +# + +sub valgrind_exit_reports() { + foreach my $log_file (keys %mysqld_logs) + { + my @culprits= (); + my $valgrind_rep= ""; + my $found_report= 0; + my $err_in_report= 0; + + my $LOGF = IO::File->new($log_file) + or mtr_error("Could not open file '$log_file' for reading: $!"); + + while ( my $line = <$LOGF> ) + { + if ($line =~ /^CURRENT_TEST: (.+)$/) + { + my $testname= $1; + # If we have a report, report it if needed and start new list of tests + if ($found_report) + { + if ($err_in_report) + { + mtr_print ("Valgrind report from $log_file after tests:\n", + @culprits); + mtr_print_line(); + print ("$valgrind_rep\n"); + $err_in_report= 0; + } + # Make ready to collect new report + @culprits= (); + $found_report= 0; + $valgrind_rep= ""; + } + push (@culprits, $testname); + next; + } + # This line marks the start of a valgrind report + $found_report= 1 if $line =~ /ERROR SUMMARY:/; + + if ($found_report) { + $line=~ s/^==\d+== //; + $valgrind_rep .= $line; + $err_in_report= 1 if $line =~ /ERROR SUMMARY: [1-9]/; + $err_in_report= 1 if $line =~ /definitely lost: [1-9]/; + $err_in_report= 1 if $line =~ /possibly lost: [1-9]/; + } + } + + $LOGF= undef; + + if ($err_in_report) { + mtr_print ("Valgrind report from $log_file after tests:\n", @culprits); + mtr_print_line(); + print ("$valgrind_rep\n"); + } + } +} # # Usage From 6edaebbf57bb2722b925883e705c167b09beceef Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 16 Nov 2009 11:18:16 +0100 Subject: [PATCH 06/50] Bug #48795 Valgrind summary from tests where server has been restarted cause test failure Seen in a few tests after 43418 Add code in extract_warning_lines() to skip this part --- mysql-test/mysql-test-run.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4ac3beff0a6..4501afa8ee7 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3700,9 +3700,17 @@ sub extract_warning_lines ($$) { qr/Attempting backtrace/, qr/Assertion .* failed/, ); + my $skip_valgrind= 0; foreach my $line ( @lines ) { + if ($opt_valgrind_mysqld) { + # Skip valgrind summary from tests where server has been restarted + # Should this contain memory leaks, the final report will find it + $skip_valgrind= 1 if $line =~ /^==\d+== ERROR SUMMARY:/; + $skip_valgrind= 0 unless $line =~ /^==\d+==/; + next if $skip_valgrind; + } foreach my $pat ( @patterns ) { if ( $line =~ /$pat/ ) From f57dda3babf5b8e821b09f34f5146080ff32f9eb Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 16 Nov 2009 14:46:33 +0100 Subject: [PATCH 07/50] minor fix of a valgrind suppress pattern --- mysql-test/include/mtr_warnings.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 0176c1800e8..7502470979e 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -181,7 +181,7 @@ INSERT INTO global_suppressions VALUES ("==[0-9]*== Using"), ("==[0-9]*== For more details"), /* This comes with innodb plugin tests */ - ("==[0-9]*== Warning: set address range perms: large range .* .defined."), + ("==[0-9]*== Warning: set address range perms: large range"), ("THE_LAST_SUPPRESSION")|| From 7516158138346f53348a112c84f5f8d52345f4c8 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 17 Nov 2009 09:36:09 +0100 Subject: [PATCH 08/50] mtr ignoring of skip-im incorrectly removed by backport of WL#4085 --- mysql-test/mysql-test-run.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 6a6be3b6f1e..aeda46e6c5b 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -824,6 +824,7 @@ sub command_line_setup { 'combination=s' => \@opt_combinations, 'skip-combinations' => \&collect_option, 'experimental=s' => \$opt_experimental, + 'skip-im' => \&ignore_option, # Specify ports 'build-thread|mtr-build-thread=i' => \$opt_build_thread, From 2b0be38266d15515ed602148d05f400e41a7553a Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 17 Nov 2009 12:13:22 +0100 Subject: [PATCH 09/50] Bug #48806 mysql-test-run.pl --help should work even in the absence of binaries Searches for my_safe_process binary too early Put this into a sub() and call it after examining options (incl. --help) --- mysql-test/lib/My/SafeProcess.pm | 34 ++++++++++++++++++-------------- mysql-test/mysql-test-run.pl | 3 +++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm index ee7ed2471c7..a620a7c6c72 100644 --- a/mysql-test/lib/My/SafeProcess.pm +++ b/mysql-test/lib/My/SafeProcess.pm @@ -81,24 +81,28 @@ sub is_child { } -# Find the safe process binary or script my @safe_process_cmd; my $safe_kill; -if (IS_WIN32PERL or IS_CYGWIN){ - # Use my_safe_process.exe - my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"], - "my_safe_process"); - push(@safe_process_cmd, $exe); - # Use my_safe_kill.exe - $safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill"); -} -else -{ - # Use my_safe_process - my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"], - "my_safe_process"); - push(@safe_process_cmd, $exe); +# Find the safe process binary or script +sub find_bin { + if (IS_WIN32PERL or IS_CYGWIN) + { + # Use my_safe_process.exe + my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"], + "my_safe_process"); + push(@safe_process_cmd, $exe); + + # Use my_safe_kill.exe + $safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill"); + } + else + { + # Use my_safe_process + my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"], + "my_safe_process"); + push(@safe_process_cmd, $exe); + } } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4501afa8ee7..1184d994627 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -266,6 +266,9 @@ sub main { command_line_setup(); + # --help will not reach here, so now it's safe to assume we have binaries + My::SafeProcess::find_bin(); + if ( $opt_gcov ) { gcov_prepare($basedir); } From 54bdfab91e9e34a14d07c8d110dbb7d43f8a8d73 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 18 Nov 2009 10:27:43 +0100 Subject: [PATCH 10/50] Bug #48808 mysql-test-run.pl --debugger=devenv does not work Wrong argument order, fixed --- mysql-test/mysql-test-run.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4501afa8ee7..d07b976a26d 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5086,9 +5086,9 @@ sub debugger_arguments { { # vc[express] /debugexe exe arg1 .. argn - # Add /debugexe and name of the exe before args - unshift(@$$args, "/debugexe"); + # Add name of the exe and /debugexe before args unshift(@$$args, "$$exe"); + unshift(@$$args, "/debugexe"); # Set exe to debuggername $$exe= $debugger; From 9d69adc9d61120ec786f266540eac6d2f025641a Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 19 Nov 2009 09:58:50 +0100 Subject: [PATCH 11/50] Bug #48367 MTR should react to server dying, rather than to resulting failure of mysqltest For some reason it usually picks up mysqltest Wait .1s and then see if a server has died Change from first commit: label on separate line --- mysql-test/mysql-test-run.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4501afa8ee7..e8da2c9b5c2 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3495,6 +3495,14 @@ sub run_testcase ($) { run_on_all($tinfo, "analyze-$analyze"); } + # Wait a bit and see if a server died, if so report that instead + mtr_milli_sleep(100); + my $srvproc= My::SafeProcess::check_any(); + if ($srvproc && grep($srvproc eq $_, started(all_servers()))) { + $proc= $srvproc; + goto SRVDIED; + } + # Test case failure reported by mysqltest report_failure_and_restart($tinfo); } @@ -3520,6 +3528,7 @@ sub run_testcase ($) { # ---------------------------------------------------- # Check if it was an expected crash # ---------------------------------------------------- + SRVDIED: my $check_crash = check_expected_crash_and_restart($proc); if ($check_crash) { From 91bb19f44ecf803c8411741a100bf1af80e7172f Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 19 Nov 2009 10:10:21 +0100 Subject: [PATCH 12/50] Bug #35543 mysqlbinlog.cc does not properly work with tmp files mtr patch ported to v2 --- mysql-test/mysql-test-run.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4501afa8ee7..bd11ffde5fe 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2511,6 +2511,7 @@ sub create_config_file_for_extern { # binlog reads from [client] and [mysqlbinlog] [mysqlbinlog] character-sets-dir= $path_charsetsdir +local-load= $opt_tmpdir # mysql_fix_privilege_tables.sh don't read from [client] [mysql_fix_privilege_tables] From 94f138eb5b42eeda7a732eb78319085a9fd6853f Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 19 Nov 2009 13:19:11 +0100 Subject: [PATCH 13/50] Bug #48683 mysql-stress-test fails with "Value ... invalid for option abort-on-error" Add =1 to --abort-on-error argument --- mysql-test/lib/mtr_stress.pl | 2 +- mysql-test/lib/v1/mtr_stress.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/mtr_stress.pl b/mysql-test/lib/mtr_stress.pl index cd5c7b0dbb7..702bc178ae5 100644 --- a/mysql-test/lib/mtr_stress.pl +++ b/mysql-test/lib/mtr_stress.pl @@ -150,7 +150,7 @@ sub run_stress_test () mtr_add_arg($args, "--verbose"); mtr_add_arg($args, "--cleanup"); mtr_add_arg($args, "--log-error-details"); - mtr_add_arg($args, "--abort-on-error"); + mtr_add_arg($args, "--abort-on-error=1"); if ( $::opt_stress_init_file ) { diff --git a/mysql-test/lib/v1/mtr_stress.pl b/mysql-test/lib/v1/mtr_stress.pl index 93b06b32c5f..40800c9729b 100644 --- a/mysql-test/lib/v1/mtr_stress.pl +++ b/mysql-test/lib/v1/mtr_stress.pl @@ -150,7 +150,7 @@ sub run_stress_test () mtr_add_arg($args, "--verbose"); mtr_add_arg($args, "--cleanup"); mtr_add_arg($args, "--log-error-details"); - mtr_add_arg($args, "--abort-on-error"); + mtr_add_arg($args, "--abort-on-error=1"); if ( $::opt_stress_init_file ) { From 8e04f4c73ca7938e97b24f6f3a60dc7c22d29352 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 24 Nov 2009 09:12:48 +0100 Subject: [PATCH 14/50] Bug #47978 timer : expired after 90 seconds Problems occur after killing threads on Windows Get rid of the timeout threads, implement simple timer in wait_any_timeout() --- mysql-test/lib/My/SafeProcess.pm | 91 ++++++++++++-------------------- mysql-test/lib/mtr_misc.pl | 13 ++++- mysql-test/mysql-test-run.pl | 79 ++++++++++----------------- 3 files changed, 72 insertions(+), 111 deletions(-) diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm index a620a7c6c72..bfcad910a16 100644 --- a/mysql-test/lib/My/SafeProcess.pm +++ b/mysql-test/lib/My/SafeProcess.pm @@ -187,63 +187,6 @@ sub run { return $proc->exit_status(); } -# -# Start a process that returns after "duration" seconds -# or when it's parent process does not exist anymore -# -sub timer { - my $class= shift; - my $duration= shift or croak "duration required"; - my $parent_pid= $$; - - my $pid= My::SafeProcess::Base::_safe_fork(); - if ($pid){ - # Parent - my $proc= bless - ({ - SAFE_PID => $pid, - SAFE_NAME => "timer", - PARENT => $$, - }, $class); - - # Put the new process in list of running - $running{$pid}= $proc; - return $proc; - } - - # Child, install signal handlers and sleep for "duration" - $SIG{INT}= 'IGNORE'; - - $SIG{TERM}= sub { - #print STDERR "timer $$: woken up, exiting!\n"; - exit(0); - }; - - $0= "safe_timer($duration)"; - - if (IS_WIN32PERL){ - # Just a thread in same process - sleep($duration); - print STDERR "timer $$: expired after $duration seconds\n"; - exit(0); - } - - my $count_down= $duration; - while($count_down--){ - - # Check that parent is still alive - if (kill(0, $parent_pid) == 0){ - #print STDERR "timer $$: parent gone, exiting!\n"; - exit(0); - } - - sleep(1); - } - print STDERR "timer $$: expired after $duration seconds\n"; - exit(0); -} - - # # Shutdown process nicely, and wait for shutdown_timeout seconds # If processes hasn't shutdown, kill them hard and wait for return @@ -541,6 +484,40 @@ sub wait_any { } +# +# Wait for any process to exit, or a timeout +# +# Returns a reference to the SafeProcess that +# exited or a pseudo-process with $proc->{timeout} == 1 +# + +sub wait_any_timeout { + my $class= shift; + my $timeout= shift; + my $proc; + my $millis=10; + + do { + ::mtr_milli_sleep($millis); + # Slowly increse interval up to max. 1 second + $millis++ if $millis < 1000; + # Return a "fake" process for timeout + if (::has_expired($timeout)) { + $proc= bless + ({ + SAFE_PID => 0, + SAFE_NAME => "timer", + timeout => 1, + }, $class); + } else { + $proc= check_any(); + } + } while (! $proc); + + return $proc; +} + + # # Wait for all processes to exit # diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index 658eb270535..97eb693b52e 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -30,7 +30,9 @@ sub mtr_script_exists(@); sub mtr_file_exists(@); sub mtr_exe_exists(@); sub mtr_exe_maybe_exists(@); - +sub mtr_milli_sleep($); +sub start_timer($); +sub has_expired($); ############################################################################## # @@ -167,11 +169,18 @@ sub mtr_exe_exists (@) { } -sub mtr_milli_sleep { +sub mtr_milli_sleep ($) { die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1; my ($millis)= @_; select(undef, undef, undef, ($millis/1000)); } +# Simple functions to start and check timers (have to be actively polled) +# Timer can be "killed" by setting it to 0 + +sub start_timer ($) { return time + $_[0]; } + +sub has_expired ($) { return $_[0] && time gt $_[0]; } + 1; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ae9674bbde5..2147b4ae7a7 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -439,7 +439,7 @@ sub run_test_server ($$$) { my $result; my $exe_mysqld= find_mysqld($basedir) || ""; # Used as hint to CoreDump - my $suite_timeout_proc= My::SafeProcess->timer(suite_timeout()); + my $suite_timeout= start_timer(suite_timeout()); my $s= IO::Select->new(); $s->add($server); @@ -460,7 +460,6 @@ sub run_test_server ($$$) { mtr_verbose("Child closed socket"); $s->remove($sock); if (--$childs == 0){ - $suite_timeout_proc->kill(); return $completed; } next; @@ -529,13 +528,11 @@ sub run_test_server ($$$) { if ( !$opt_force ) { # Test has failed, force is off - $suite_timeout_proc->kill(); push(@$completed, $result); return $completed; } elsif ($opt_max_test_fail > 0 and $num_failed_test >= $opt_max_test_fail) { - $suite_timeout_proc->kill(); push(@$completed, $result); mtr_report_stats("Too many failed", $completed, 1); mtr_report("Too many tests($num_failed_test) failed!", @@ -667,7 +664,7 @@ sub run_test_server ($$$) { # ---------------------------------------------------- # Check if test suite timer expired # ---------------------------------------------------- - if ( ! $suite_timeout_proc->wait_one(0) ) + if ( has_expired($suite_timeout) ) { mtr_report_stats("Timeout", $completed, 1); mtr_report("Test suite timeout! Terminating..."); @@ -2944,11 +2941,11 @@ sub check_testcase($$) # Return immediately if no check proceess was started return 0 unless ( keys %started ); - my $timeout_proc= My::SafeProcess->timer(check_timeout()); + my $timeout= start_timer(check_timeout()); while (1){ my $result; - my $proc= My::SafeProcess->wait_any(); + my $proc= My::SafeProcess->wait_any_timeout($timeout); mtr_report("Got $proc"); if ( delete $started{$proc->pid()} ) { @@ -2972,9 +2969,6 @@ sub check_testcase($$) if ( keys(%started) == 0){ # All checks completed - - $timeout_proc->kill(); - return 0; } # Wait for next process to exit @@ -3015,10 +3009,9 @@ test case was executed:\n"; } } - elsif ( $proc eq $timeout_proc ) { - $tinfo->{comment}.= "Timeout $timeout_proc for ". - "'check-testcase' expired after ".check_timeout(). - " seconds"; + elsif ( $proc->{timeout} ) { + $tinfo->{comment}.= "Timeout for 'check-testcase' expired after " + .check_timeout()." seconds"; $result= 4; } else { @@ -3033,8 +3026,6 @@ test case was executed:\n"; # Kill any check processes still running map($_->kill(), values(%started)); - $timeout_proc->kill(); - return $result; } @@ -3106,11 +3097,11 @@ sub run_on_all($$) # Return immediately if no check proceess was started return 0 unless ( keys %started ); - my $timeout_proc= My::SafeProcess->timer(check_timeout()); + my $timeout= start_timer(check_timeout()); while (1){ my $result; - my $proc= My::SafeProcess->wait_any(); + my $proc= My::SafeProcess->wait_any_timeout($timeout); mtr_report("Got $proc"); if ( delete $started{$proc->pid()} ) { @@ -3129,17 +3120,15 @@ sub run_on_all($$) if ( keys(%started) == 0){ # All completed - $timeout_proc->kill(); return 0; } # Wait for next process to exit next; } - elsif ( $proc eq $timeout_proc ) { - $tinfo->{comment}.= "Timeout $timeout_proc for '$run' ". - "expired after ". check_timeout(). - " seconds"; + elsif ($proc->{timeout}) { + $tinfo->{comment}.= "Timeout for '$run' expired after " + .check_timeout()." seconds"; } else { # Unknown process returned, most likley a crash, abort everything @@ -3151,8 +3140,6 @@ sub run_on_all($$) # Kill any check processes still running map($_->kill(), values(%started)); - $timeout_proc->kill(); - return 1; } mtr_error("INTERNAL_ERROR: run_on_all"); @@ -3382,7 +3369,7 @@ sub run_testcase ($) { } } - my $test_timeout_proc= My::SafeProcess->timer(testcase_timeout()); + my $test_timeout= start_timer(testcase_timeout()); do_before_run_mysqltest($tinfo); @@ -3390,9 +3377,6 @@ sub run_testcase ($) { # Failed to record state of server or server crashed report_failure_and_restart($tinfo); - # Stop the test case timer - $test_timeout_proc->kill(); - return 1; } @@ -3410,20 +3394,20 @@ sub run_testcase ($) { if ($proc) { mtr_verbose ("Found exited process $proc"); - # If that was the timeout, cancel waiting - if ( $proc eq $test_timeout_proc ) - { - $keep_waiting_proc = 0; - } } else { $proc = $keep_waiting_proc; + # Also check if timer has expired, if so cancel waiting + if ( has_expired($test_timeout) ) + { + $keep_waiting_proc = 0; + } } } - else + if (! $keep_waiting_proc) { - $proc= My::SafeProcess->wait_any(); + $proc= My::SafeProcess->wait_any_timeout($test_timeout); } # Will be restored if we need to keep waiting @@ -3440,9 +3424,6 @@ sub run_testcase ($) { # ---------------------------------------------------- if ($proc eq $test) { - # Stop the test case timer - $test_timeout_proc->kill(); - my $res= $test->exit_status(); if ($res == 0 and $opt_warnings and check_warnings($tinfo) ) @@ -3545,7 +3526,7 @@ sub run_testcase ($) { # ---------------------------------------------------- # Stop the test case timer # ---------------------------------------------------- - $test_timeout_proc->kill(); + $test_timeout= 0; # ---------------------------------------------------- # Check if it was a server that died @@ -3584,7 +3565,7 @@ sub run_testcase ($) { # ---------------------------------------------------- # Check if testcase timer expired # ---------------------------------------------------- - if ( $proc eq $test_timeout_proc ) + if ( $proc->{timeout} ) { my $log_file_name= $opt_vardir."/log/".$tinfo->{shortname}.".log"; $tinfo->{comment}= @@ -3825,11 +3806,11 @@ sub check_warnings ($) { # Return immediately if no check proceess was started return 0 unless ( keys %started ); - my $timeout_proc= My::SafeProcess->timer(check_timeout()); + my $timeout= start_timer(check_timeout()); while (1){ my $result= 0; - my $proc= My::SafeProcess->wait_any(); + my $proc= My::SafeProcess->wait_any_timeout($timeout); mtr_report("Got $proc"); if ( delete $started{$proc->pid()} ) { @@ -3858,9 +3839,6 @@ sub check_warnings ($) { if ( keys(%started) == 0){ # All checks completed - - $timeout_proc->kill(); - return $result; } # Wait for next process to exit @@ -3877,10 +3855,9 @@ sub check_warnings ($) { $result= 2; } } - elsif ( $proc eq $timeout_proc ) { - $tinfo->{comment}.= "Timeout $timeout_proc for ". - "'check warnings' expired after ".check_timeout(). - " seconds"; + elsif ( $proc->{timeout} ) { + $tinfo->{comment}.= "Timeout for 'check warnings' expired after " + .check_timeout()." seconds"; $result= 4; } else { @@ -3894,8 +3871,6 @@ sub check_warnings ($) { # Kill any check processes still running map($_->kill(), values(%started)); - $timeout_proc->kill(); - return $result; } From ae3e5e3da0b1f00964420f0f04e9cb68e37f5189 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 26 Nov 2009 11:16:06 +0100 Subject: [PATCH 15/50] Bug #48250 mysqtest_embedded can lock destroyed mutex As suggested, replaced relevant uses of my_fopen with fopen (and close) Tested on HPUX where it was reproducable with test innodb_bug30919 --- client/mysqltest.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index cfcabb5a5ab..3cd87bd3236 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1119,7 +1119,7 @@ void close_files() if (cur_file->file && cur_file->file != stdin) { DBUG_PRINT("info", ("closing file: %s", cur_file->file_name)); - my_fclose(cur_file->file, MYF(0)); + fclose(cur_file->file); } my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR)); cur_file->file_name= 0; @@ -2441,7 +2441,7 @@ int open_file(const char *name) if (cur_file == file_stack_end) die("Source directives are nesting too deep"); cur_file++; - if (!(cur_file->file = my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0)))) + if (!(cur_file->file = fopen(buff, "rb"))) { cur_file--; die("Could not open '%s' for reading, errno: %d", buff, errno); @@ -5286,7 +5286,7 @@ int read_line(char *buf, int size) found_eof: if (cur_file->file != stdin) { - my_fclose(cur_file->file, MYF(0)); + fclose(cur_file->file); cur_file->file= 0; } my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR)); @@ -5865,7 +5865,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), fn_format(buff, argument, "", "", MY_UNPACK_FILENAME); DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0); if (!(cur_file->file= - my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0)))) + fopen(buff, "rb"))) die("Could not open '%s' for reading, errno: %d", buff, errno); cur_file->file_name= my_strdup(buff, MYF(MY_FAE)); cur_file->lineno= 1; From 4deb53a56dd6a912efbbbfe0c6499d79f512fec9 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 26 Nov 2009 11:23:30 +0100 Subject: [PATCH 16/50] Bug #49096 mtr: --mem option should be ignored on Windows Ignored w/message in v1 and v2 --- mysql-test/lib/v1/mysql-test-run.pl | 5 +++++ mysql-test/mysql-test-run.pl | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index 86ad5c485c1..9630c65ade4 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -905,6 +905,11 @@ sub command_line_setup () { mtr_report("Using default engine '$used_default_engine'") if defined $used_default_engine; + if ($glob_win32 and defined $opt_mem) { + mtr_report("--mem not supported on Windows, ignored"); + $opt_mem= undef; + } + # -------------------------------------------------------------------------- # Check if we should speed up tests by trying to run on tmpfs # -------------------------------------------------------------------------- diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 2147b4ae7a7..e7f8e90dc44 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1080,6 +1080,11 @@ sub command_line_setup { } } + if (IS_WINDOWS and defined $opt_mem) { + mtr_report("--mem not supported on Windows, ignored"); + $opt_mem= undef; + } + # -------------------------------------------------------------------------- # Check if we should speed up tests by trying to run on tmpfs # -------------------------------------------------------------------------- From 15d5390010f46717b90125a55480720dd1edebb9 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 26 Nov 2009 11:34:16 +0100 Subject: [PATCH 17/50] Bug #48918 MTR uses an un-initialized value in comparison mysqld->{proc} not defined for an embedded server Check only if {proc} defined --- 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 e7f8e90dc44..7d2426459d0 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3893,7 +3893,7 @@ sub check_expected_crash_and_restart { foreach my $mysqld ( mysqlds() ) { - next unless ( $mysqld->{proc} eq $proc ); + next unless ( $mysqld->{proc} and $mysqld->{proc} eq $proc ); # Check if crash expected by looking at the .expect file # in var/tmp From b82642966b7914e4d9906b20c65f07ae032b775d Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 15 Dec 2009 10:12:24 +0100 Subject: [PATCH 18/50] Bug #49672 mtr should extract end of result log if mysqltest fails without output Extracts last 20 lines if no output after failure --- mysql-test/mysql-test-run.pl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 7d2426459d0..f0898e1cab7 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3500,7 +3500,7 @@ sub run_testcase ($) { { # mysqltest failed, probably crashed $tinfo->{comment}= - "mysqltest failed with unexpected return code $res"; + "mysqltest failed with unexpected return code $res\n"; report_failure_and_restart($tinfo); } @@ -4091,6 +4091,19 @@ sub report_failure_and_restart ($) { # about what failed has been saved to file. Save the report # in tinfo $tinfo->{logfile}= mtr_fromfile($logfile); + # If no newlines in the test log: + if ($tinfo->{logfile} !~ /\n/) + { + # Show how far it got before suddenly failing + $tinfo->{comment}.= "mysqltest failed but provided no output\n"; + my $log_file_name= $opt_vardir."/log/".$tinfo->{shortname}.".log"; + if (-e $log_file_name) { + $tinfo->{comment}.= + "The result from queries just before the failure was:". + "\n< snip >\n". + mtr_lastlinesfromfile($log_file_name, 20)."\n"; + } + } } else { From fd81bc9f9cf756034d08c3a0359db27e023427d8 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 16 Dec 2009 10:06:37 +0100 Subject: [PATCH 19/50] backport mysqltest send_eval from 42520 --- client/mysqltest.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 3cd87bd3236..7f758e7c306 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -280,7 +280,7 @@ enum enum_commands { Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR, Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE, Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER, - Q_MOVE_FILE, + Q_MOVE_FILE, Q_SEND_EVAL, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ @@ -378,6 +378,7 @@ const char *command_names[]= "send_shutdown", "shutdown_server", "move_file", + "send_eval", 0 }; @@ -7047,7 +7048,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) /* Evaluate query if this is an eval command */ - if (command->type == Q_EVAL) + if (command->type == Q_EVAL || command->type == Q_SEND_EVAL) { init_dynamic_string(&eval_query, "", command->query_len+256, 1024); do_eval(&eval_query, command->query, command->end, FALSE); @@ -7866,6 +7867,7 @@ int main(int argc, char **argv) break; } case Q_SEND: + case Q_SEND_EVAL: if (!*command->first_argument) { /* From c7a1f5212c17a95cf91f4f83877d4b10ac6ede83 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 5 Jan 2010 13:05:00 +0100 Subject: [PATCH 20/50] Bug #49166 mtr --combination is broken after restrictions of combination names Combinations beginning with -- not allowed Allow them... --- mysql-test/mysql-test-run.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 7d2426459d0..27c2ace56b2 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3251,9 +3251,11 @@ sub run_testcase ($) { mtr_verbose("Running test:", $tinfo->{name}); - # Allow only alpanumerics pluss _ - + . in combination names + # Allow only alpanumerics pluss _ - + . in combination names, + # or anything beginning with -- (the latter comes from --combination) my $combination= $tinfo->{combination}; - if ($combination && $combination !~ /^\w[-\w\.\+]+$/) + if ($combination && $combination !~ /^\w[-\w\.\+]+$/ + && $combination !~ /^--/) { mtr_error("Combination '$combination' contains illegal characters"); } From eec8deed8b14aa20e58a4698f657f60583b6ab34 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 5 Jan 2010 13:31:38 +0100 Subject: [PATCH 21/50] Bug #49166 mtr --combination is broken after restrictions of combination names Combinations beginning with -- not allowed Allow them... --- mysql-test/mysql-test-run.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 7d2426459d0..27c2ace56b2 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3251,9 +3251,11 @@ sub run_testcase ($) { mtr_verbose("Running test:", $tinfo->{name}); - # Allow only alpanumerics pluss _ - + . in combination names + # Allow only alpanumerics pluss _ - + . in combination names, + # or anything beginning with -- (the latter comes from --combination) my $combination= $tinfo->{combination}; - if ($combination && $combination !~ /^\w[-\w\.\+]+$/) + if ($combination && $combination !~ /^\w[-\w\.\+]+$/ + && $combination !~ /^--/) { mtr_error("Combination '$combination' contains illegal characters"); } From 1ae30d113da3f5829584f4646b1b6dda5e4fec13 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 5 Jan 2010 21:35:50 +0100 Subject: [PATCH 22/50] Bug #49345 re-introduce gprof to mysql-test-run.pl Was available in v1 Porting to v2 required some rewriting Updated after review comments --- mysql-test/lib/mtr_gprof.pl | 45 +++++++++--------------------------- mysql-test/mysql-test-run.pl | 12 +++++++++- 2 files changed, 22 insertions(+), 35 deletions(-) diff --git a/mysql-test/lib/mtr_gprof.pl b/mysql-test/lib/mtr_gprof.pl index f6615301dd7..5820a4007b8 100644 --- a/mysql-test/lib/mtr_gprof.pl +++ b/mysql-test/lib/mtr_gprof.pl @@ -20,43 +20,20 @@ use strict; -# These are not to be prefixed with "mtr_" +sub gprof_collect ($@) { + my ($exe_mysqld, @gprof_dirs)= @_; -sub gprof_prepare (); -sub gprof_collect (); + print ("Collecting gprof reports.....\n"); -############################################################################## -# -# -# -############################################################################## - -sub gprof_prepare () { - - rmtree($::opt_gprof_dir); - mkdir($::opt_gprof_dir); -} - -# FIXME what about master1 and slave1?! -sub gprof_collect () { - - if ( -f "$::master->[0]->{'path_myddir'}/gmon.out" ) + foreach my $datadir (@gprof_dirs) { - # FIXME check result code?! - mtr_run("gprof", - [$::exe_master_mysqld, - "$::master->[0]->{'path_myddir'}/gmon.out"], - $::opt_gprof_master, "", "", ""); - print "Master execution profile has been saved in $::opt_gprof_master\n"; - } - if ( -f "$::slave->[0]->{'path_myddir'}/gmon.out" ) - { - # FIXME check result code?! - mtr_run("gprof", - [$::exe_slave_mysqld, - "$::slave->[0]->{'path_myddir'}/gmon.out"], - $::opt_gprof_slave, "", "", ""); - print "Slave execution profile has been saved in $::opt_gprof_slave\n"; + my $gprof_msg= "$datadir/gprof.msg"; + my $gprof_err= "$datadir/gprof.err"; + if ( -f "$datadir/gmon.out" ) + { + system("gprof $exe_mysqld $datadir/gmon.out 2>$gprof_err >$gprof_msg"); + print ("GPROF output in $gprof_msg, errors in $gprof_err\n"); + } } } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 27c2ace56b2..ff986b9e793 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -87,6 +87,7 @@ use IO::Select; require "lib/mtr_process.pl"; require "lib/mtr_io.pl"; require "lib/mtr_gcov.pl"; +require "lib/mtr_gprof.pl"; require "lib/mtr_misc.pl"; $SIG{INT}= sub { mtr_error("Got ^C signal"); }; @@ -167,6 +168,9 @@ our $opt_gcov_exe= "gcov"; our $opt_gcov_err= "mysql-test-gcov.msg"; our $opt_gcov_msg= "mysql-test-gcov.err"; +our $opt_gprof; +our %gprof_dirs; + our $glob_debugger= 0; our $opt_gdb; our $opt_client_gdb; @@ -745,6 +749,9 @@ sub run_worker ($) { if ($opt_valgrind_mysqld) { valgrind_exit_reports(); } + if ( $opt_gprof ) { + gprof_collect (find_mysqld($basedir), keys %gprof_dirs); + } exit(0); } else { @@ -858,6 +865,7 @@ sub command_line_setup { # Coverage, profiling etc 'gcov' => \$opt_gcov, + 'gprof' => \$opt_gprof, 'valgrind|valgrind-all' => \$opt_valgrind, 'valgrind-mysqltest' => \$opt_valgrind_mysqltest, 'valgrind-mysqld' => \$opt_valgrind_mysqld, @@ -1250,7 +1258,7 @@ sub command_line_setup { # -------------------------------------------------------------------------- # Gcov flag # -------------------------------------------------------------------------- - if ( $opt_gcov and ! $source_dist ) + if ( ($opt_gcov or $opt_gprof) and ! $source_dist ) { mtr_error("Coverage test needs the source - please use source dist"); } @@ -4304,6 +4312,8 @@ sub mysqld_start ($$) { } # Remember this log file for valgrind error report search $mysqld_logs{$output}= 1 if $opt_valgrind; + # Remember data dir for gmon.out files if using gprof + $gprof_dirs{$mysqld->value('datadir')}= 1 if $opt_gprof; if ( defined $exe ) { From 2ec01d90d8f20f2517d68989ae102183bbf70704 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 6 Jan 2010 09:42:21 +0100 Subject: [PATCH 23/50] Bug #48863 mysql test: enable and disable case insensitive compare mode Implemented --lowercase_result which lower cases next result --- client/mysqltest.cc | 26 ++++++++++++++++++++++-- mysql-test/r/mysqltest.result | 23 +++++++++++++++++++++ mysql-test/t/mysqltest.test | 38 +++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 2 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index e2a9a2a5349..f516415f15d 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -97,7 +97,7 @@ static my_bool sp_protocol= 0, sp_protocol_enabled= 0; static my_bool view_protocol= 0, view_protocol_enabled= 0; static my_bool cursor_protocol= 0, cursor_protocol_enabled= 0; static my_bool parsing_disabled= 0; -static my_bool display_result_vertically= FALSE, +static my_bool display_result_vertically= FALSE, display_result_lower= FALSE, display_metadata= FALSE, display_result_sorted= FALSE; static my_bool disable_query_log= 0, disable_result_log= 0; static my_bool disable_warnings= 0; @@ -272,6 +272,7 @@ enum enum_commands { Q_DISABLE_ABORT_ON_ERROR, Q_ENABLE_ABORT_ON_ERROR, Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS, Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL, Q_SORTED_RESULT, + Q_LOWERCASE, Q_START_TIMER, Q_END_TIMER, Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL, Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT, @@ -346,6 +347,7 @@ const char *command_names[]= "query_vertical", "query_horizontal", "sorted_result", + "lowercase_result", "start_timer", "end_timer", "character_set", @@ -7876,6 +7878,13 @@ int main(int argc, char **argv) */ display_result_sorted= TRUE; break; + case Q_LOWERCASE: + /* + Turn on lowercasing of result, will be reset after next + command + */ + display_result_lower= TRUE; + break; case Q_LET: do_let(command); break; case Q_EVAL_RESULT: die("'eval_result' command is deprecated"); @@ -8091,8 +8100,9 @@ int main(int argc, char **argv) */ free_all_replace(); - /* Also reset "sorted_result" */ + /* Also reset "sorted_result" and "lowercase"*/ display_result_sorted= FALSE; + display_result_lower= FALSE; } last_command_executed= command_executed; @@ -9496,6 +9506,18 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds, fix_win_paths(val, len); #endif + if (display_result_lower) + { + /* Convert to lower case, and do this first */ + char lower[512]; + char *c= lower; + for (const char *v= val; *v; v++) + *c++= my_tolower(charset_info, *v); + *c= '\0'; + /* Copy from this buffer instead */ + val= lower; + } + if (glob_replace_regex) { /* Regex replace */ diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 671f88cb00a..f327640782c 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -682,6 +682,29 @@ INSERT INTO t1 SELECT f1 - 256 FROM t1; INSERT INTO t1 SELECT f1 - 512 FROM t1; SELECT * FROM t1; DROP TABLE t1; +select "500g blåbærsyltetøy" as "will be lower cased"; +will be lower cased +500g blåbærsyltetøy +SELECT "UPPER" AS "WILL NOT BE lower cased"; +WILL NOT BE lower cased +UPPER +UP +SELECT 0 as "UP AGAIN"; +UP AGAIN +0 +select "abcdef" as "uvwxyz"; +uvwxyz +abcdef +select "xyz" as name union select "abc" as name order by name desc; +name +abc +xyz +select 1 as "some new text"; +some new text +1 +select 0 as "will not lower case ÄËÐ"; +will not lower case ÄËÐ +0 CREATE TABLE t1( a int, b varchar(255), c datetime ); diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index b4ea9202df7..ce9b31eb30f 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -2059,6 +2059,44 @@ INSERT INTO t1 SELECT f1 - 512 FROM t1; SELECT * FROM t1; --enable_result_log DROP TABLE t1; + +# ---------------------------------------------------------------------------- +# test for lowercase_result +# ---------------------------------------------------------------------------- + +# 1. Basic test +--lowercase_result +SELECT "500g BLÅBÆRSYLTETØY" AS "WILL BE lower cased"; + +# 2. test that it does not apply to next statement +SELECT "UPPER" AS "WILL NOT BE lower cased"; + +# 3. test that it does not affect non-SQL or the following statement +--lowercase_result +--echo UP +SELECT 0 as "UP AGAIN"; + +# 4. test that it works with eval and variables +let $lower_stmt=SELECT "ABCdef" AS "uvwXYZ"; +--lowercase_result +eval $lower_stmt; + +# 5. test that it works in combination with sort +sorted_result; +lowercase_result; +SELECT "Xyz" AS Name UNION SELECT "Abc" as Name ORDER BY Name DESC; + +# 6. Test combination with replace, and that lower casing is done first +--lowercase_result +--replace_result old new +SELECT 1 as "SOME OLD TEXT"; + +# 7. Test missing lower casing of "unknown" characters +--character_set utf8 +--lowercase_result +SELECT 0 as "WILL NOT lower case ÄËÐ"; +--character_set latin1 + # ---------------------------------------------------------------------------- # Some coverage tests # ---------------------------------------------------------------------------- From 583f77011b0113de92431a8dee789cde8b90d13b Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 6 Jan 2010 09:45:28 +0100 Subject: [PATCH 24/50] Bug #49269 mysqltest crashes on 'reap' if query executed after 'send' Set a flag after send to trap the case --- client/mysqltest.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index f516415f15d..804db8fbefe 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -228,6 +228,8 @@ struct st_connection char *name; size_t name_len; MYSQL_STMT* stmt; + /* Set after send to disallow other queries before reap */ + my_bool pending; #ifdef EMBEDDED_LIBRARY const char *cur_query; @@ -4691,7 +4693,8 @@ void do_close_connection(struct st_command *command) if (con->util_mysql) mysql_close(con->util_mysql); con->util_mysql= 0; - + con->pending= FALSE; + my_free(con->name, MYF(0)); /* @@ -6513,6 +6516,9 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, if (flags & QUERY_SEND_FLAG) { + if (cn->pending) + die ("Cannot run query on connection between send and reap"); + /* Send the query */ @@ -6532,8 +6538,11 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, wait_query_thread_end(cn); #endif /*EMBEDDED_LIBRARY*/ if (!(flags & QUERY_REAP_FLAG)) + { + cn->pending= TRUE; DBUG_VOID_RETURN; - + } + do { /* @@ -6622,6 +6631,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, end: + cn->pending= FALSE; /* We save the return code (mysql_errno(mysql)) from the last call sent to the server into the mysqltest builtin variable $mysql_errno. This From 385f3f87c9575780eb354f5aacf1c2f20be5089f Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 6 Jan 2010 09:47:25 +0100 Subject: [PATCH 25/50] Bug #49761 mysqltest.test does not have any tests for send/reap Added them NB the 6th case is adapted to Bug no. 49269, gives wrong output without it --- mysql-test/r/mysqltest.result | 20 ++++++++++++++ mysql-test/t/mysqltest.test | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index f327640782c..e77dcd7b0a6 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -523,6 +523,26 @@ a D 1 1 1 4 drop table t1; +create table t1 ( f1 char(10)); +insert into t1 values ("Abcd"); +select * from t1; +f1 +Abcd +select * from t2;; +ERROR 42S02: Table 'test.t2' doesn't exist +select * from t1; +f1 +Abcd +select * from t1;; +Result coming up +f1 +Abcd +select * from t1;; +f1 +Abcd +mysqltest: At line 2: Cannot run query on connection between send and reap +select * from t1;; +drop table t1; mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file' mysqltest: At line 1: Missing required argument 'filename' to command 'write_file' mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index ce9b31eb30f..45fc0715312 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1605,6 +1605,57 @@ insert into t1 values (2,4); select * from t1; drop table t1; +# ---------------------------------------------------------------------------- +# Tests of send +# ---------------------------------------------------------------------------- + +create table t1 ( f1 char(10)); +insert into t1 values ("Abcd"); + +# 1. Basic test + +send select * from t1; +reap; + +# 2. Test with error + +--send select * from t2; +--error ER_NO_SUCH_TABLE +--reap + +# 3. test send of next stmt + +--send +select * from t1; +--reap + +# 4. Non-query stmt betwen send and reap allowed + +--send select * from t1; +--sleep 0.05 +--echo Result coming up +--reap + +# 5. Test of send_eval + +--let $my_stmt= select * from t1; +--send_eval $my_stmt +--reap + +# 6. Test that mysqltest does not allow query stmt between send and reap +# Untestable directly as it causes mysqltest to fail + +--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.in +--send select * from t1; +select 1; +--reap +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.in; + +drop table t1; + # ---------------------------------------------------------------------------- # test for remove_file # ---------------------------------------------------------------------------- From 570ee4c5e8e6510990abfa0427fc87a1c76183e4 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 6 Jan 2010 12:56:22 +0100 Subject: [PATCH 26/50] Bug #49269 mysqltest crashes on 'reap' if query executed after 'send' Small amendment: ignore pending reap when switching connection, add test --- client/mysqltest.cc | 1 + mysql-test/r/mysqltest.result | 7 +++++++ mysql-test/t/mysqltest.test | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 804db8fbefe..d0c58d2f57b 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -4622,6 +4622,7 @@ void select_connection_name(const char *name) if (!con) die("connection '%s' not found in connection pool", name); + con->pending= FALSE; set_current_connection(con); DBUG_VOID_RETURN; diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index e77dcd7b0a6..def5d202c2f 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -542,6 +542,13 @@ f1 Abcd mysqltest: At line 2: Cannot run query on connection between send and reap select * from t1;; +select * from t1;; +select 1; +1 +1 +select 2; +2 +2 drop table t1; mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file' mysqltest: At line 1: Missing required argument 'filename' to command 'write_file' diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 45fc0715312..f3fea9348e4 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1654,6 +1654,18 @@ EOF --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.in; +# 7. Test that stmt after send without reap IS allowed +# if we have switched connections + +connect (test_con1,localhost,root,,); +--send select * from t1; +connection default; +select 1; +connection test_con1; +select 2; +disconnect test_con1; +connection default; + drop table t1; # ---------------------------------------------------------------------------- From 9ab9c73a87ac4530a40da0b2cf089e8e2af70ec1 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 7 Jan 2010 11:22:45 +0100 Subject: [PATCH 27/50] Bug #49269 mysqltest crashes on 'reap' if query executed after 'send' Undid amendment allowing pending reap after switching connections Moved check for pending reap earlier; failed if running with ps-protocol --- client/mysqltest.cc | 7 +++---- mysql-test/r/mysqltest.result | 7 ------- .../suite/sys_vars/t/innodb_table_locks_func.test | 1 + .../sys_vars/t/sql_low_priority_updates_func.test | 1 + mysql-test/t/mysqltest.test | 12 ------------ mysql-test/t/partition_innodb_semi_consistent.test | 1 + 6 files changed, 6 insertions(+), 23 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index d0c58d2f57b..45f94982472 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -4622,7 +4622,6 @@ void select_connection_name(const char *name) if (!con) die("connection '%s' not found in connection pool", name); - con->pending= FALSE; set_current_connection(con); DBUG_VOID_RETURN; @@ -6517,9 +6516,6 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, if (flags & QUERY_SEND_FLAG) { - if (cn->pending) - die ("Cannot run query on connection between send and reap"); - /* Send the query */ @@ -7111,6 +7107,9 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) init_dynamic_string(&ds_warnings, NULL, 0, 256); + if (cn->pending && (flags & QUERY_SEND_FLAG)) + die ("Cannot run query on connection between send and reap"); + /* Evaluate query if this is an eval command */ diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index def5d202c2f..e77dcd7b0a6 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -542,13 +542,6 @@ f1 Abcd mysqltest: At line 2: Cannot run query on connection between send and reap select * from t1;; -select * from t1;; -select 1; -1 -1 -select 2; -2 -2 drop table t1; mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file' mysqltest: At line 1: Missing required argument 'filename' to command 'write_file' diff --git a/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test b/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test index 6638a20c926..330addd6b3b 100644 --- a/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test @@ -78,6 +78,7 @@ COMMIT; --echo 'CONNECTION con2' CONNECTION con2; +reap; UNLOCK tables; DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test index 2ef6e34b0b3..5e0314c25ae 100644 --- a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test +++ b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test @@ -127,6 +127,7 @@ connection con0; SET SESSION low_priority_updates = OFF; --echo ** Connection con1 ** connection con1; +reap; SET SESSION low_priority_updates = OFF; --echo ** Connection default** connection default; diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index f3fea9348e4..45fc0715312 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1654,18 +1654,6 @@ EOF --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.in; -# 7. Test that stmt after send without reap IS allowed -# if we have switched connections - -connect (test_con1,localhost,root,,); ---send select * from t1; -connection default; -select 1; -connection test_con1; -select 2; -disconnect test_con1; -connection default; - drop table t1; # ---------------------------------------------------------------------------- diff --git a/mysql-test/t/partition_innodb_semi_consistent.test b/mysql-test/t/partition_innodb_semi_consistent.test index 6a6a7cf958e..2711d79f194 100644 --- a/mysql-test/t/partition_innodb_semi_consistent.test +++ b/mysql-test/t/partition_innodb_semi_consistent.test @@ -187,6 +187,7 @@ SELECT * FROM t1; --echo # Switch to connection con2 connection con2; +reap; SELECT * FROM t1; connection default; From be128c547fc614349695208f37fccf2a86e2139a Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 7 Jan 2010 13:17:54 +0100 Subject: [PATCH 28/50] backport some changes from WL 4378 --- mysql-test/mysql-test-run.pl | 39 +++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 83740e08ca6..d0f7d2b2a75 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -68,8 +68,8 @@ use My::File::Path; # Patched version of File::Path use File::Basename; use File::Copy; use File::Find; -use File::Temp qw / tempdir /; -use File::Spec::Functions qw / splitdir /; +use File::Temp qw/tempdir/; +use File::Spec::Functions qw/splitdir/; use My::Platform; use My::SafeProcess; use My::ConfigFactory; @@ -119,6 +119,8 @@ END { } } +sub env_or_val($$) { defined $ENV{$_[0]} ? $ENV{$_[0]} : $_[1] } + my $path_config_file; # The generated config file, var/my.cnf # Visual Studio produces executables in different sub-directories based on the @@ -217,7 +219,7 @@ my $start_only; my $opt_wait_all; my $opt_repeat= 1; my $opt_retry= 3; -my $opt_retry_failure= 2; +my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2); my $opt_strace_client; @@ -247,9 +249,9 @@ our %mysqld_variables; my $source_dist= 0; -my $opt_max_save_core= $ENV{MTR_MAX_SAVE_CORE} || 5; -my $opt_max_save_datadir= $ENV{MTR_MAX_SAVE_DATADIR} || 20; -my $opt_max_test_fail= $ENV{MTR_MAX_TEST_FAIL} || 10; +my $opt_max_save_core= env_or_val(MTR_MAX_SAVE_CORE => 5); +my $opt_max_save_datadir= env_or_val(MTR_MAX_SAVE_DATADIR => 20); +my $opt_max_test_fail= env_or_val(MTR_MAX_TEST_FAIL => 10); my $opt_parallel= $ENV{MTR_PARALLEL} || 1; @@ -794,11 +796,12 @@ sub set_vardir { sub command_line_setup { my $opt_comment; my $opt_usage; + my $opt_list_options; # Read the command line options # Note: Keep list, and the order, in sync with usage at end of this file Getopt::Long::Configure("pass_through"); - GetOptions( + my %options=( # Control what engine/variation to run 'embedded-server' => \$opt_embedded_server, 'ps-protocol' => \$opt_ps_protocol, @@ -918,9 +921,13 @@ sub command_line_setup { 'timediff' => \&report_option, 'help|h' => \$opt_usage, - ) or usage("Can't read options"); + 'list-options' => \$opt_list_options, + ); + + GetOptions(%options) or usage("Can't read options"); usage("") if $opt_usage; + list_options(\%options) if $opt_list_options; # -------------------------------------------------------------------------- # Setup verbosity @@ -4977,7 +4984,7 @@ sub gdb_arguments { my $type= shift; # Write $args to gdb init file - my $str= join(" ", @$$args); + my $str= join " ", map { s/"/\\"/g; "\"$_\""; } @$$args; my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type"; # Remove the old gdbinit file @@ -5041,7 +5048,7 @@ sub ddd_arguments { my $type= shift; # Write $args to ddd init file - my $str= join(" ", @$$args); + my $str= join " ", map { s/"/\\"/g; "\"$_\""; } @$$args; my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type"; # Remove the old gdbinit file @@ -5436,3 +5443,15 @@ HERE } +sub list_options ($) { + my $hash= shift; + + for (keys %$hash) { + s/([:=].*|[+!])$//; + s/\|/\n--/g; + print "--$_\n" unless /list-options/; + } + + exit(1); +} + From 01795763f08d1dcc0d3e7f6426add597d53b0d6c Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 19 Jan 2010 09:48:56 +0100 Subject: [PATCH 29/50] Bug#43005 main.init_connect fails on Windows due to wrong quoting of args - The arguments are properly quoted when mtr.pl calls my_safe_process but unfortunately the all off when running with active state perl and stays in cygwin perl. - Extend the patch to only quote args that are not already quoted This a redo of previous commit, will be included in next push --- .../lib/My/SafeProcess/safe_process_win.cc | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc index aa9093fb2b4..896bd599f4f 100755 --- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc @@ -186,14 +186,20 @@ 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++) { - 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]); - } + arg= argv[j]; + if (strchr (arg, ' ') && + arg[0] != '\"' && + arg[strlen(arg)] != '\"') + { + /* Quote arg that contains spaces and are not quoted already */ + to+= _snprintf(to, child_args + sizeof(child_args) - to, + "\"%s\" ", arg); + } + else + { + to+= _snprintf(to, child_args + sizeof(child_args) - to, + "%s ", arg); + } } break; } else { From 128216d35b077afbb7f135ff368d6712638c3cc2 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 20 Jan 2010 12:51:18 +0100 Subject: [PATCH 30/50] Bug #49837 mysqltest exec cannot handle multi-line command correctly Since the exec command line is passed on externally, it cannot take newlines Simply replace \n with space Now also added test case --- client/mysqltest.cc | 4 ++++ mysql-test/r/mysqltest.result | 6 ++++++ mysql-test/t/mysqltest.test | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 45f94982472..e88414a44e7 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -2661,6 +2661,10 @@ void do_exec(struct st_command *command) #endif #endif + /* exec command is interpreted externally and will not take newlines */ + while(replace(&ds_cmd, "\n", 1, " ", 1) == 0) + ; + DBUG_PRINT("info", ("Executing '%s' as '%s'", command->first_argument, ds_cmd.str)); diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index e77dcd7b0a6..74bf387ec0c 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -216,6 +216,12 @@ source database echo message echo message mysqltest: At line 1: Missing argument in exec +1 +1 +2 +2 +X +3 MySQL "MySQL" MySQL: The diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 45fc0715312..58f66ac814c 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -605,6 +605,15 @@ echo ; --error 1 --exec echo "--exec " | $MYSQL_TEST 2>&1 +# Multi-line exec +exec $MYSQL + test -e "select 1"; +exec $MYSQL test -e "select + 2"; +let $query = select 3 + as X; +exec $MYSQL test -e "$query"; + # ---------------------------------------------------------------------------- # Test let command # ---------------------------------------------------------------------------- From 35d0d10ac281acb87b35caec0ceb0eade9a6927d Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 20 Jan 2010 12:52:35 +0100 Subject: [PATCH 31/50] Bug #48888 mysqltest crashes on --replace_result if 'from' is longer than ~1024 symbols valgrind pointed to a buffer allocated by my_realloc which looked fishy Replaced size with what was probably intended, added test case. Now also fixed line after review comment --- client/mysqltest.cc | 4 ++-- mysql-test/r/mysqltest.result | 3 +++ mysql-test/t/mysqltest.test | 11 +++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 45f94982472..052f6421dd7 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -9452,7 +9452,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) if (pa->length+length >= pa->max_length) { if (!(new_pos= (uchar*) my_realloc((uchar*) pa->str, - (uint) (pa->max_length+PS_MALLOC), + (uint) (pa->length+length+PS_MALLOC), MYF(MY_WME)))) DBUG_RETURN(1); if (new_pos != pa->str) @@ -9463,7 +9463,7 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name) char*); pa->str=new_pos; } - pa->max_length+=PS_MALLOC; + pa->max_length= pa->length+length+PS_MALLOC; } if (pa->typelib.count >= pa->max_count-1) { diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index e77dcd7b0a6..96c92f83009 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -417,6 +417,9 @@ mysqltest: At line 1: Wrong number of arguments to replace_column in 'replace_co mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a b' mysqltest: At line 1: Wrong column number to replace_column in 'replace_column a 1' mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 b c ' +select "LONG_STRING" as x; +x +LONG_STRING mysqltest: At line 1: Invalid integer argument "10!" mysqltest: At line 1: Invalid integer argument "a" mysqltest: At line 1: Missing required argument 'connection name' to command 'connect' diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 45fc0715312..7f5a46fdcee 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1285,6 +1285,17 @@ select "a" as col1, "c" as col2; --error 1 --exec echo "--replace_column 1 b c " | $MYSQL_TEST 2>&1 +let $long_rep= 1234567890123456789012345678901234567890; +let $long_rep= $long_rep,$long_rep; +let $long_rep= $long_rep,$long_rep; +let $long_rep= $long_rep,$long_rep; +let $long_rep= $long_rep,$long_rep; +let $long_rep= $long_rep,$long_rep; + +# This tests from strings > 1024 (here 1311) + +--replace_result $long_rep LONG_STRING +eval select "$long_rep" as x; # ---------------------------------------------------------------------------- # Test sync_with_master From bdf5ace1a26076f0117986bd1786616d63d15beb Mon Sep 17 00:00:00 2001 From: Bernd Ocklin Date: Wed, 20 Jan 2010 12:54:55 +0100 Subject: [PATCH 32/50] exporting server version and other as env var (bug#50471) --- client/mysqltest.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 45f94982472..258a3171460 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7664,7 +7664,14 @@ int main(int argc, char **argv) 1024, 0, 0, get_var_key, var_free, MYF(0))) die("Variable hash initialization failed"); - var_set_string("$MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION); + var_set_string("MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION); + var_set_string("MYSQL_SYSTEM_TYPE", SYSTEM_TYPE); + var_set_string("MYSQL_MACHINE_TYPE", MACHINE_TYPE); + if (sizeof(void *) == 8) { + var_set_string("MYSQL_SYSTEM_ARCHITECTURE", "64"); + } else { + var_set_string("MYSQL_SYSTEM_ARCHITECTURE", "32"); + } memset(&master_pos, 0, sizeof(master_pos)); From 37dc5f082a27c8b52c74985a44505def67480714 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 20 Jan 2010 14:18:27 +0100 Subject: [PATCH 33/50] Bug #49878 delimiter under false 'if' makes mysqltest test fail with 'Missing end of block' delimiter not executed so does not recognize end of block Always execute delimiter command, revert after false if() block. --- client/mysqltest.cc | 20 +++++++++++++++++++- mysql-test/r/mysqltest.result | 4 ++++ mysql-test/t/mysqltest.test | 31 +++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 258a3171460..68668c92e3e 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -132,6 +132,7 @@ struct st_block int line; /* Start line of block */ my_bool ok; /* Should block be executed */ enum block_cmd cmd; /* Command owning the block */ + char delim[MAX_DELIMITER_LENGTH]; /* Delimiter before block */ }; static struct st_block block_stack[32]; @@ -5142,6 +5143,12 @@ int do_done(struct st_command *command) } else { + if (*cur_block->delim) + { + /* Restore "old" delimiter after false if block */ + strcpy (delimiter, cur_block->delim); + delimiter_length= strlen(delimiter); + } /* Pop block from stack, goto next line */ cur_block--; parser.current_line++; @@ -5200,6 +5207,7 @@ void do_block(enum block_cmd cmd, struct st_command* command) cur_block++; cur_block->cmd= cmd; cur_block->ok= FALSE; + cur_block->delim[0]= '\0'; DBUG_VOID_RETURN; } @@ -5236,6 +5244,15 @@ void do_block(enum block_cmd cmd, struct st_command* command) if (not_expr) cur_block->ok = !cur_block->ok; + if (cur_block->ok) + { + cur_block->delim[0]= '\0'; + } else + { + /* Remember "old" delimiter if entering a false if block */ + strcpy (cur_block->delim, delimiter); + } + DBUG_PRINT("info", ("OK: %d", cur_block->ok)); var_free(&v); @@ -7798,7 +7815,8 @@ int main(int argc, char **argv) command->type= Q_COMMENT; } - my_bool ok_to_do= cur_block->ok; + /* delimiter needs to be executed so we can continue to parse */ + my_bool ok_to_do= cur_block->ok || command->type == Q_DELIMITER; /* 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 diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index e77dcd7b0a6..e1dac73ab1d 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -377,6 +377,10 @@ test test2 test3 test4 +outer +true-inner +true-inner again +true-outer Counter is greater than 0, (counter=10) Counter is not 0, (counter=0) 1 diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 45fc0715312..63e15a84a72 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1006,6 +1006,37 @@ echo test3stop --delimiter ; echo test4; +# ---------------------------------------------------------------------------- +# Test that delimiter within if() works in in various combinations +# ---------------------------------------------------------------------------- + +if (0) +{ + delimiter ||; + echo false-inner|| + if (0) + { + delimiter *|| + echo false-innerer* + delimiter ||* + } + echo false-inner again|| +} +echo outer; +if (1) +{ + delimiter /; + echo true-inner/ + if (0) + { + delimiter %/ + echo true-innerer% + } + echo true-inner again/ +} +echo true-outer/ +delimiter ;/ + # ---------------------------------------------------------------------------- # Test if From bcc97357f107115c9b80338b11e7a45a646cbfc7 Mon Sep 17 00:00:00 2001 From: Bernd Ocklin Date: Fri, 22 Jan 2010 14:12:17 +0100 Subject: [PATCH 34/50] fix LD_LIBRARY_PATH (bug#50540) --- mysql-test/mysql-test-run.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index d0f7d2b2a75..2805b156487 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1787,11 +1787,11 @@ sub environment_setup { { push(@ld_library_paths, "$basedir/libmysql/.libs/", "$basedir/libmysql_r/.libs/", - "$basedir/zlib.libs/"); + "$basedir/zlib/.libs/"); } else { - push(@ld_library_paths, "$basedir/lib"); + push(@ld_library_paths, "$basedir/lib", "$basedir/lib/mysql"); } } From efd5ecb0e07472682f89a8570200713689faf48c Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 25 Jan 2010 11:20:52 +0100 Subject: [PATCH 35/50] Bug #50182 mtr: allow $MTR_PORT_BASE or --port-base= as alternative to MTR_BUILD_THREAD As suggested, convert internally to value of build_thread --- mysql-test/mysql-test-run.pl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 2805b156487..99d4774866f 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -191,7 +191,9 @@ our $opt_experimental; our $experimental_test_cases; my $baseport; +# $opt_build_thread may later be set from $opt_port_base my $opt_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto"; +my $opt_port_base= $ENV{'MTR_PORT_BASE'} || "auto"; my $build_thread= 0; my $opt_record; @@ -838,6 +840,7 @@ sub command_line_setup { # Specify ports 'build-thread|mtr-build-thread=i' => \$opt_build_thread, + 'port-base|mtr-port-base=i' => \$opt_port_base, # Test case authoring 'record' => \$opt_record, @@ -1100,6 +1103,16 @@ sub command_line_setup { $opt_mem= undef; } + if ($opt_port_base ne "auto") + { + if (my $rem= $opt_port_base % 10) + { + mtr_warning ("Port base $opt_port_base rounded down to multiple of 10"); + $opt_port_base-= $rem; + } + $opt_build_thread= $opt_port_base / 10 - 1000; + } + # -------------------------------------------------------------------------- # Check if we should speed up tests by trying to run on tmpfs # -------------------------------------------------------------------------- @@ -5326,6 +5339,11 @@ Options to control what test suites or cases to run Options that specify ports + mtr-port-base=# Base for port numbers, ports from this number to + port-base=# number+9 are reserved. Should be divisible by 10; + if not it will be rounded down. May be set with + environment variable MTR_PORT_BASE. If this value is + set and is not "auto", it overrides build-thread. mtr-build-thread=# Specify unique number to calculate port number(s) from. build-thread=# Can be set in environment variable MTR_BUILD_THREAD. Set MTR_BUILD_THREAD="auto" to automatically aquire From a09d8b78026dba796fb89ff6e86d90a8276b1b71 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 28 Jan 2010 13:01:01 +0100 Subject: [PATCH 36/50] upmerge 49210 --- mysql-test/lib/v1/mysql-test-run.pl | 6 ++++-- mysql-test/mysql-test-run.pl | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index 9630c65ade4..5d06d9c4dd8 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -1107,14 +1107,16 @@ sub command_line_setup () { if ( ! $opt_testcase_timeout ) { - $opt_testcase_timeout= $default_testcase_timeout; + $opt_testcase_timeout= + $ENV{MTR_TESTCASE_TIMEOUT} || $default_testcase_timeout; $opt_testcase_timeout*= 10 if $opt_valgrind; $opt_testcase_timeout*= 10 if ($opt_debug and $glob_win32); } if ( ! $opt_suite_timeout ) { - $opt_suite_timeout= $default_suite_timeout; + $opt_suite_timeout= + $ENV{MTR_SUITE_TIMEOUT} || $default_suite_timeout; $opt_suite_timeout*= 6 if $opt_valgrind; $opt_suite_timeout*= 6 if ($opt_debug and $glob_win32); } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e42ec86a7f6..b006145a677 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -206,10 +206,10 @@ my $opt_mark_progress; my $opt_sleep; -my $opt_testcase_timeout= 15; # minutes -my $opt_suite_timeout = 300; # minutes -my $opt_shutdown_timeout= 10; # seconds -my $opt_start_timeout = 180; # seconds +my $opt_testcase_timeout= $ENV{MTR_TESTCASE_TIMEOUT} || 15; # minutes +my $opt_suite_timeout = $ENV{MTR_SUITE_TIMEOUT} || 300; # minutes +my $opt_shutdown_timeout= $ENV{MTR_SHUTDOWN_TIMEOUT} || 10; # seconds +my $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds sub testcase_timeout { return $opt_testcase_timeout * 60; }; sub suite_timeout { return $opt_suite_timeout * 60; }; From cf72d8679a08317d3d5cb8d1338c9cafab67a961 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 28 Jan 2010 15:19:18 +0100 Subject: [PATCH 37/50] merge 49210 --- mysql-test/lib/v1/mysql-test-run.pl | 6 ++++-- mysql-test/mysql-test-run.pl | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index 9630c65ade4..5d06d9c4dd8 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -1107,14 +1107,16 @@ sub command_line_setup () { if ( ! $opt_testcase_timeout ) { - $opt_testcase_timeout= $default_testcase_timeout; + $opt_testcase_timeout= + $ENV{MTR_TESTCASE_TIMEOUT} || $default_testcase_timeout; $opt_testcase_timeout*= 10 if $opt_valgrind; $opt_testcase_timeout*= 10 if ($opt_debug and $glob_win32); } if ( ! $opt_suite_timeout ) { - $opt_suite_timeout= $default_suite_timeout; + $opt_suite_timeout= + $ENV{MTR_SUITE_TIMEOUT} || $default_suite_timeout; $opt_suite_timeout*= 6 if $opt_valgrind; $opt_suite_timeout*= 6 if ($opt_debug and $glob_win32); } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 99d4774866f..a2ea36aa34e 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -206,10 +206,10 @@ my $opt_mark_progress; my $opt_sleep; -my $opt_testcase_timeout= 15; # minutes -my $opt_suite_timeout = 300; # minutes -my $opt_shutdown_timeout= 10; # seconds -my $opt_start_timeout = 180; # seconds +my $opt_testcase_timeout= $ENV{MTR_TESTCASE_TIMEOUT} || 15; # minutes +my $opt_suite_timeout = $ENV{MTR_SUITE_TIMEOUT} || 300; # minutes +my $opt_shutdown_timeout= $ENV{MTR_SHUTDOWN_TIMEOUT} || 10; # seconds +my $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds sub testcase_timeout { return $opt_testcase_timeout * 60; }; sub suite_timeout { return $opt_suite_timeout * 60; }; From da01225202cbab96f75032d43c54d96aa5891a93 Mon Sep 17 00:00:00 2001 From: Date: Wed, 3 Feb 2010 15:49:20 +0800 Subject: [PATCH 38/50] Bug #50414 valgrind warnings: invalid file descriptor -1 in syscall write()/read() Sometimes stop/restart master or stop/restart salve can cause network error, which can cause the 'invalid file descriptor -1 in syscall write()/read()' warnings. All involved test cases except rpl_slave_load_remove_tmpfile belong to the kind of network error. So they are expected. The 'rpl_slave_load_remove_tmpfile' belongs to file error, but it is testing the file error as following code: DBUG_EXECUTE_IF("remove_slave_load_file_before_write", my_close(fd,MYF(0)); fd= -1; my_delete(fname, MYF(0));); So it's expected too. To fix the problem, add the valgrind warnings to the global suppression list to suppress it. --- mysql-test/include/mtr_warnings.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 89a6a981311..291c4c1cbe6 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -182,6 +182,12 @@ INSERT INTO global_suppressions VALUES ("==[0-9]*== For more details"), /* This comes with innodb plugin tests */ ("==[0-9]*== Warning: set address range perms: large range"), + + /* valgrind warnings: invalid file descriptor -1 in syscall + write()/read(). Bug #50414 */ + ("==[0-9]*== Warning: invalid file descriptor -1 in syscall write()"), + ("==[0-9]*== Warning: invalid file descriptor -1 in syscall read()"), + /* Transient network failures that cause warnings on reconnect. BUG#47743 and BUG#47983. From aed6da87c8cc6efb212270cf34adc67187ccb9a5 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 3 Feb 2010 15:11:52 +0100 Subject: [PATCH 39/50] Bug #31602 mysql-test-run.pl seems to have problems with file names including spaces. Too complex/risky to try to fix Instead, detect the problem and communicate that this is not supported --- mysql-test/mysql-test-run.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a2ea36aa34e..2994df80bb1 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -946,6 +946,11 @@ sub command_line_setup { # Find the absolute path to the test directory $glob_mysql_test_dir= cwd(); + if ($glob_mysql_test_dir =~ / /) + { + die("Working directory \"$glob_mysql_test_dir\" contains space\n". + "Bailing out, cannot function properly with space in path"); + } if (IS_CYGWIN) { # Use mixed path format i.e c:/path/to/ From 7b6e73d24783edcbe6c038bbf4265bd782cb0efc Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 4 Feb 2010 10:55:17 +0100 Subject: [PATCH 40/50] Bug #39774 mysql-test-run's remove_file can't use wildcards, this should be documented Added remove_files_wildcard that allows to remove multiple files at once. This is a port of original patch to Windows. --- client/mysqltest.cc | 79 ++++++++++++++++++++++++++++++++++- mysql-test/r/mysqltest.result | 3 ++ mysql-test/t/mysqltest.test | 24 +++++++++-- 3 files changed, 102 insertions(+), 4 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 12aff05eff5..d2ee5855d26 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -287,7 +287,7 @@ enum enum_commands { Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR, Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE, Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER, - Q_MOVE_FILE, Q_SEND_EVAL, + Q_MOVE_FILE, Q_REMOVE_FILES_WILDCARD, Q_SEND_EVAL, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ @@ -386,6 +386,7 @@ const char *command_names[]= "send_shutdown", "shutdown_server", "move_file", + "remove_files_wildcard", "send_eval", 0 @@ -2889,6 +2890,81 @@ void do_remove_file(struct st_command *command) } +/* + SYNOPSIS + do_remove_files_wildcard + command called command + + DESCRIPTION + remove_files_wildcard [] + Remove the files in optionally matching +*/ + +void do_remove_files_wildcard(struct st_command *command) +{ + int error= 0; + uint i; + MY_DIR *dir_info; + FILEINFO *file; + char dir_separator[2]; + static DYNAMIC_STRING ds_directory; + static DYNAMIC_STRING ds_wild; + static DYNAMIC_STRING ds_file_to_remove; + char dirname[FN_REFLEN]; + + const struct command_arg rm_args[] = { + { "directory", ARG_STRING, TRUE, &ds_directory, + "Directory containing files to delete" }, + { "filename", ARG_STRING, FALSE, &ds_wild, "File pattern to delete" } + }; + DBUG_ENTER("do_remove_files_wildcard"); + + check_command_args(command, command->first_argument, + rm_args, sizeof(rm_args)/sizeof(struct command_arg), + ' '); + fn_format(dirname, ds_directory.str, "", "", MY_UNPACK_FILENAME); + + DBUG_PRINT("info", ("listing directory: %s", dirname)); + /* Note that my_dir sorts the list if not given any flags */ + if (!(dir_info= my_dir(dirname, MYF(MY_DONT_SORT | MY_WANT_STAT)))) + { + error= 1; + goto end; + } + init_dynamic_string(&ds_file_to_remove, dirname, 1024, 1024); + dir_separator[0]= FN_LIBCHAR; + dir_separator[1]= 0; + dynstr_append(&ds_file_to_remove, dir_separator); + for (i= 0; i < (uint) dir_info->number_off_files; i++) + { + file= dir_info->dir_entry + i; + /* Remove only regular files, i.e. no directories etc. */ + /* if (!MY_S_ISREG(file->mystat->st_mode)) */ + /* MY_S_ISREG does not work here on Windows, just skip directories */ + if (MY_S_ISDIR(file->mystat->st_mode)) + continue; + if (ds_wild.length && + wild_compare(file->name, ds_wild.str, 0)) + continue; + ds_file_to_remove.length= ds_directory.length + 1; + ds_file_to_remove.str[ds_directory.length + 1]= 0; + dynstr_append(&ds_file_to_remove, file->name); + DBUG_PRINT("info", ("removing file: %s", ds_file_to_remove.str)); + error= my_delete(ds_file_to_remove.str, MYF(0)) != 0; + if (error) + break; + } + my_dirend(dir_info); + +end: + handle_command_error(command, error); + dynstr_free(&ds_directory); + dynstr_free(&ds_wild); + dynstr_free(&ds_file_to_remove); + DBUG_VOID_RETURN; +} + + /* SYNOPSIS do_copy_file @@ -7881,6 +7957,7 @@ int main(int argc, char **argv) case Q_ECHO: do_echo(command); command_executed++; break; case Q_SYSTEM: do_system(command); break; case Q_REMOVE_FILE: do_remove_file(command); break; + case Q_REMOVE_FILES_WILDCARD: do_remove_files_wildcard(command); break; case Q_MKDIR: do_mkdir(command); break; case Q_RMDIR: do_rmdir(command); break; case Q_LIST_FILES: do_list_files(command); break; diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 7d2100c627a..79341b30f7a 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -557,6 +557,7 @@ mysqltest: At line 2: Cannot run query on connection between send and reap select * from t1;; drop table t1; mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file' +mysqltest: At line 1: Missing required argument 'directory' to command 'remove_files_wildcard' mysqltest: At line 1: Missing required argument 'filename' to command 'write_file' mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found Content for test_file1 @@ -784,6 +785,8 @@ mysqltest: At line 1: change user failed: Access denied for user 'root'@'localho file1.txt file1.txt file2.txt +file11.txt +dir-list.txt SELECT 'c:\\a.txt' AS col; col z diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 748f31bb5a3..20b35d41515 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1717,6 +1717,19 @@ drop table t1; --error 1 remove_file non_existing_file; +# ---------------------------------------------------------------------------- +# test for remove_files_wildcard +# ---------------------------------------------------------------------------- + +--error 1 +--exec echo "remove_files_wildcard ;" | $MYSQL_TEST 2>&1 + +--error 1 +remove_files_wildcard non_existing_dir; + +--error 1 +remove_files_wildcard non_existing_dir non_existing_file; + # ---------------------------------------------------------------------------- # test for write_file # ---------------------------------------------------------------------------- @@ -2384,9 +2397,14 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir; cat_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt; -remove_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt; -remove_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt; -remove_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt; +list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file11.txt $MYSQLTEST_VARDIR/tmp/testdir file?.txt; +remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir file?.txt; +list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/dir-list.txt $MYSQLTEST_VARDIR/tmp/testdir file*.txt; +cat_file $MYSQLTEST_VARDIR/tmp/testdir/dir-list.txt; +remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir file*.txt; +list_files $MYSQLTEST_VARDIR/tmp/testdir; +remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir; +list_files $MYSQLTEST_VARDIR/tmp/testdir; rmdir $MYSQLTEST_VARDIR/tmp/testdir; # From ad89fa1bcdf80475f38170c204a4ea670e1b15b8 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 4 Feb 2010 13:15:42 +0100 Subject: [PATCH 41/50] Bug #39774 mysql-test-run's remove_file can't use wildcards, this should be documented Added remove_files_wildcard that allows to remove multiple files at once. This is a port of original patch to Windows. --- client/mysqltest.cc | 79 ++++++++++++++++++++++++++++++++++- mysql-test/r/mysqltest.result | 3 ++ mysql-test/t/mysqltest.test | 24 +++++++++-- 3 files changed, 102 insertions(+), 4 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 12aff05eff5..d2ee5855d26 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -287,7 +287,7 @@ enum enum_commands { Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR, Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE, Q_SEND_SHUTDOWN, Q_SHUTDOWN_SERVER, - Q_MOVE_FILE, Q_SEND_EVAL, + Q_MOVE_FILE, Q_REMOVE_FILES_WILDCARD, Q_SEND_EVAL, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ @@ -386,6 +386,7 @@ const char *command_names[]= "send_shutdown", "shutdown_server", "move_file", + "remove_files_wildcard", "send_eval", 0 @@ -2889,6 +2890,81 @@ void do_remove_file(struct st_command *command) } +/* + SYNOPSIS + do_remove_files_wildcard + command called command + + DESCRIPTION + remove_files_wildcard [] + Remove the files in optionally matching +*/ + +void do_remove_files_wildcard(struct st_command *command) +{ + int error= 0; + uint i; + MY_DIR *dir_info; + FILEINFO *file; + char dir_separator[2]; + static DYNAMIC_STRING ds_directory; + static DYNAMIC_STRING ds_wild; + static DYNAMIC_STRING ds_file_to_remove; + char dirname[FN_REFLEN]; + + const struct command_arg rm_args[] = { + { "directory", ARG_STRING, TRUE, &ds_directory, + "Directory containing files to delete" }, + { "filename", ARG_STRING, FALSE, &ds_wild, "File pattern to delete" } + }; + DBUG_ENTER("do_remove_files_wildcard"); + + check_command_args(command, command->first_argument, + rm_args, sizeof(rm_args)/sizeof(struct command_arg), + ' '); + fn_format(dirname, ds_directory.str, "", "", MY_UNPACK_FILENAME); + + DBUG_PRINT("info", ("listing directory: %s", dirname)); + /* Note that my_dir sorts the list if not given any flags */ + if (!(dir_info= my_dir(dirname, MYF(MY_DONT_SORT | MY_WANT_STAT)))) + { + error= 1; + goto end; + } + init_dynamic_string(&ds_file_to_remove, dirname, 1024, 1024); + dir_separator[0]= FN_LIBCHAR; + dir_separator[1]= 0; + dynstr_append(&ds_file_to_remove, dir_separator); + for (i= 0; i < (uint) dir_info->number_off_files; i++) + { + file= dir_info->dir_entry + i; + /* Remove only regular files, i.e. no directories etc. */ + /* if (!MY_S_ISREG(file->mystat->st_mode)) */ + /* MY_S_ISREG does not work here on Windows, just skip directories */ + if (MY_S_ISDIR(file->mystat->st_mode)) + continue; + if (ds_wild.length && + wild_compare(file->name, ds_wild.str, 0)) + continue; + ds_file_to_remove.length= ds_directory.length + 1; + ds_file_to_remove.str[ds_directory.length + 1]= 0; + dynstr_append(&ds_file_to_remove, file->name); + DBUG_PRINT("info", ("removing file: %s", ds_file_to_remove.str)); + error= my_delete(ds_file_to_remove.str, MYF(0)) != 0; + if (error) + break; + } + my_dirend(dir_info); + +end: + handle_command_error(command, error); + dynstr_free(&ds_directory); + dynstr_free(&ds_wild); + dynstr_free(&ds_file_to_remove); + DBUG_VOID_RETURN; +} + + /* SYNOPSIS do_copy_file @@ -7881,6 +7957,7 @@ int main(int argc, char **argv) case Q_ECHO: do_echo(command); command_executed++; break; case Q_SYSTEM: do_system(command); break; case Q_REMOVE_FILE: do_remove_file(command); break; + case Q_REMOVE_FILES_WILDCARD: do_remove_files_wildcard(command); break; case Q_MKDIR: do_mkdir(command); break; case Q_RMDIR: do_rmdir(command); break; case Q_LIST_FILES: do_list_files(command); break; diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 7d2100c627a..79341b30f7a 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -557,6 +557,7 @@ mysqltest: At line 2: Cannot run query on connection between send and reap select * from t1;; drop table t1; mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file' +mysqltest: At line 1: Missing required argument 'directory' to command 'remove_files_wildcard' mysqltest: At line 1: Missing required argument 'filename' to command 'write_file' mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found Content for test_file1 @@ -784,6 +785,8 @@ mysqltest: At line 1: change user failed: Access denied for user 'root'@'localho file1.txt file1.txt file2.txt +file11.txt +dir-list.txt SELECT 'c:\\a.txt' AS col; col z diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 748f31bb5a3..20b35d41515 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1717,6 +1717,19 @@ drop table t1; --error 1 remove_file non_existing_file; +# ---------------------------------------------------------------------------- +# test for remove_files_wildcard +# ---------------------------------------------------------------------------- + +--error 1 +--exec echo "remove_files_wildcard ;" | $MYSQL_TEST 2>&1 + +--error 1 +remove_files_wildcard non_existing_dir; + +--error 1 +remove_files_wildcard non_existing_dir non_existing_file; + # ---------------------------------------------------------------------------- # test for write_file # ---------------------------------------------------------------------------- @@ -2384,9 +2397,14 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir; cat_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt; -remove_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt; -remove_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt; -remove_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt; +list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file11.txt $MYSQLTEST_VARDIR/tmp/testdir file?.txt; +remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir file?.txt; +list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/dir-list.txt $MYSQLTEST_VARDIR/tmp/testdir file*.txt; +cat_file $MYSQLTEST_VARDIR/tmp/testdir/dir-list.txt; +remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir file*.txt; +list_files $MYSQLTEST_VARDIR/tmp/testdir; +remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir; +list_files $MYSQLTEST_VARDIR/tmp/testdir; rmdir $MYSQLTEST_VARDIR/tmp/testdir; # From 1f97527aaa6199f7b61934df42c1371373349b22 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 9 Feb 2010 18:13:57 +0100 Subject: [PATCH 42/50] Bug #50618 Please allow 'sleep $variable' in mtr Made mtr's sleep function understand $variables A few fixes since previous patch, added tests --- client/mysqltest.cc | 22 +++++++++++++++++----- mysql-test/r/mysqltest.result | 13 ++++++++----- mysql-test/t/mysqltest.test | 22 ++++++++++++++++++++++ 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index d2ee5855d26..539b5ccae5f 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -491,6 +491,8 @@ void free_replace(); void do_get_replace_regex(struct st_command *command); void free_replace_regex(); +/* Used by sleep */ +void check_eol_junk_line(const char *eol); void free_all_replace(){ free_replace(); @@ -1045,7 +1047,7 @@ void check_command_args(struct st_command *command, } /* Check for too many arguments passed */ ptr= command->last_argument; - while(ptr <= command->end) + while(ptr <= command->end && *ptr != '#') { if (*ptr && *ptr != ' ') die("Extra argument '%s' passed to '%.*s'", @@ -4211,10 +4213,19 @@ int do_disable_rpl_parse(struct st_command *command __attribute__((unused))) int do_sleep(struct st_command *command, my_bool real_sleep) { int error= 0; - char *p= command->first_argument; - char *sleep_start, *sleep_end= command->end; + char *sleep_start, *sleep_end; double sleep_val; + char *p; + static DYNAMIC_STRING ds_sleep; + const struct command_arg sleep_args[] = { + { "sleep_delay", ARG_STRING, TRUE, &ds_sleep, "Number of seconds to sleep." } + }; + check_command_args(command, command->first_argument, sleep_args, + sizeof(sleep_args)/sizeof(struct command_arg), + ' '); + p= ds_sleep.str; + sleep_end= ds_sleep.str + ds_sleep.length; while (my_isspace(charset_info, *p)) p++; if (!*p) @@ -4223,11 +4234,13 @@ int do_sleep(struct st_command *command, my_bool real_sleep) /* Check that arg starts with a digit, not handled by my_strtod */ if (!my_isdigit(charset_info, *sleep_start)) die("Invalid argument to %.*s \"%s\"", command->first_word_len, - command->query,command->first_argument); + command->query, sleep_start); sleep_val= my_strtod(sleep_start, &sleep_end, &error); + check_eol_junk_line(sleep_end); if (error) die("Invalid argument to %.*s \"%s\"", command->first_word_len, command->query, command->first_argument); + dynstr_free(&ds_sleep); /* Fixed sleep time selected by --sleep option */ if (opt_sleep >= 0 && !real_sleep) @@ -4236,7 +4249,6 @@ int do_sleep(struct st_command *command, my_bool real_sleep) DBUG_PRINT("info", ("sleep_val: %f", sleep_val)); if (sleep_val) my_sleep((ulong) (sleep_val * 1000000L)); - command->last_argument= sleep_end; return 0; } diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 79341b30f7a..67c08b0ae97 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -147,9 +147,10 @@ hello hello ;;;;;;;; # MySQL: -- The -mysqltest: At line 1: End of line junk detected: "6" -mysqltest: At line 1: End of line junk detected: "6" -mysqltest: At line 1: Missing delimiter +mysqltest: At line 1: Extra argument '6' passed to 'sleep' +mysqltest: At line 1: Extra argument '6' passed to 'sleep' +mysqltest: At line 1: Extra argument 'A comment +show status' passed to 'sleep' mysqltest: At line 1: End of line junk detected: "sleep 7 # Another comment " @@ -354,8 +355,10 @@ here is the sourced script here is the sourced script "hello" "hello" -mysqltest: At line 1: Missing argument to sleep -mysqltest: At line 1: Missing argument to real_sleep +mysqltest: At line 2: Invalid argument to sleep "xyz" +mysqltest: At line 2: Invalid argument to real_sleep "xyz" +mysqltest: At line 1: Missing required argument 'sleep_delay' to command 'sleep' +mysqltest: At line 1: Missing required argument 'sleep_delay' to command 'real_sleep' mysqltest: At line 1: Invalid argument to sleep "abc" mysqltest: At line 1: Invalid argument to real_sleep "abc" 1 diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 20b35d41515..25293ff29e7 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -920,6 +920,28 @@ sleep 0.5; sleep 1; real_sleep 1; +# Parameter from variable, legal and illegal +let $sleep_var= 0.1; +sleep $sleep_var; +let $sleep_var= 1; +--real_sleep $sleep_var + +--write_file $MYSQL_TMP_DIR/sleep.inc +let $sleep_var= xyz; +--sleep $sleep_var +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQL_TMP_DIR/sleep.inc 2>&1 +--remove_file $MYSQL_TMP_DIR/sleep.inc + +--write_file $MYSQL_TMP_DIR/sleep.inc +let $sleep_var= xyz; +real_sleep $sleep_var; +EOF +--error 1 +--exec $MYSQL_TEST < $MYSQL_TMP_DIR/sleep.inc 2>&1 +--remove_file $MYSQL_TMP_DIR/sleep.inc + # Missing parameter --error 1 --exec echo "sleep ;" | $MYSQL_TEST 2>&1 From 445596a12c85f736a6b2ba121bc54bc6cf16d4c6 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 11 Feb 2010 11:22:07 +0100 Subject: [PATCH 43/50] Bug #47389 Innodb tests are skipped when running as unix root user Add --user=root to collect_mysqld_features() if running as root Please disregard previous commit; this is much simpler. --- mysql-test/mysql-test-run.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a2ea36aa34e..07797410188 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1482,6 +1482,12 @@ sub collect_mysqld_features { mtr_add_arg($args, "--verbose"); mtr_add_arg($args, "--help"); + # Need --user=root if running as *nix root user + if (!IS_WINDOWS and $> == 0) + { + mtr_add_arg($args, "--user=root"); + } + my $exe_mysqld= find_mysqld($basedir); my $cmd= join(" ", $exe_mysqld, @$args); my $list= `$cmd`; From 995180af0180882a9f5f808e338368678a227071 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 11 Feb 2010 14:26:58 +0100 Subject: [PATCH 44/50] renaming test variables+c to variables_community, + is problematic --- mysql-test/r/{variables+c.result => variables_community.result} | 0 mysql-test/t/{variables+c.test => variables_community.test} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename mysql-test/r/{variables+c.result => variables_community.result} (100%) rename mysql-test/t/{variables+c.test => variables_community.test} (100%) diff --git a/mysql-test/r/variables+c.result b/mysql-test/r/variables_community.result similarity index 100% rename from mysql-test/r/variables+c.result rename to mysql-test/r/variables_community.result diff --git a/mysql-test/t/variables+c.test b/mysql-test/t/variables_community.test similarity index 100% rename from mysql-test/t/variables+c.test rename to mysql-test/t/variables_community.test From 663ffc57c5c08494d51bc27b54699144af65f427 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 16 Feb 2010 20:26:44 +0100 Subject: [PATCH 45/50] Added a needed reap to mysql-test/include/handler.inc --- mysql-test/include/handler.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/include/handler.inc b/mysql-test/include/handler.inc index 4b2e64e3bb5..2de514f27bb 100644 --- a/mysql-test/include/handler.inc +++ b/mysql-test/include/handler.inc @@ -774,6 +774,7 @@ connection default; handler t1 read a next; handler t1 close; connection con1; +--reap # Since last in this connection was a send drop table t1; disconnect con1; --source include/wait_until_disconnected.inc From 53411abce6a80af358a47d4c2c18794394cbe73d Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 16 Feb 2010 20:49:21 +0100 Subject: [PATCH 46/50] fixed wrong merge conflict in mysql-test/include/mtr_warnings.sql --- mysql-test/include/mtr_warnings.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 940d0b7b34e..9378329353b 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -215,6 +215,7 @@ INSERT INTO global_suppressions VALUES ("Slave I/O: Get master clock failed with error:.*"), ("Slave I/O: Get master COLLATION_SERVER failed with error:.*"), ("Slave I/O: Get master TIME_ZONE failed with error:.*"), + /* BUG#42147 - Concurrent DML and LOCK TABLE ... READ for InnoDB table cause warnings in errlog Note: This is a temporary suppression until Bug#42147 can be From db1f4e0bf96538ddcab0a668efbf566f537fdefd Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 17 Feb 2010 12:37:37 +0100 Subject: [PATCH 47/50] Bug #44054 MTR2: --no-reorder does not prevent reordering Some logic would group by suite always Disable this if using --noreorder Also fix getting array from collect_one_suite() in this case Amended according to previous comment --- mysql-test/lib/mtr_cases.pm | 28 ++++++++++++++++++---------- mysql-test/mysql-test-run.pl | 11 ++++++----- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index ef3c2a43e87..1b6896e5a80 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -40,7 +40,6 @@ our $default_storage_engine; our $opt_with_ndbcluster_only; our $defaults_file; our $defaults_extra_file; -our $reorder= 1; our $quick_collect; sub collect_option { @@ -99,7 +98,8 @@ sub init_pattern { # ############################################################################## -sub collect_test_cases ($$) { +sub collect_test_cases ($$$) { + my $opt_reorder= shift; # True if we're reordering tests my $suites= shift; # Semicolon separated list of test suites my $opt_cases= shift; my $cases= []; # Array of hash(one hash for each testcase) @@ -118,10 +118,16 @@ sub collect_test_cases ($$) { !(IS_WINDOWS && $::opt_embedded_server) && $lib_innodb_plugin); - foreach my $suite (split(",", $suites)) + # If not reordering, we also shouldn't group by suites, unless + # no test cases were named. + # This also effects some logic in the loop following this. + if ($opt_reorder or !@$opt_cases) { - push(@$cases, collect_one_suite($suite, $opt_cases)); - last if $some_test_found; + foreach my $suite (split(",", $suites)) + { + push(@$cases, collect_one_suite($suite, $opt_cases)); + last if $some_test_found; + } } if ( @$opt_cases ) @@ -135,6 +141,7 @@ sub collect_test_cases ($$) { my ($sname, $tname, $extension)= split_testname($test_name_spec); foreach my $test ( @$cases ) { + last unless $opt_reorder; # test->{name} is always in suite.name format if ( $test->{name} =~ /.*\.$tname/ ) { @@ -144,12 +151,13 @@ sub collect_test_cases ($$) { } if ( not $found ) { + $sname= "main" if !$opt_reorder and !$sname; mtr_error("Could not find '$tname' in '$suites' suite(s)") unless $sname; - # If suite was part of name, find it there - my ($this_case) = collect_one_suite($sname, [ $tname ]); - if ($this_case) + # If suite was part of name, find it there, may come with combinations + my @this_case = collect_one_suite($sname, [ $tname ]); + if (@this_case) { - push (@$cases, $this_case); + push (@$cases, @this_case); } else { @@ -159,7 +167,7 @@ sub collect_test_cases ($$) { } } - if ( $reorder && !$quick_collect) + if ( $opt_reorder && !$quick_collect) { # Reorder the test cases in an order that will make them faster to run my %sort_criteria; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a7ff049bcdc..1e564e26c4c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -222,6 +222,7 @@ my $opt_wait_all; my $opt_repeat= 1; my $opt_retry= 3; my $opt_retry_failure= env_or_val(MTR_RETRY_FAILURE => 2); +my $opt_reorder= 1; my $opt_strace_client; @@ -306,7 +307,7 @@ sub main { } mtr_report("Collecting tests..."); - my $tests= collect_test_cases($opt_suites, \@opt_cases); + my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases); if ( $opt_report_features ) { # Put "report features" as the first test to run @@ -629,9 +630,9 @@ sub run_test_server ($$$) { next; } - # Prefer same configuration - if (defined $result and - $result->{template_path} eq $t->{template_path}) + # Prefer same configuration, or just use next if --noreorder + if (!$opt_reorder or (defined $result and + $result->{template_path} eq $t->{template_path})) { #mtr_report("Test uses same config => good match"); # Test uses same config => good match @@ -902,7 +903,7 @@ sub command_line_setup { 'report-features' => \$opt_report_features, 'comment=s' => \$opt_comment, 'fast' => \$opt_fast, - 'reorder!' => \&collect_option, + 'reorder!' => \$opt_reorder, 'enable-disabled' => \&collect_option, 'verbose+' => \$opt_verbose, 'verbose-restart' => \&report_option, From 4d5c86fb27b1ee53658c029bc7a0991c4ed0653b Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 17 Feb 2010 16:28:02 +0100 Subject: [PATCH 48/50] Bug #51135 Please increase the maximum number of connections allowed in mysqltest Added --max-connections= argument to mysqltest and mtr Small fix to first patch: forgot to check before free'ing connections array --- client/mysqltest.cc | 31 +++++++++++++++++++++---------- mysql-test/mysql-test-run.pl | 7 +++++++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 539b5ccae5f..d45f9acd87a 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -67,6 +67,7 @@ #define MAX_COLUMNS 256 #define MAX_EMBEDDED_SERVER_ARGS 64 #define MAX_DELIMITER_LENGTH 16 +#define DEFAULT_MAX_CONN 128 /* Flags controlling send and reap */ #define QUERY_SEND_FLAG 1 @@ -75,7 +76,8 @@ enum { OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION, OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL, - OPT_MAX_CONNECT_RETRIES, OPT_MARK_PROGRESS, OPT_LOG_DIR, OPT_TAIL_LINES + OPT_MAX_CONNECT_RETRIES, OPT_MAX_CONNECTIONS, + OPT_MARK_PROGRESS, OPT_LOG_DIR, OPT_TAIL_LINES }; static int record= 0, opt_sleep= -1; @@ -88,6 +90,7 @@ const char *opt_logdir= ""; const char *opt_include= 0, *opt_charsets_dir; static int opt_port= 0; static int opt_max_connect_retries; +static int opt_max_connections= DEFAULT_MAX_CONN; static my_bool opt_compress= 0, silent= 0, verbose= 0; static my_bool debug_info_flag= 0, debug_check_flag= 0; static my_bool tty_password= 0; @@ -240,7 +243,8 @@ struct st_connection int query_done; #endif /*EMBEDDED_LIBRARY*/ }; -struct st_connection connections[128]; + +struct st_connection *connections= NULL; struct st_connection* cur_con= NULL, *next_con, *connections_end; /* @@ -1105,6 +1109,7 @@ void close_connections() mysql_close(next_con->util_mysql); my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR)); } + my_free(connections, MYF(MY_WME)); DBUG_VOID_RETURN; } @@ -1145,7 +1150,8 @@ void free_used_memory() uint i; DBUG_ENTER("free_used_memory"); - close_connections(); + if (connections) + close_connections(); close_files(); hash_free(&var_hash); @@ -5121,7 +5127,7 @@ void do_connect(struct st_command *command) { if (!(con_slot= find_connection_by_name("-closed_connection-"))) die("Connection limit exhausted, you can have max %d connections", - (int) (sizeof(connections)/sizeof(struct st_connection))); + opt_max_connections); } #ifdef EMBEDDED_LIBRARY @@ -5870,6 +5876,10 @@ static struct my_option my_long_options[] = "Max number of connection attempts when connecting to server", (uchar**) &opt_max_connect_retries, (uchar**) &opt_max_connect_retries, 0, GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0}, + {"max-connections", OPT_MAX_CONNECTIONS, + "Max number of open connections to server", + (uchar**) &opt_max_connections, (uchar**) &opt_max_connections, 0, + GET_INT, REQUIRED_ARG, 128, 8, 5120, 0, 0, 0}, {"password", 'p', "Password to use when connecting to server.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " @@ -7741,12 +7751,6 @@ int main(int argc, char **argv) /* Init expected errors */ memset(&saved_expected_errors, 0, sizeof(saved_expected_errors)); - /* Init connections */ - memset(connections, 0, sizeof(connections)); - connections_end= connections + - (sizeof(connections)/sizeof(struct st_connection)) - 1; - next_con= connections + 1; - #ifdef EMBEDDED_LIBRARY /* set appropriate stack for the 'query' threads */ (void) pthread_attr_init(&cn_thd_attrib); @@ -7808,6 +7812,13 @@ int main(int argc, char **argv) verbose_msg("Tracing progress in '%s'.", progress_file.file_name()); } + /* Init connections, allocate 1 extra as buffer + 1 for default */ + connections= (struct st_connection*) + my_malloc((opt_max_connections+2) * sizeof(struct st_connection), + MYF(MY_WME | MY_ZEROFILL)); + connections_end= connections + opt_max_connections +1; + next_con= connections + 1; + var_set_int("$PS_PROTOCOL", ps_protocol); var_set_int("$SP_PROTOCOL", sp_protocol); var_set_int("$VIEW_PROTOCOL", view_protocol); diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 1e564e26c4c..a35741bebda 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -203,6 +203,7 @@ my $opt_skip_core; our $opt_check_testcases= 1; my $opt_mark_progress; +my $opt_max_connections; my $opt_sleep; @@ -923,6 +924,7 @@ sub command_line_setup { 'warnings!' => \$opt_warnings, 'timestamp' => \&report_option, 'timediff' => \&report_option, + 'max-connections=i' => \$opt_max_connections, 'help|h' => \$opt_usage, 'list-options' => \$opt_list_options, @@ -4909,6 +4911,10 @@ sub start_mysqltest ($) { mtr_add_arg($args, "--ssl"); } + if ( $opt_max_connections ) { + mtr_add_arg($args, "--max-connections=%d", $opt_max_connections); + } + if ( $opt_embedded_server ) { @@ -5467,6 +5473,7 @@ Misc options timestamp Print timestamp before each test report line timediff With --timestamp, also print time passed since *previous* test started + max-connections=N Max number of open connection to server in mysqltest HERE exit(1); From df555c117cb9415e6076c48c94189c421837f4b0 Mon Sep 17 00:00:00 2001 From: "hery.ramilison@sun.com" <> Date: Wed, 17 Feb 2010 18:39:28 +0100 Subject: [PATCH 49/50] configure.in - Changes to the banner text - Use older AC_PROG_LIBTOOL (Bug#51009) scripts/mysql_install_db.sh - Changes to banner text --- configure.in | 20 +++++++------------- scripts/mysql_install_db.sh | 6 +----- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/configure.in b/configure.in index f2e83abc60c..32326df06aa 100644 --- a/configure.in +++ b/configure.in @@ -14,8 +14,7 @@ AC_CANONICAL_SYSTEM # TAR files, the path name is split into two parts, a 155 chacater # first part and a 100 character second part. AM_INIT_AUTOMAKE([1.9 tar-ustar]) -LT_INIT -LT_PREREQ([1.5.6]) +AC_PROG_LIBTOOL AM_CONFIG_HEADER([include/config.h]) @@ -2912,17 +2911,12 @@ AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' C AC_OUTPUT -echo -echo "MySQL has a Web site at http://www.mysql.com/ which carries details on the" -echo "latest release, upcoming features, and other information to make your" -echo "work or play with MySQL more productive. There you can also find" -echo "information about mailing lists for MySQL discussion." -echo -echo "Remember to check the platform specific part of the reference manual for" -echo "hints about installing MySQL on your platform. Also have a look at the" -echo "files in the Docs directory." -echo -# The following text is checked in ./Do-compile to verify that configure +# The first line "Thank you ..." is checked in ./Do-compile to verify that configure # ended sucessfully - don't remove it. +echo echo "Thank you for choosing MySQL!" echo +echo "Remember to check the platform specific part of the reference manual" +echo "for hints about installing MySQL on your platform." +echo "Also have a look at the files in the Docs directory." +echo diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 20b7973cb4e..c5e4a1f1cba 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -410,8 +410,7 @@ else echo "Try 'mysqld --help' if you have problems with paths. Using --log" echo "gives you a log in $ldata that may be helpful." echo - echo "The latest information about MySQL is available on the web at" - echo "http://www.mysql.com/. Please consult the MySQL manual section" + echo "Please consult the MySQL manual section" echo "'Problems running mysql_install_db', and the manual section that" echo "describes problems on your OS. Another information source are the" echo "MySQL email archives available at http://lists.mysql.com/." @@ -470,9 +469,6 @@ then echo echo "Please report any problems with the $scriptdir/mysqlbug script!" echo - echo "The latest information about MySQL is available at http://www.mysql.com/" - echo "Support MySQL by buying support/licenses from http://shop.mysql.com/" - echo fi exit 0 From 7b7dd8dc0a70fce68bb02b7f4fb6031089559a18 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Sat, 20 Feb 2010 12:26:22 +0300 Subject: [PATCH 50/50] Fix default.conf. --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index a81954c9bcd..fcb3cab2de6 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-trunk-mtr" +tree_name = "mysql-trunk"