From d348362d2443a840da72cae0cee827d6111abe19 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Wed, 9 Apr 2008 12:27:39 +0200 Subject: [PATCH] Turn on --check-testcase by default Don't log check_warnings to binlog --- mysql-test/include/check-testcase.test | 55 ++------------------------ mysql-test/include/mtr_check.sql | 51 ++++++++++++++++++++++++ mysql-test/include/mtr_warnings.sql | 3 ++ mysql-test/mysql-test-run.pl | 6 ++- 4 files changed, 62 insertions(+), 53 deletions(-) create mode 100644 mysql-test/include/mtr_check.sql diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index 2f9d43c7778..6dcb01c13cf 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -7,58 +7,9 @@ # In that way its possible to check that a testcase does not have # any unwanted side affects. # - -# Dump all global variables except those -# that are supposed to change -show global variables where Variable_name != 'timestamp'; - -# Dump all databases, there should be none -# except those that was created during bootstrap -show databases; - -# The test database should not contain any tables -show tables from test; - -# Dump the "mysql" database and its tables -use mysql; -show tables; -show create table columns_priv; -show create table db; -show create table func; -show create table help_category; -show create table help_keyword; -show create table help_relation; -show create table help_relation; -show create table host; -show create table proc; -show create table procs_priv; -show create table tables_priv; -show create table time_zone; -show create table time_zone_leap_second; -show create table time_zone_name; -show create table time_zone_transition; -show create table time_zone_transition_type; -show create table user; - -# Select data from system tables to make sure they have been properly -# restored after test -select * from columns_priv; -select * from db order by host, db, user; -select * from func; -select * from help_category; -select * from help_keyword; -select * from help_relation; -select * from help_relation; -select * from host; -select * from proc; -select * from procs_priv; -select * from tables_priv; -select * from time_zone; -select * from time_zone_leap_second; -select * from time_zone_name; -select * from time_zone_transition; -select * from time_zone_transition_type; -select * from user; +--disable_query_log +call mtr.check_testcase(); +--enable_query_log diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql new file mode 100644 index 00000000000..9dd8a065da2 --- /dev/null +++ b/mysql-test/include/mtr_check.sql @@ -0,0 +1,51 @@ +delimiter ||; + +use mtr|| + +-- +-- Procedure used to check if server has been properly +-- restored after testcase has been run +-- +CREATE DEFINER=root@localhost PROCEDURE check_testcase() +BEGIN + + -- Dump all global variables except those + -- that are supposed to change + SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE variable_name != 'timestamp'; + + -- Dump all databases, there should be none + -- except those that was created during bootstrap + SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; + + -- The test database should not contain any tables + SELECT table_name FROM INFORMATION_SCHEMA.TABLES + WHERE table_schema='test'; + + -- Show "mysql" database, tables and columns + SELECT table_name, table_type, engine FROM INFORMATION_SCHEMA.TABLES + WHERE table_schema='mysql'; + SELECT * FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_schema='mysql'; + + -- Checksum system tables to make sure they have been properly + -- restored after test + checksum table + mysql.columns_priv, + mysql.db, + mysql.func, + mysql.help_category, + mysql.help_keyword, + mysql.help_relation, + mysql.host, + mysql.proc, + mysql.procs_priv, + mysql.tables_priv, + mysql.time_zone, + mysql.time_zone_leap_second, + mysql.time_zone_name, + mysql.time_zone_transition, + mysql.time_zone_transition_type, + mysql.user; + +END|| diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 65aa9a5842f..1a79b69c30a 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -210,6 +210,9 @@ INSERT INTO global_supressions VALUES -- CREATE DEFINER=root@localhost PROCEDURE check_warnings() BEGIN + + -- Don't write these queries to binlog + SET SQL_LOG_BIN=0; -- -- Load the server .err file into "error_log" table -- diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e817ca51cd4..7e8ed7ee422 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -145,7 +145,7 @@ my $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto"; my $opt_record; my $opt_report_features; -our $opt_check_testcases; +our $opt_check_testcases= 1; my $opt_mark_progress; my $opt_sleep; @@ -2107,6 +2107,10 @@ sub mysql_install_db { mtr_tofile($bootstrap_sql_file, sql_to_bootstrap(mtr_grab_file("include/mtr_warnings.sql"))); + # Add procedures for checking server is restored after testcase + mtr_tofile($bootstrap_sql_file, + sql_to_bootstrap(mtr_grab_file("include/mtr_check.sql"))); + # Log bootstrap command my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; mtr_tofile($path_bootstrap_log,