mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
fix test failures with ASAN
ASAN uses *a lot* more stack. use not_asan.inc for tests that recursively put a lot of data on the stack
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
# In embedded server we don't really have a control over stack usage
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/not_asan.inc
|
||||
|
||||
#
|
||||
# Bug#21476: Lost Database Connection During Query
|
||||
|
101
mysql-test/main/lotofstack.result
Normal file
101
mysql-test/main/lotofstack.result
Normal file
@ -0,0 +1,101 @@
|
||||
create function bug10100f(prm int) returns int
|
||||
begin
|
||||
if prm > 1 then
|
||||
return prm * bug10100f(prm - 1);
|
||||
end if;
|
||||
return 1;
|
||||
end|
|
||||
set statement sql_mode = '' for
|
||||
create procedure bug10100p(prm int, inout res int)
|
||||
begin
|
||||
set res = res * prm;
|
||||
if prm > 1 then
|
||||
call bug10100p(prm - 1, res);
|
||||
end if;
|
||||
end|
|
||||
set statement sql_mode = '' for
|
||||
create procedure bug10100t(prm int)
|
||||
begin
|
||||
declare res int;
|
||||
set res = 1;
|
||||
call bug10100p(prm, res);
|
||||
select res;
|
||||
end|
|
||||
create table t3 (a int)|
|
||||
insert into t3 values (0)|
|
||||
create view v1 as select a from t3|
|
||||
create procedure bug10100pt(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
update t3 set a=level;
|
||||
FLUSH TABLES;
|
||||
call bug10100pt(level+1, lim);
|
||||
else
|
||||
select * from t3;
|
||||
end if;
|
||||
end|
|
||||
create procedure bug10100pv(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
update v1 set a=level;
|
||||
FLUSH TABLES;
|
||||
call bug10100pv(level+1, lim);
|
||||
else
|
||||
select * from v1;
|
||||
end if;
|
||||
end|
|
||||
prepare stmt2 from "select * from t3;";
|
||||
create procedure bug10100pd(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
select level;
|
||||
prepare stmt1 from "update t3 set a=a+2";
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
deallocate prepare stmt1;
|
||||
execute stmt2;
|
||||
select * from t3;
|
||||
call bug10100pd(level+1, lim);
|
||||
else
|
||||
execute stmt2;
|
||||
end if;
|
||||
end|
|
||||
create procedure bug10100pc(level int, lim int)
|
||||
begin
|
||||
declare lv int;
|
||||
declare c cursor for select a from t3;
|
||||
open c;
|
||||
if level < lim then
|
||||
select level;
|
||||
fetch c into lv;
|
||||
select lv;
|
||||
update t3 set a=level+lv;
|
||||
FLUSH TABLES;
|
||||
call bug10100pc(level+1, lim);
|
||||
else
|
||||
select * from t3;
|
||||
end if;
|
||||
close c;
|
||||
end|
|
||||
set @@max_sp_recursion_depth=255|
|
||||
set @var=1|
|
||||
call bug10100p(255, @var)|
|
||||
call bug10100pt(1,255)|
|
||||
call bug10100pv(1,255)|
|
||||
call bug10100pd(1,255)|
|
||||
call bug10100pc(1,255)|
|
||||
set @@max_sp_recursion_depth=0|
|
||||
deallocate prepare stmt2|
|
||||
drop function bug10100f|
|
||||
drop procedure bug10100p|
|
||||
drop procedure bug10100t|
|
||||
drop procedure bug10100pt|
|
||||
drop procedure bug10100pv|
|
||||
drop procedure bug10100pd|
|
||||
drop procedure bug10100pc|
|
||||
drop view v1|
|
||||
drop table t3|
|
133
mysql-test/main/lotofstack.test
Normal file
133
mysql-test/main/lotofstack.test
Normal file
@ -0,0 +1,133 @@
|
||||
#
|
||||
# For tests that need a lot of stack - they likely won't work under ASAN
|
||||
#
|
||||
source include/not_asan.inc;
|
||||
source include/not_embedded.inc;
|
||||
|
||||
#
|
||||
# Bug#10100 function (and stored procedure?) recursivity problem
|
||||
#
|
||||
# routines with simple recursion
|
||||
delimiter |;
|
||||
create function bug10100f(prm int) returns int
|
||||
begin
|
||||
if prm > 1 then
|
||||
return prm * bug10100f(prm - 1);
|
||||
end if;
|
||||
return 1;
|
||||
end|
|
||||
set statement sql_mode = '' for
|
||||
create procedure bug10100p(prm int, inout res int)
|
||||
begin
|
||||
set res = res * prm;
|
||||
if prm > 1 then
|
||||
call bug10100p(prm - 1, res);
|
||||
end if;
|
||||
end|
|
||||
set statement sql_mode = '' for
|
||||
create procedure bug10100t(prm int)
|
||||
begin
|
||||
declare res int;
|
||||
set res = 1;
|
||||
call bug10100p(prm, res);
|
||||
select res;
|
||||
end|
|
||||
|
||||
# a procedure which use tables and recursion
|
||||
create table t3 (a int)|
|
||||
insert into t3 values (0)|
|
||||
create view v1 as select a from t3|
|
||||
create procedure bug10100pt(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
update t3 set a=level;
|
||||
FLUSH TABLES;
|
||||
call bug10100pt(level+1, lim);
|
||||
else
|
||||
select * from t3;
|
||||
end if;
|
||||
end|
|
||||
# view & recursion
|
||||
create procedure bug10100pv(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
update v1 set a=level;
|
||||
FLUSH TABLES;
|
||||
call bug10100pv(level+1, lim);
|
||||
else
|
||||
select * from v1;
|
||||
end if;
|
||||
end|
|
||||
# dynamic sql & recursion
|
||||
prepare stmt2 from "select * from t3;";
|
||||
create procedure bug10100pd(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
select level;
|
||||
prepare stmt1 from "update t3 set a=a+2";
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
deallocate prepare stmt1;
|
||||
execute stmt2;
|
||||
select * from t3;
|
||||
call bug10100pd(level+1, lim);
|
||||
else
|
||||
execute stmt2;
|
||||
end if;
|
||||
end|
|
||||
# cursor & recursion
|
||||
create procedure bug10100pc(level int, lim int)
|
||||
begin
|
||||
declare lv int;
|
||||
declare c cursor for select a from t3;
|
||||
open c;
|
||||
if level < lim then
|
||||
select level;
|
||||
fetch c into lv;
|
||||
select lv;
|
||||
update t3 set a=level+lv;
|
||||
FLUSH TABLES;
|
||||
call bug10100pc(level+1, lim);
|
||||
else
|
||||
select * from t3;
|
||||
end if;
|
||||
close c;
|
||||
end|
|
||||
|
||||
# end of the stack checking
|
||||
set @@max_sp_recursion_depth=255|
|
||||
set @var=1|
|
||||
# disable log because error about stack overrun contains numbers which
|
||||
# depend on a system
|
||||
-- disable_ps_protocol
|
||||
-- disable_result_log
|
||||
-- error ER_STACK_OVERRUN_NEED_MORE
|
||||
call bug10100p(255, @var)|
|
||||
-- error ER_STACK_OVERRUN_NEED_MORE
|
||||
call bug10100pt(1,255)|
|
||||
-- error ER_STACK_OVERRUN_NEED_MORE
|
||||
call bug10100pv(1,255)|
|
||||
-- error ER_STACK_OVERRUN_NEED_MORE
|
||||
call bug10100pd(1,255)|
|
||||
-- error ER_STACK_OVERRUN_NEED_MORE
|
||||
call bug10100pc(1,255)|
|
||||
-- enable_result_log
|
||||
-- enable_ps_protocol
|
||||
set @@max_sp_recursion_depth=0|
|
||||
|
||||
deallocate prepare stmt2|
|
||||
|
||||
drop function bug10100f|
|
||||
drop procedure bug10100p|
|
||||
drop procedure bug10100t|
|
||||
drop procedure bug10100pt|
|
||||
drop procedure bug10100pv|
|
||||
drop procedure bug10100pd|
|
||||
drop procedure bug10100pc|
|
||||
drop view v1|
|
||||
drop table t3|
|
||||
delimiter ;|
|
@ -1,7 +1,5 @@
|
||||
set @old_concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert= 0;
|
||||
drop table if exists t1,t3;
|
||||
drop procedure if exists bug4902|
|
||||
create procedure bug4902()
|
||||
begin
|
||||
show grants for 'root'@'localhost';
|
||||
@ -15,7 +13,6 @@ Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
|
||||
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
|
||||
drop procedure bug4902|
|
||||
drop procedure if exists bug4902_2|
|
||||
create procedure bug4902_2()
|
||||
begin
|
||||
show processlist;
|
||||
@ -23,13 +20,10 @@ end|
|
||||
call bug4902_2()|
|
||||
show warnings|
|
||||
Level Code Message
|
||||
Note 1305 PROCEDURE test.bug4902_2 does not exist
|
||||
call bug4902_2()|
|
||||
show warnings|
|
||||
Level Code Message
|
||||
Note 1305 PROCEDURE test.bug4902_2 does not exist
|
||||
drop procedure bug4902_2|
|
||||
drop procedure if exists bug6807|
|
||||
create procedure bug6807()
|
||||
begin
|
||||
declare a int;
|
||||
@ -42,116 +36,6 @@ ERROR 70100: Query execution was interrupted
|
||||
call bug6807()|
|
||||
ERROR 70100: Query execution was interrupted
|
||||
drop procedure bug6807|
|
||||
drop function if exists bug10100f|
|
||||
drop procedure if exists bug10100p|
|
||||
drop procedure if exists bug10100t|
|
||||
drop procedure if exists bug10100pt|
|
||||
drop procedure if exists bug10100pv|
|
||||
drop procedure if exists bug10100pd|
|
||||
drop procedure if exists bug10100pc|
|
||||
create function bug10100f(prm int) returns int
|
||||
begin
|
||||
if prm > 1 then
|
||||
return prm * bug10100f(prm - 1);
|
||||
end if;
|
||||
return 1;
|
||||
end|
|
||||
set statement sql_mode = '' for
|
||||
create procedure bug10100p(prm int, inout res int)
|
||||
begin
|
||||
set res = res * prm;
|
||||
if prm > 1 then
|
||||
call bug10100p(prm - 1, res);
|
||||
end if;
|
||||
end|
|
||||
set statement sql_mode = '' for
|
||||
create procedure bug10100t(prm int)
|
||||
begin
|
||||
declare res int;
|
||||
set res = 1;
|
||||
call bug10100p(prm, res);
|
||||
select res;
|
||||
end|
|
||||
create table t3 (a int)|
|
||||
insert into t3 values (0)|
|
||||
create view v1 as select a from t3|
|
||||
create procedure bug10100pt(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
update t3 set a=level;
|
||||
FLUSH TABLES;
|
||||
call bug10100pt(level+1, lim);
|
||||
else
|
||||
select * from t3;
|
||||
end if;
|
||||
end|
|
||||
create procedure bug10100pv(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
update v1 set a=level;
|
||||
FLUSH TABLES;
|
||||
call bug10100pv(level+1, lim);
|
||||
else
|
||||
select * from v1;
|
||||
end if;
|
||||
end|
|
||||
prepare stmt2 from "select * from t3;";
|
||||
create procedure bug10100pd(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
select level;
|
||||
prepare stmt1 from "update t3 set a=a+2";
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
deallocate prepare stmt1;
|
||||
execute stmt2;
|
||||
select * from t3;
|
||||
call bug10100pd(level+1, lim);
|
||||
else
|
||||
execute stmt2;
|
||||
end if;
|
||||
end|
|
||||
create procedure bug10100pc(level int, lim int)
|
||||
begin
|
||||
declare lv int;
|
||||
declare c cursor for select a from t3;
|
||||
open c;
|
||||
if level < lim then
|
||||
select level;
|
||||
fetch c into lv;
|
||||
select lv;
|
||||
update t3 set a=level+lv;
|
||||
FLUSH TABLES;
|
||||
call bug10100pc(level+1, lim);
|
||||
else
|
||||
select * from t3;
|
||||
end if;
|
||||
close c;
|
||||
end|
|
||||
set @@max_sp_recursion_depth=255|
|
||||
set @var=1|
|
||||
call bug10100p(255, @var)|
|
||||
call bug10100pt(1,255)|
|
||||
call bug10100pv(1,255)|
|
||||
call bug10100pd(1,255)|
|
||||
call bug10100pc(1,255)|
|
||||
set @@max_sp_recursion_depth=0|
|
||||
deallocate prepare stmt2|
|
||||
drop function bug10100f|
|
||||
drop procedure bug10100p|
|
||||
drop procedure bug10100t|
|
||||
drop procedure bug10100pt|
|
||||
drop procedure bug10100pv|
|
||||
drop procedure bug10100pd|
|
||||
drop procedure bug10100pc|
|
||||
drop view v1|
|
||||
drop table t3|
|
||||
drop procedure if exists bug15298_1;
|
||||
drop procedure if exists bug15298_2;
|
||||
create user 'mysqltest_1'@'localhost';
|
||||
grant all privileges on test.* to 'mysqltest_1'@'localhost';
|
||||
create procedure 15298_1 () sql security definer show grants for current_user;
|
||||
@ -170,8 +54,6 @@ disconnect con1;
|
||||
drop user mysqltest_1@localhost;
|
||||
drop procedure 15298_1;
|
||||
drop procedure 15298_2;
|
||||
drop table if exists t1;
|
||||
drop procedure if exists p1;
|
||||
create table t1 (value varchar(15));
|
||||
create procedure p1() update t1 set value='updated' where value='old';
|
||||
call p1();
|
||||
@ -283,7 +165,6 @@ disconnect con2;
|
||||
# functions in databases which names contained dot.
|
||||
#
|
||||
connection default;
|
||||
DROP DATABASE IF EXISTS `my.db`;
|
||||
create database `my.db`;
|
||||
use `my.db`;
|
||||
CREATE FUNCTION f1(a int) RETURNS INT RETURN a;
|
||||
|
@ -7,19 +7,12 @@ set @@global.concurrent_insert= 0;
|
||||
# Save the initial number of concurrent sessions
|
||||
--source include/count_sessions.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t3;
|
||||
--enable_warnings
|
||||
delimiter |;
|
||||
|
||||
|
||||
#
|
||||
# Bug#4902 Stored procedure with SHOW WARNINGS leads to packet error
|
||||
#
|
||||
# Added tests for show grants command
|
||||
--disable_warnings
|
||||
drop procedure if exists bug4902|
|
||||
--enable_warnings
|
||||
create procedure bug4902()
|
||||
begin
|
||||
show grants for 'root'@'localhost';
|
||||
@ -38,9 +31,6 @@ call bug4902()|
|
||||
drop procedure bug4902|
|
||||
|
||||
# We need separate SP for SHOW PROCESSLIST since we want use replace_column
|
||||
--disable_warnings
|
||||
drop procedure if exists bug4902_2|
|
||||
--enable_warnings
|
||||
create procedure bug4902_2()
|
||||
begin
|
||||
show processlist;
|
||||
@ -58,9 +48,6 @@ drop procedure bug4902_2|
|
||||
#
|
||||
# Bug#6807 Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug6807|
|
||||
--enable_warnings
|
||||
create procedure bug6807()
|
||||
begin
|
||||
declare a int;
|
||||
@ -77,152 +64,11 @@ call bug6807()|
|
||||
|
||||
drop procedure bug6807|
|
||||
|
||||
|
||||
#
|
||||
# Bug#10100 function (and stored procedure?) recursivity problem
|
||||
#
|
||||
--disable_warnings
|
||||
drop function if exists bug10100f|
|
||||
drop procedure if exists bug10100p|
|
||||
drop procedure if exists bug10100t|
|
||||
drop procedure if exists bug10100pt|
|
||||
drop procedure if exists bug10100pv|
|
||||
drop procedure if exists bug10100pd|
|
||||
drop procedure if exists bug10100pc|
|
||||
--enable_warnings
|
||||
# routines with simple recursion
|
||||
create function bug10100f(prm int) returns int
|
||||
begin
|
||||
if prm > 1 then
|
||||
return prm * bug10100f(prm - 1);
|
||||
end if;
|
||||
return 1;
|
||||
end|
|
||||
set statement sql_mode = '' for
|
||||
create procedure bug10100p(prm int, inout res int)
|
||||
begin
|
||||
set res = res * prm;
|
||||
if prm > 1 then
|
||||
call bug10100p(prm - 1, res);
|
||||
end if;
|
||||
end|
|
||||
set statement sql_mode = '' for
|
||||
create procedure bug10100t(prm int)
|
||||
begin
|
||||
declare res int;
|
||||
set res = 1;
|
||||
call bug10100p(prm, res);
|
||||
select res;
|
||||
end|
|
||||
|
||||
# a procedure which use tables and recursion
|
||||
create table t3 (a int)|
|
||||
insert into t3 values (0)|
|
||||
create view v1 as select a from t3|
|
||||
create procedure bug10100pt(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
update t3 set a=level;
|
||||
FLUSH TABLES;
|
||||
call bug10100pt(level+1, lim);
|
||||
else
|
||||
select * from t3;
|
||||
end if;
|
||||
end|
|
||||
# view & recursion
|
||||
create procedure bug10100pv(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
update v1 set a=level;
|
||||
FLUSH TABLES;
|
||||
call bug10100pv(level+1, lim);
|
||||
else
|
||||
select * from v1;
|
||||
end if;
|
||||
end|
|
||||
# dynamic sql & recursion
|
||||
prepare stmt2 from "select * from t3;";
|
||||
create procedure bug10100pd(level int, lim int)
|
||||
begin
|
||||
if level < lim then
|
||||
select level;
|
||||
prepare stmt1 from "update t3 set a=a+2";
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
execute stmt1;
|
||||
FLUSH TABLES;
|
||||
deallocate prepare stmt1;
|
||||
execute stmt2;
|
||||
select * from t3;
|
||||
call bug10100pd(level+1, lim);
|
||||
else
|
||||
execute stmt2;
|
||||
end if;
|
||||
end|
|
||||
# cursor & recursion
|
||||
create procedure bug10100pc(level int, lim int)
|
||||
begin
|
||||
declare lv int;
|
||||
declare c cursor for select a from t3;
|
||||
open c;
|
||||
if level < lim then
|
||||
select level;
|
||||
fetch c into lv;
|
||||
select lv;
|
||||
update t3 set a=level+lv;
|
||||
FLUSH TABLES;
|
||||
call bug10100pc(level+1, lim);
|
||||
else
|
||||
select * from t3;
|
||||
end if;
|
||||
close c;
|
||||
end|
|
||||
|
||||
# end of the stack checking
|
||||
set @@max_sp_recursion_depth=255|
|
||||
set @var=1|
|
||||
# disable log because error about stack overrun contains numbers which
|
||||
# depend on a system
|
||||
-- disable_ps_protocol
|
||||
-- disable_result_log
|
||||
-- error ER_STACK_OVERRUN_NEED_MORE
|
||||
call bug10100p(255, @var)|
|
||||
-- error ER_STACK_OVERRUN_NEED_MORE
|
||||
call bug10100pt(1,255)|
|
||||
-- error ER_STACK_OVERRUN_NEED_MORE
|
||||
call bug10100pv(1,255)|
|
||||
-- error ER_STACK_OVERRUN_NEED_MORE
|
||||
call bug10100pd(1,255)|
|
||||
-- error ER_STACK_OVERRUN_NEED_MORE
|
||||
call bug10100pc(1,255)|
|
||||
-- enable_result_log
|
||||
-- enable_ps_protocol
|
||||
set @@max_sp_recursion_depth=0|
|
||||
|
||||
deallocate prepare stmt2|
|
||||
|
||||
drop function bug10100f|
|
||||
drop procedure bug10100p|
|
||||
drop procedure bug10100t|
|
||||
drop procedure bug10100pt|
|
||||
drop procedure bug10100pv|
|
||||
drop procedure bug10100pd|
|
||||
drop procedure bug10100pc|
|
||||
drop view v1|
|
||||
drop table t3|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
|
||||
#
|
||||
# Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug15298_1;
|
||||
drop procedure if exists bug15298_2;
|
||||
--enable_warnings
|
||||
create user 'mysqltest_1'@'localhost';
|
||||
grant all privileges on test.* to 'mysqltest_1'@'localhost';
|
||||
create procedure 15298_1 () sql security definer show grants for current_user;
|
||||
@ -242,11 +88,6 @@ drop procedure 15298_2;
|
||||
# Bug#29936 Stored Procedure DML ignores low_priority_updates setting
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop procedure if exists p1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (value varchar(15));
|
||||
create procedure p1() update t1 set value='updated' where value='old';
|
||||
|
||||
@ -411,10 +252,6 @@ DROP FUNCTION f1;
|
||||
|
||||
connection default;
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS `my.db`;
|
||||
--enable_warnings
|
||||
|
||||
create database `my.db`;
|
||||
use `my.db`;
|
||||
|
||||
|
Reference in New Issue
Block a user