From 39cca0323cd922b117dda7fabea93d0bb7c87560 Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.blaudden" <> Date: Mon, 2 Apr 2007 22:58:25 +0200 Subject: [PATCH 1/5] Look for "testname.warnings" file produced by mysqltest, could find problems like misspelled -- commands --- mysql-test/lib/mtr_report.pl | 9 +++++++ mysql-test/r/bdb_notembedded.result | 35 ++++++++++++++++++++++++++ mysql-test/t/bdb_notembedded.test | 38 +++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 mysql-test/r/bdb_notembedded.result create mode 100644 mysql-test/t/bdb_notembedded.test diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index 2a90344c110..d47f9051763 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -295,6 +295,15 @@ sub mtr_report_stats ($) { } } } + + # Look for warnings produced by mysqltest in testname.warnings + foreach my $test_warning_file + ( glob("$::glob_mysql_test_dir/r/*.warnings") ) + { + $found_problems= 1; + print WARN "Check myqltest warnings in $test_warning_file\n"; + } + if ( $found_problems ) { mtr_warning("Got errors/warnings while running tests, please examine", diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result new file mode 100644 index 00000000000..14cb5fad915 --- /dev/null +++ b/mysql-test/r/bdb_notembedded.result @@ -0,0 +1,35 @@ +set autocommit=1; +reset master; +create table bug16206 (a int); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 +f n Query 1 n use `test`; create table bug16206 (a int) +f n Query 1 n use `test`; insert into bug16206 values(1) +f n Query 1 n use `test`; insert into bug16206 values(2) +drop table bug16206; +reset master; +create table bug16206 (a int) engine= bdb; +insert into bug16206 values(0); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +insert into bug16206 values(3); +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4 +f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb +f n Query 1 n use `test`; insert into bug16206 values(0) +f n Query 1 n use `test`; insert into bug16206 values(1) +f n Query 1 n use `test`; BEGIN +f n Query 1 n use `test`; insert into bug16206 values(2) +f n Query 1 n use `test`; COMMIT +f n Query 1 n use `test`; insert into bug16206 values(3) +drop table bug16206; +set autocommit=0; +End of 5.0 tests diff --git a/mysql-test/t/bdb_notembedded.test b/mysql-test/t/bdb_notembedded.test new file mode 100644 index 00000000000..24e64ebbfb2 --- /dev/null +++ b/mysql-test/t/bdb_notembedded.test @@ -0,0 +1,38 @@ +-- source include/not_embedded.inc +-- source include/have_bdb.inc + +# +# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode +# +set autocommit=1; + +let $VERSION=`select version()`; + +reset master; +create table bug16206 (a int); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +--replace_result $VERSION VERSION +--replace_column 1 f 2 n 5 n +show binlog events; +drop table bug16206; + +reset master; +create table bug16206 (a int) engine= bdb; +insert into bug16206 values(0); +insert into bug16206 values(1); +start transaction; +insert into bug16206 values(2); +commit; +insert into bug16206 values(3); +--replace_result $VERSION VERSION +--replace_column 1 f 2 n 5 n +show binlog events; +drop table bug16206; + +set autocommit=0; + + +--echo End of 5.0 tests From bc675fb568f131a6af9a74880e95df008d4e1674 Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.blaudden" <> Date: Wed, 4 Apr 2007 10:59:00 +0200 Subject: [PATCH 2/5] Only check for warnings produced by mysqltest if --check-testcases --- mysql-test/lib/mtr_report.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index d47f9051763..a2f22ef8870 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -296,12 +296,15 @@ sub mtr_report_stats ($) { } } - # Look for warnings produced by mysqltest in testname.warnings - foreach my $test_warning_file - ( glob("$::glob_mysql_test_dir/r/*.warnings") ) + if ( $::opt_check_testcases ) { - $found_problems= 1; - print WARN "Check myqltest warnings in $test_warning_file\n"; + # Look for warnings produced by mysqltest in testname.warnings + foreach my $test_warning_file + ( glob("$::glob_mysql_test_dir/r/*.warnings") ) + { + $found_problems= 1; + print WARN "Check myqltest warnings in $test_warning_file\n"; + } } if ( $found_problems ) From 19801cbfdc7cf099df103c2c88a2b47b95081816 Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.blaudden" <> Date: Wed, 4 Apr 2007 15:09:12 +0200 Subject: [PATCH 3/5] Add expansion of $variables in "let from query", "if with query" and "while with query" --- client/mysqltest.c | 11 ++++++++--- mysql-test/r/mysqltest.result | 3 +++ mysql-test/t/mysqltest.test | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 170819e9a1e..0a1b3aa239c 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -1328,6 +1328,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end) MYSQL_RES *res; MYSQL_ROW row; MYSQL* mysql = &cur_con->mysql; + DYNAMIC_STRING ds_query; DBUG_ENTER("var_query_set"); LINT_INIT(res); @@ -1337,13 +1338,17 @@ void var_query_set(VAR *var, const char *query, const char** query_end) die("Syntax error in query, missing '`'"); ++query; - if (mysql_real_query(mysql, query, (int)(end - query)) || + /* Eval the query, thus replacing all environment variables */ + init_dynamic_string(&ds_query, 0, (end - query) + 32, 256); + do_eval(&ds_query, query, end, FALSE); + + if (mysql_real_query(mysql, ds_query.str, ds_query.length) || !(res = mysql_store_result(mysql))) { - *end = 0; - die("Error running query '%s': %d %s", query, + die("Error running query '%s': %d %s", ds_query.str, mysql_errno(mysql), mysql_error(mysql)); } + dynstr_free(&ds_query); if ((row = mysql_fetch_row(res)) && row[0]) { diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 71f1c7de4ed..ba37284e597 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -268,6 +268,9 @@ mysqltest: At line 1: Missing assignment operator in let 1 # Execute: echo $success ; 1 +var2: content of variable 1 +var3: content of variable 1 content of variable 1 +length of var3 is longer than 0 mysqltest: At line 1: Missing required argument 'filename' to command 'source' mysqltest: At line 1: Could not open file ./non_existingFile mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 221ad5d5c6e..9a7139187b5 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -685,6 +685,21 @@ echo # success: $success ; --echo # Execute: echo \$success ; echo $success ; +# ---------------------------------------------------------------------------- +# Test let from query with $variable +# let $=``; +# ---------------------------------------------------------------------------- + +let $var1=content of variable 1; +let $var2= `select "$var1"`; +let $var3= `select concat("$var1", " ", "$var2")`; +echo var2: $var2; +echo var3: $var3; +if (`select length("$var3") > 0`) +{ + echo length of var3 is longer than 0; +} + # ---------------------------------------------------------------------------- # Test to assign let from query # let $=``; From fc992b0667ba10c6fcb83152378b512944b0ed4e Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.blaudden" <> Date: Wed, 4 Apr 2007 15:15:40 +0200 Subject: [PATCH 4/5] Add "skip" function, makeing mysqltest return an error code indicating test should be skipped --- client/mysqltest.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 0a1b3aa239c..c2fd7a4ff0d 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -276,7 +276,7 @@ enum enum_commands { Q_IF, Q_DISABLE_PARSING, Q_ENABLE_PARSING, Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST, - Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, + Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP, Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES, Q_UNKNOWN, /* Unknown command. */ @@ -358,6 +358,7 @@ const char *command_names[]= "die", /* Don't execute any more commands, compare result */ "exit", + "skip", "chmod", "append_file", "cat_file", @@ -6258,6 +6259,9 @@ int main(int argc, char **argv) /* Stop processing any more commands */ abort_flag= 1; break; + case Q_SKIP: + abort_not_supported_test("%s", command->first_argument); + break; case Q_RESULT: die("result, deprecated command"); From 678a35874676e1da065df6e971be002ff39b40ba Mon Sep 17 00:00:00 2001 From: "msvensson@pilot.blaudden" <> Date: Wed, 4 Apr 2007 15:40:40 +0200 Subject: [PATCH 5/5] Skip test cases if the script or binary they need can't be found --- mysql-test/mysql-test-run.pl | 8 ++------ mysql-test/t/fix_priv_tables.test | 7 +++++++ mysql-test/t/system_mysql_db_fix30020.test | 8 ++++++-- mysql-test/t/system_mysql_db_fix40123.test | 7 +++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index b48ac6c5abc..6bd9122f07f 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -724,8 +724,6 @@ sub command_line_setup () { { $mysqld_variables{'port'}= 3306; $mysqld_variables{'master-port'}= 3306; - $opt_skip_ndbcluster= 1; - $opt_skip_im= 1; } if ( $opt_comment ) @@ -1235,6 +1233,7 @@ sub command_line_setup () { { # Turn off features not supported when running with extern server $opt_skip_rpl= 1; + $opt_skip_ndbcluster= 1; # Setup master->[0] with the settings for the extern server $master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock"; @@ -2011,10 +2010,7 @@ sub environment_setup () { $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables; } - if (!$opt_extern) - { - $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; - } + $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; # ---------------------------------------------------- # Setup env so childs can execute my_print_defaults diff --git a/mysql-test/t/fix_priv_tables.test b/mysql-test/t/fix_priv_tables.test index 3a91f41dfcc..3051fd88076 100644 --- a/mysql-test/t/fix_priv_tables.test +++ b/mysql-test/t/fix_priv_tables.test @@ -1,6 +1,13 @@ # Embedded server doesn't support external clients --source include/not_embedded.inc +# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set +# to the location of mysql_fix_privilege_tables.sql +if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`) +{ + skip Test need MYSQL_FIX_PRIVILEGE_TABLES; +} + # # This is the test for mysql_fix_privilege_tables # It checks that a system tables from mysql 4.1.23 diff --git a/mysql-test/t/system_mysql_db_fix30020.test b/mysql-test/t/system_mysql_db_fix30020.test index b71ae6c2204..23562807c14 100644 --- a/mysql-test/t/system_mysql_db_fix30020.test +++ b/mysql-test/t/system_mysql_db_fix30020.test @@ -1,8 +1,12 @@ # Embedded server doesn't support external clients --source include/not_embedded.inc -# Windows doesn't support execution of shell scripts (to fix!!) ---source include/not_windows.inc +# Don't run this test if $MYSQL_FIX_SYSTEM_TABLES isn't set +# to the location of mysql_fix_privilege_tables.sql +if (`SELECT LENGTH("$MYSQL_FIX_SYSTEM_TABLES") <= 0`) +{ + skip Test need MYSQL_FIX_SYSTEM_TABLES; +} # # This is the test for mysql_fix_privilege_tables diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test index 471598625d4..012d05af3b8 100644 --- a/mysql-test/t/system_mysql_db_fix40123.test +++ b/mysql-test/t/system_mysql_db_fix40123.test @@ -1,6 +1,13 @@ # Embedded server doesn't support external clients --source include/not_embedded.inc +# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set +# to the location of mysql_fix_privilege_tables.sql +if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`) +{ + skip Test need MYSQL_FIX_PRIVILEGE_TABLES; +} + # # This is the test for mysql_fix_privilege_tables # It checks that a system tables from mysql 4.1.23