From 46d60e77c3bf9f789341e3fdcb3c1b8d0e0026cf Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 May 2006 23:54:48 +0200 Subject: [PATCH 1/6] Parse test files to find out if it needs innodb or not, mark test as 'innodb_test' if it does and add "--skip-innodb" to master_opts if it does not. mysql-test/lib/mtr_cases.pl: Parse test files to find out if it needs innodb or not --- mysql-test/lib/mtr_cases.pl | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 448ca90d48d..2d7c880bad7 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -455,6 +455,10 @@ sub collect_one_test_case($$$$$$$) { "Test case '$tname' is skipped."); } } + else + { + mtr_options_from_test_file($tinfo,"$testdir/${tname}.test"); + } # We can't restart a running server that may be in use @@ -463,7 +467,46 @@ sub collect_one_test_case($$$$$$$) { { $tinfo->{'skip'}= 1; } + } +sub mtr_options_from_test_file($$$) { + my $tinfo= shift; + my $file= shift; + + open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!"); + my @args; + while ( ) + { + chomp; + + # Check if test uses innodb + if ( defined mtr_match_substring($_,"include/have_innodb.inc")) + { + $tinfo->{'innodb_test'} = 1; + } + + # If test sources another file, open it as well + my $value= mtr_match_prefix($_, "--source"); + if ( defined $value) + { + $value=~ s/^\s+//; # Remove leading space + $value=~ s/\s+$//; # Remove ending space + + my $sourced_file= "$::glob_mysql_test_dir/$value"; + mtr_options_from_test_file($tinfo, $sourced_file); + } + + } + close FILE; + + if ( ! $tinfo->{'innodb_test'} ) + { + # mtr_report("Adding '--skip-innodb' to $tinfo->{'name'}"); + push(@{$tinfo->{'master_opt'}}, "--skip-innodb"); + } + + +} 1; From fdeacbcf6d1a7495b40c48ec068424b8de8f607f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 May 2006 12:55:34 +0200 Subject: [PATCH 2/6] Move innodb dependent test from create to mysql_innodb --- mysql-test/r/create.result | 6 ------ mysql-test/r/innodb_mysql.result | 6 ++++++ mysql-test/t/create.test | 7 ------- mysql-test/t/innodb_mysql.test | 9 +++++++++ 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index d45960cf787..41baeedf3f8 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -772,9 +772,3 @@ t1 CREATE TABLE `t1` ( `i` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295 drop table t1; -create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb -character set utf8 collate utf8_general_ci; -Warnings: -Warning 1071 Specified key was too long; max key length is 765 bytes -insert into t1 values('aaa'); -drop table t1; diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 2a4e3555e3b..fe0f78d5ac1 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -54,3 +54,9 @@ c.c_id = 218 and expiredate is null; slai_id 12 drop table t1, t2; +create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb +character set utf8 collate utf8_general_ci; +Warnings: +Warning 1071 Specified key was too long; max key length is 765 bytes +insert into t1 values('aaa'); +drop table t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index fe8cfe70c4e..802987eabc9 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -667,12 +667,5 @@ alter table t1 max_rows=100000000000; show create table t1; drop table t1; -# -# Bug#17530: Incorrect key truncation on table creation caused server crash. -# -create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb - character set utf8 collate utf8_general_ci; -insert into t1 values('aaa'); -drop table t1; # End of 5.0 tests diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index f31e4d64789..0237913dfc9 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -57,3 +57,12 @@ where c.c_id = 218 and expiredate is null; drop table t1, t2; + + +# +# Bug#17530: Incorrect key truncation on table creation caused server crash. +# +create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb + character set utf8 collate utf8_general_ci; +insert into t1 values('aaa'); +drop table t1; From 3e12f98aa58b5d5e22254d31268a0eaa031c78ab Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 May 2006 19:16:51 +0200 Subject: [PATCH 3/6] Moving test that requires innodb to partition_innodb mysql-test/r/partition_innodb.result: New BitKeeper file ``mysql-test/r/partition_innodb.result'' mysql-test/t/partition_innodb.test: New BitKeeper file ``mysql-test/t/partition_innodb.test'' --- mysql-test/r/partition.result | 5 ----- mysql-test/r/partition_innodb.result | 5 +++++ mysql-test/t/partition.test | 7 ------- mysql-test/t/partition_innodb.test | 9 +++++++++ 4 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 mysql-test/r/partition_innodb.result create mode 100644 mysql-test/t/partition_innodb.test diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index a4dd5f9a64e..b62660c7024 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -643,11 +643,6 @@ partition by list (a) alter table t1 rebuild partition; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 drop table t1; -create table t1 (a int) engine=innodb partition by hash(a) ; -show table status like 't1'; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned -drop table t1; create table t2 (s1 int not null auto_increment, primary key (s1)) partition by list (s1) (partition p1 values in (1),partition p2 values in (2),partition p3 values in (3),partition p4 values in (4)); insert into t2 values (null),(null),(null); select * from t2; diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result new file mode 100644 index 00000000000..f4e75ccdb05 --- /dev/null +++ b/mysql-test/r/partition_innodb.result @@ -0,0 +1,5 @@ +create table t1 (a int) engine=innodb partition by hash(a) ; +show table status like 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned +drop table t1; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 1a64537b6fc..1bda625dcbd 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -756,13 +756,6 @@ alter table t1 rebuild partition; drop table t1; -# -# Bug #14673: Wrong InnoDB default row format -# -create table t1 (a int) engine=innodb partition by hash(a) ; -show table status like 't1'; -drop table t1; - # # Bug #14526: Partitions: indexed searches fail # diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test new file mode 100644 index 00000000000..84c74855fbb --- /dev/null +++ b/mysql-test/t/partition_innodb.test @@ -0,0 +1,9 @@ +--source include/have_innodb.inc + +# +# Bug #14673: Wrong InnoDB default row format +# +create table t1 (a int) engine=innodb partition by hash(a) ; +show table status like 't1'; +drop table t1; + From c295bd8082f007085955791b7c80a3cfd48fe8ba Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 May 2006 19:26:53 +0200 Subject: [PATCH 4/6] Move test that requires innodb to sp_trans --- mysql-test/r/sp-security.result | 10 --------- mysql-test/r/sp.result | 16 -------------- mysql-test/r/sp_trans.result | 26 ++++++++++++++++++++++ mysql-test/t/sp-security.test | 23 ------------------- mysql-test/t/sp.test | 17 -------------- mysql-test/t/sp_trans.test | 39 +++++++++++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 66 deletions(-) diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index af4f1c16c56..73f0eaa1513 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -314,16 +314,6 @@ select * from db_bug14533.t1; ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table 't1' drop user user_bug14533@localhost; drop database db_bug14533; -CREATE DATABASE db_bug7787; -use db_bug7787; -CREATE PROCEDURE p1() -SHOW INNODB STATUS; -Warnings: -Warning 1541 The syntax 'SHOW INNODB STATUS' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW ENGINE INNODB STATUS' instead. -GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost; -DROP DATABASE db_bug7787; -drop user user_bug7787@localhost; -use test; ---> connection: root DROP DATABASE IF EXISTS mysqltest; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 5aa984bfa4e..6d524c066a3 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -4796,22 +4796,6 @@ i 0 drop table t3| drop procedure bug16887| -create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb| -insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')| -CREATE FUNCTION bug13575 ( p1 integer ) -returns varchar(3) -BEGIN -DECLARE v1 VARCHAR(10) DEFAULT null; -SELECT f2 INTO v1 FROM t3 WHERE f1 = p1; -RETURN v1; -END| -select distinct f1, bug13575(f1) from t3 order by f1| -f1 bug13575(f1) -1 aaa -2 bbb -3 ccc -drop function bug13575; -drop table t3| drop procedure if exists bug16474_1| drop procedure if exists bug16474_2| delete from t1| diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result index 4c17226a9b0..a5012673c12 100644 --- a/mysql-test/r/sp_trans.result +++ b/mysql-test/r/sp_trans.result @@ -530,3 +530,29 @@ count(*) drop table t3, t4| drop procedure bug14210| set @@session.max_heap_table_size=default| +CREATE DATABASE db_bug7787| +use db_bug7787| +CREATE PROCEDURE p1() +SHOW INNODB STATUS; | +Warnings: +Warning 1541 The syntax 'SHOW INNODB STATUS' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW ENGINE INNODB STATUS' instead. +GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost| +DROP DATABASE db_bug7787| +drop user user_bug7787@localhost| +use test| +create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb| +insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')| +CREATE FUNCTION bug13575 ( p1 integer ) +returns varchar(3) +BEGIN +DECLARE v1 VARCHAR(10) DEFAULT null; +SELECT f2 INTO v1 FROM t3 WHERE f1 = p1; +RETURN v1; +END| +select distinct f1, bug13575(f1) from t3 order by f1| +f1 bug13575(f1) +1 aaa +2 bbb +3 ccc +drop function bug13575| +drop table t3| diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index a8c3c0a22eb..e791729fac4 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -526,29 +526,6 @@ drop user user_bug14533@localhost; drop database db_bug14533; -# -# BUG#7787: Stored procedures: improper warning for "grant execute" statement -# - -# Prepare. - -CREATE DATABASE db_bug7787; -use db_bug7787; - -# Test. - -CREATE PROCEDURE p1() - SHOW INNODB STATUS; - -GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost; - -# Cleanup. - -DROP DATABASE db_bug7787; -drop user user_bug7787@localhost; -use test; - - # # WL#2897: Complete definer support in the stored routines. # diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 8ccd954eeea..938ecb31439 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -5636,23 +5636,6 @@ call bug16887()| drop table t3| drop procedure bug16887| -# -# Bug#13575 SP funcs in select with distinct/group and order by can -# produce bad data -# -create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb| -insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')| -CREATE FUNCTION bug13575 ( p1 integer ) -returns varchar(3) -BEGIN -DECLARE v1 VARCHAR(10) DEFAULT null; -SELECT f2 INTO v1 FROM t3 WHERE f1 = p1; -RETURN v1; -END| -select distinct f1, bug13575(f1) from t3 order by f1| -drop function bug13575; -drop table t3| - # # BUG#16474: SP crashed MySQL # (when using "order by localvar", where 'localvar' is just that. diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test index 1ea32316f1e..325e11b1ec9 100644 --- a/mysql-test/t/sp_trans.test +++ b/mysql-test/t/sp_trans.test @@ -552,6 +552,45 @@ drop table t3, t4| drop procedure bug14210| set @@session.max_heap_table_size=default| +# +# BUG#7787: Stored procedures: improper warning for "grant execute" statement +# + +# Prepare. + +CREATE DATABASE db_bug7787| +use db_bug7787| + +# Test. + +CREATE PROCEDURE p1() + SHOW INNODB STATUS; | + +GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost| + +# Cleanup. + +DROP DATABASE db_bug7787| +drop user user_bug7787@localhost| +use test| + +# +# Bug#13575 SP funcs in select with distinct/group and order by can +# produce bad data +# +create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb| +insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')| +CREATE FUNCTION bug13575 ( p1 integer ) +returns varchar(3) +BEGIN +DECLARE v1 VARCHAR(10) DEFAULT null; +SELECT f2 INTO v1 FROM t3 WHERE f1 = p1; +RETURN v1; +END| +select distinct f1, bug13575(f1) from t3 order by f1| +drop function bug13575| +drop table t3| + # # BUG#NNNN: New bug synopsis From 20091c5b86d5a5d0b3ac3aba806286398e094825 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 May 2006 19:52:43 +0200 Subject: [PATCH 5/6] Save "master_opt" in master so it can be checked later to see if it's the same as the test that are about to run uses the same. mysql-test/lib/mtr_cases.pl: Move setting of --skip-innodb out of recursive loop --- mysql-test/lib/mtr_cases.pl | 13 ++++++------- mysql-test/mysql-test-run.pl | 11 +++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 2d7c880bad7..623df02261a 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -458,6 +458,12 @@ sub collect_one_test_case($$$$$$$) { else { mtr_options_from_test_file($tinfo,"$testdir/${tname}.test"); + + if ( ! $tinfo->{'innodb_test'} ) + { + # mtr_report("Adding '--skip-innodb' to $tinfo->{'name'}"); + push(@{$tinfo->{'master_opt'}}, "--skip-innodb"); + } } # We can't restart a running server that may be in use @@ -500,13 +506,6 @@ sub mtr_options_from_test_file($$$) { } close FILE; - if ( ! $tinfo->{'innodb_test'} ) - { - # mtr_report("Adding '--skip-innodb' to $tinfo->{'name'}"); - push(@{$tinfo->{'master_opt'}}, "--skip-innodb"); - } - - } 1; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c14e6d4d534..704baeeec94 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -876,6 +876,7 @@ sub command_line_setup () { start_timeout => 400, # enough time create innodb tables ndbcluster => 1, # ndbcluster not started + master_opt => [], }; $master->[1]= @@ -2140,6 +2141,14 @@ sub run_testcase ($) { { $do_restart= 1; } + # Check that running master was started with same options + # as the current test requires + elsif (! mtr_same_opts($master->[0]->{'master_opt'}, + $tinfo->{'master_opt'}) ) + { + $do_restart= 1; + } + if ( $do_restart ) { @@ -2219,6 +2228,8 @@ sub run_testcase ($) { report_failure_and_restart($tinfo); return; } + # Remember options used to start + $master->[0]->{'master_opt'}= $tinfo->{'master_opt'}; } if ( $using_ndbcluster_master and ! $master->[1]->{'pid'} ) { From a19fdb2b65d5aaf46ed08c53d2b3fe2bc075fea6 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 May 2006 20:07:35 +0200 Subject: [PATCH 6/6] Tests uses innodb, add test to check if innodb is available mysql-test/t/func_group.test: Test uses innodb, add test to check if innodb is available mysql-test/t/group_min_max.test: Test uses innodb, add test to check if innodb is available mysql-test/t/join_outer.test: Test uses innodb, add test to check if innodb is available --- mysql-test/t/func_group.test | 2 ++ mysql-test/t/group_min_max.test | 2 ++ mysql-test/t/join_outer.test | 2 ++ 3 files changed, 6 insertions(+) diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index c667f90940c..7c4006ac773 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -2,6 +2,8 @@ # simple test of all group functions # +--source include/have_innodb.inc + --disable_warnings drop table if exists t1,t2; --enable_warnings diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index d9836ccc8df..5974f51d58d 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -3,6 +3,8 @@ # The queries in this file test query execution via QUICK_GROUP_MIN_MAX_SELECT. # +--source include/have_innodb.inc + # # TODO: # Add queries with: diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index 7134137a430..ca32df49ae3 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -2,6 +2,8 @@ # test of left outer join # +--source include/have_innodb.inc + --disable_warnings drop table if exists t0,t1,t2,t3,t4,t5; --enable_warnings