From ec7e213b12d38b2cd0f6c3969b5f06d37ae6714f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Bl=C3=A5udd?= Date: Thu, 24 Sep 2009 16:09:11 +0200 Subject: [PATCH 1/7] Bug#47612 mtr - improving the report for valgrind erorrs - Improve the report produced when a valgrind error is detected --- mysql-test/include/check-warnings.test | 2 +- mysql-test/include/mtr_warnings.sql | 2 +- mysql-test/mysql-test-run.pl | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mysql-test/include/check-warnings.test b/mysql-test/include/check-warnings.test index 5295dd51a85..da6b7a7e92e 100644 --- a/mysql-test/include/check-warnings.test +++ b/mysql-test/include/check-warnings.test @@ -57,5 +57,5 @@ if (`select @result = 0`){ skip OK; } --enable_query_log -echo ^ Found warnings!!; +echo ^ Found warnings in $log_error!!; exit; diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index b99402c8031..c14d84ef0c8 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -207,7 +207,7 @@ BEGIN WHERE suspicious=1; IF @num_warnings > 0 THEN - SELECT file_name, line + SELECT line FROM error_log WHERE suspicious=1; --SELECT * FROM test_suppressions; -- Return 2 -> check failed diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 2a6a069d81c..4260af75fd3 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1307,6 +1307,9 @@ 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" ); + mtr_report("Running valgrind with options \"", join(" ", @valgrind_args), "\""); } @@ -3588,7 +3591,7 @@ sub extract_warning_lines ($) { # qr/^Error:|\[ERROR\]/, qr/^Warning:|mysqld: Warning/, qr/^Error:/, - qr/^==.* at 0x/, + qr/^==\d*==/, # valgrind errors qr/InnoDB: Warning|InnoDB: Error/, qr/^safe_mutex:|allocated at line/, qr/missing DBUG_RETURN/, From 017a0fd20d677294b7af427b10654156512a7c77 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 30 Sep 2009 00:19:00 +0200 Subject: [PATCH 2/7] Bug #47731 mtr freezes for many seconds when process to be killed has already gone. The problem is that safe_kill_win fails to detect a dead process. OpenProcess() will succeed even after the process died, it will first fail after the last handle to process is closed. To fix the problem, check process status with GetExitCodeProcess() and consider process to be dead if the exit code returned by this routine is not STILL_ALIVE. --- .../lib/My/SafeProcess/safe_kill_win.cc | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc index c6256fd92e1..963a02c8099 100755 --- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc +++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc @@ -30,7 +30,7 @@ int main(int argc, const char** argv ) DWORD pid= -1; HANDLE shutdown_event; char safe_process_name[32]= {0}; - int retry_open_event= 100; + int retry_open_event= 2; /* Ignore any signals */ signal(SIGINT, SIG_IGN); signal(SIGBREAK, SIG_IGN); @@ -51,15 +51,31 @@ int main(int argc, const char** argv ) { /* Check if the process is alive, otherwise there is really - no idea to retry the open of the event + no sense to retry the open of the event */ HANDLE process; - if ((process= OpenProcess(SYNCHRONIZE, FALSE, pid)) == NULL) + DWORD exit_code; + process= OpenProcess(SYNCHRONIZE| PROCESS_QUERY_INFORMATION, FALSE, pid); + if (!process) { - fprintf(stderr, "Could not open event or process %d, error: %d\n", - pid, GetLastError()); - exit(3); + /* Already died */ + exit(1); } + + if (!GetExitCodeProcess(process,&exit_code)) + { + fprintf(stderr, "GetExitCodeProcess failed, pid= %d, err= %d\n", + pid, GetLastError()); + exit(1); + } + + if (exit_code != STILL_ACTIVE) + { + /* Already died */ + CloseHandle(process); + exit(2); + } + CloseHandle(process); if (retry_open_event--) From 610778dccecac3ee16ad1e497a755946dc4dedb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Bl=C3=A5udd?= Date: Wed, 7 Oct 2009 16:25:36 +0200 Subject: [PATCH 3/7] BUG#47612 - fix review comment --- mysql-test/include/check-warnings.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/include/check-warnings.test b/mysql-test/include/check-warnings.test index da6b7a7e92e..41b0a98e43b 100644 --- a/mysql-test/include/check-warnings.test +++ b/mysql-test/include/check-warnings.test @@ -57,5 +57,5 @@ if (`select @result = 0`){ skip OK; } --enable_query_log -echo ^ Found warnings in $log_error!!; +echo ^ Found warnings in $log_error; exit; From fabde82dbd0d4281421ee414603640659c9ab8aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Bl=C3=A5udd?= Date: Thu, 8 Oct 2009 10:39:15 +0200 Subject: [PATCH 4/7] Bug#47801 The plugin test fails with the Embedded Server on Windows - Remove the "hack" from mtr.pl that skipped searching for the .dll files when embedded and windows. Now the variables will be preoperly initialized. - Make the tests detect that they can't run on windows+embedded --- mysql-test/include/not_windows_embedded.inc | 11 +++++++++++ mysql-test/mysql-test-run.pl | 2 +- mysql-test/t/plugin.test | 1 + mysql-test/t/plugin_load.test | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 mysql-test/include/not_windows_embedded.inc diff --git a/mysql-test/include/not_windows_embedded.inc b/mysql-test/include/not_windows_embedded.inc new file mode 100644 index 00000000000..46f5e0ccfce --- /dev/null +++ b/mysql-test/include/not_windows_embedded.inc @@ -0,0 +1,11 @@ +let $is_win = `select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows")`; +let $is_embedded = `select version() like '%embedded%'`; +#echo is_win: $is_win; +#echo is_embedded: $is_embedded; +if ($is_win) +{ + if ($is_embedded) + { + skip Not supported with embedded on windows; + } +} diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index b3f1a89bd36..846f307ea97 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1797,7 +1797,7 @@ sub environment_setup { # -------------------------------------------------------------------------- # Add the path where mysqld will find ha_example.so # -------------------------------------------------------------------------- - if ($mysql_version_id >= 50100 && !(IS_WINDOWS && $opt_embedded_server)) { + if ($mysql_version_id >= 50100) { my $plugin_filename; if (IS_WINDOWS) { diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test index 7fc62b445c9..788a7b336ef 100644 --- a/mysql-test/t/plugin.test +++ b/mysql-test/t/plugin.test @@ -1,3 +1,4 @@ +--source include/not_windows_embedded.inc --source include/have_example_plugin.inc CREATE TABLE t1(a int) ENGINE=EXAMPLE; diff --git a/mysql-test/t/plugin_load.test b/mysql-test/t/plugin_load.test index 8555247dd71..97b2afbe219 100644 --- a/mysql-test/t/plugin_load.test +++ b/mysql-test/t/plugin_load.test @@ -1,3 +1,4 @@ +--source include/not_windows_embedded.inc --source include/have_example_plugin.inc SELECT @@global.example_enum_var = 'e2'; From 0aca4f0011b8f13b482930f4b8088cdc4c8ab3b6 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 8 Oct 2009 11:14:42 +0200 Subject: [PATCH 5/7] Bug #46625 Pushbuild2: does not notice test failure in "Innodb Plugin" mode Disallow (and don't use) space in combination names --- mysql-test/lib/mtr_cases.pm | 4 ++-- mysql-test/mysql-test-run.pl | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 76ad5eec4e0..eabc981d54a 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -539,11 +539,11 @@ sub collect_one_suite($) push(@{$new_test->{slave_opt}}, "--plugin_load=innodb=$plugin_filename;innodb_locks=$plugin_filename"); if ($new_test->{combination}) { - $new_test->{combination}.= ' + InnoDB plugin'; + $new_test->{combination}.= '+innodb_plugin'; } else { - $new_test->{combination}= 'InnoDB plugin'; + $new_test->{combination}= 'innodb_plugin'; } push(@new_cases, $new_test); } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 846f307ea97..46a6d5af4bc 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3247,6 +3247,12 @@ sub run_testcase ($) { mtr_verbose("Running test:", $tinfo->{name}); + # Allow only alpanumerics pluss _ - + . in combination names + my $combination= $tinfo->{combination}; + if ($combination && $combination !~ /^\w[\w-\.\+]+$/) + { + mtr_error("Combination '$combination' contains illegal characters"); + } # ------------------------------------------------------- # Init variables that can change between each test case # ------------------------------------------------------- From b1b958ffab63f4988dc0a8331acd3f3bf357994f Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 8 Oct 2009 11:23:04 +0200 Subject: [PATCH 6/7] Bug #47716 mtr2 prints obscure error when started with -gdb and xterm is missing Tried to use an expression inside "" Go via variable, and add $exe to the output --- mysql-test/mysql-test-run.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 46a6d5af4bc..3f705019ea8 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4286,7 +4286,8 @@ sub mysqld_start ($$) { $opt_start_timeout, $mysqld->{'proc'})) { - mtr_error("Failed to start mysqld $mysqld->name()"); + my $mname= $mysqld->name(); + mtr_error("Failed to start mysqld $mname with command $exe"); } # Remember options used when starting From 9edd40c87e355890aabec9b7961a992c6ddc9558 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 8 Oct 2009 11:30:03 +0200 Subject: [PATCH 7/7] Bug #47218 mysqltest ignores "error" command inside if inside loop This was affected by same problem as append_file etc. Added Q_ERROR to special handling, and added small test --- client/mysqltest.cc | 1 + mysql-test/r/mysqltest.result | 1 + mysql-test/t/mysqltest.test | 3 +++ 3 files changed, 5 insertions(+) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index aaa08441e51..00131621bf5 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7708,6 +7708,7 @@ int main(int argc, char **argv) if (!ok_to_do) { if (command->type == Q_SOURCE || + command->type == Q_ERROR || command->type == Q_WRITE_FILE || command->type == Q_APPEND_FILE || command->type == Q_PERL) diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index f68413264e4..2e3a9489593 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -317,6 +317,7 @@ here is the sourced script outer=2 ifval=0 outer=1 ifval=1 here is the sourced script +ERROR 42S02: Table 'test.nowhere' doesn't exist In loop here is the sourced script diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 9859e73cfae..bcf33aa8c27 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -854,6 +854,7 @@ while ($outer) } # Test source in an if in a while which is false on 1st iteration +# Also test --error in same context let $outer= 2; # Number of outer loops let $ifval= 0; # false 1st time while ($outer) @@ -862,6 +863,8 @@ while ($outer) if ($ifval) { --source $MYSQLTEST_VARDIR/tmp/sourced.inc + --error ER_NO_SUCH_TABLE + SELECT * from nowhere; } dec $outer; inc $ifval;