Skip to content

Commit b91a123

Browse files
committed
Extend have_sanitizer with ASAN+UBSAN and MSAN
Disable some tests that are too slow or big for MSAN.
1 parent 23368b7 commit b91a123

File tree

8 files changed

+27
-11
lines changed

8 files changed

+27
-11
lines changed

mysql-test/include/not_asan.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# be overcome. In normal cases one should fix the bug server/test case or in
33
# the worst case add a (temporary?) suppression in asan.supp or lsan.supp
44

5-
if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value="ASAN"`)
5+
if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "ASAN%"`)
66
{
77
--skip Can't be run with ASan
88
}

mysql-test/include/not_msan.inc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file should only be used with tests that are too big or slow for MSAN.
2+
3+
if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`)
4+
{
5+
--skip Can't be run WITH_MSAN
6+
}

mysql-test/include/not_ubsan.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# be overcome. In normal cases one should fix the bug server/test case or in
33
# the worst case add a (temporary?) suppression in asan.supp or lsan.supp
44

5-
if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value="UBSAN"`)
5+
if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value LIKE "%UBSAN"`)
66
{
77
--skip Can't be run with UBSAN
88
}

mysql-test/include/rpl_stop_server.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ if ($rpl_debug)
4848

4949
# Send shutdown to the connected server and give
5050
# it 60 seconds (of mysqltest's default) to die before zapping it
51-
shutdown_server;
51+
let $rpl_shutdown_timeout= `select 60*(1+9*count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`;
52+
53+
shutdown_server $rpl_shutdown_timeout;
5254

5355
--source include/wait_until_disconnected.inc
5456

mysql-test/main/sum_distinct-big.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
--source include/big_test.inc
66
# Test will take more than one hour with valgrind
77
--source include/not_valgrind.inc
8+
--source include/not_msan.inc
89
--source include/have_innodb.inc
910
--source include/have_sequence.inc
1011

mysql-test/suite/binlog/t/flashback-largebinlog.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
--let $mysqlbinlog_output= tmp/mysqlbinlog_big_1.out
1111

1212
--source include/have_binlog_format_row.inc
13-
1413
--source include/have_log_bin.inc
1514

1615
# This is a big test.
1716
--source include/big_test.inc
17+
--source include/not_msan.inc
1818
# Test needs more than 4G of memory
1919
--source include/have_64bit.inc
2020

mysql-test/suite/maria/max_length.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
--source include/big_test.inc
77
# This test is too slow for valgrind
88
--source include/not_valgrind.inc
9+
--source include/not_msan.inc
910

1011
drop table if exists t1,t2;
1112

sql/sys_vars.cc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5078,13 +5078,19 @@ static Sys_var_have Sys_have_symlink(
50785078
"--skip-symbolic-links option.",
50795079
READ_ONLY GLOBAL_VAR(have_symlink), NO_CMD_LINE);
50805080

5081-
#if defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN)
5082-
5083-
#ifdef __SANITIZE_ADDRESS__
5084-
#define SANITIZER_MODE "ASAN"
5085-
#else
5086-
#define SANITIZER_MODE "UBSAN"
5087-
#endif /* __SANITIZE_ADDRESS__ */
5081+
#if defined __SANITIZE_ADDRESS__ || defined WITH_UBSAN || __has_feature(memory_sanitizer)
5082+
5083+
# ifdef __SANITIZE_ADDRESS__
5084+
# ifdef WITH_UBSAN
5085+
# define SANITIZER_MODE "ASAN+UBSAN"
5086+
# else
5087+
# define SANITIZER_MODE "ASAN"
5088+
# endif
5089+
# elif defined WITH_UBSAN
5090+
# define SANITIZER_MODE "UBSAN"
5091+
# else
5092+
# define SANITIZER_MODE "MSAN"
5093+
# endif
50885094

50895095
static char *have_sanitizer;
50905096
static Sys_var_charptr Sys_have_santitizer(

0 commit comments

Comments
 (0)