diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 448ca90d48d..623df02261a 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -455,6 +455,16 @@ sub collect_one_test_case($$$$$$$) { "Test case '$tname' is skipped."); } } + 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 @@ -463,7 +473,39 @@ 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; + +} 1; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 0591c24e914..2854edd3c5e 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]= @@ -2143,6 +2144,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 ) { @@ -2222,6 +2231,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'} ) { 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/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/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 8330c391715..2511beb47d3 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/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/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/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; 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 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; + 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 90d43bf7cc0..0f71860ab9d 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