summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-02-23 15:48:08 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-02-23 15:48:08 +0200
commitb91a123d8c9c321d54256d4ba055857c9505632b (patch)
tree354681fe5c859ebebc152befc9b19f62ea77c6f9
parent23368b76be5e1094cb42682dcc317e671e57efbc (diff)
downloadmariadb-git-b91a123d8c9c321d54256d4ba055857c9505632b.tar.gz
Extend have_sanitizer with ASAN+UBSAN and MSAN
Disable some tests that are too slow or big for MSAN.
-rw-r--r--mysql-test/include/not_asan.inc2
-rw-r--r--mysql-test/include/not_msan.inc6
-rw-r--r--mysql-test/include/not_ubsan.inc2
-rw-r--r--mysql-test/include/rpl_stop_server.inc4
-rw-r--r--mysql-test/main/sum_distinct-big.test1
-rw-r--r--mysql-test/suite/binlog/t/flashback-largebinlog.test2
-rw-r--r--mysql-test/suite/maria/max_length.test1
-rw-r--r--sql/sys_vars.cc20
8 files changed, 27 insertions, 11 deletions
diff --git a/mysql-test/include/not_asan.inc b/mysql-test/include/not_asan.inc
index 9fc86a8525a..38fcac15ce7 100644
--- a/mysql-test/include/not_asan.inc
+++ b/mysql-test/include/not_asan.inc
@@ -2,7 +2,7 @@
# be overcome. In normal cases one should fix the bug server/test case or in
# the worst case add a (temporary?) suppression in asan.supp or lsan.supp
-if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value="ASAN"`)
+if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "ASAN%"`)
{
--skip Can't be run with ASan
}
diff --git a/mysql-test/include/not_msan.inc b/mysql-test/include/not_msan.inc
new file mode 100644
index 00000000000..ca1e2c1d7bd
--- /dev/null
+++ b/mysql-test/include/not_msan.inc
@@ -0,0 +1,6 @@
+# This file should only be used with tests that are too big or slow for MSAN.
+
+if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`)
+{
+--skip Can't be run WITH_MSAN
+}
diff --git a/mysql-test/include/not_ubsan.inc b/mysql-test/include/not_ubsan.inc
index 809f505507e..237adcb4896 100644
--- a/mysql-test/include/not_ubsan.inc
+++ b/mysql-test/include/not_ubsan.inc
@@ -2,7 +2,7 @@
# be overcome. In normal cases one should fix the bug server/test case or in
# the worst case add a (temporary?) suppression in asan.supp or lsan.supp
-if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value="UBSAN"`)
+if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value LIKE "%UBSAN"`)
{
--skip Can't be run with UBSAN
}
diff --git a/mysql-test/include/rpl_stop_server.inc b/mysql-test/include/rpl_stop_server.inc
index 049c3d5bbd2..470e86a139d 100644
--- a/mysql-test/include/rpl_stop_server.inc
+++ b/mysql-test/include/rpl_stop_server.inc
@@ -48,7 +48,9 @@ if ($rpl_debug)
# Send shutdown to the connected server and give
# it 60 seconds (of mysqltest's default) to die before zapping it
-shutdown_server;
+let $rpl_shutdown_timeout= `select 60*(1+9*count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`;
+
+shutdown_server $rpl_shutdown_timeout;
--source include/wait_until_disconnected.inc
diff --git a/mysql-test/main/sum_distinct-big.test b/mysql-test/main/sum_distinct-big.test
index 41aa5a44c19..f808f79dfb1 100644
--- a/mysql-test/main/sum_distinct-big.test
+++ b/mysql-test/main/sum_distinct-big.test
@@ -5,6 +5,7 @@
--source include/big_test.inc
# Test will take more than one hour with valgrind
--source include/not_valgrind.inc
+--source include/not_msan.inc
--source include/have_innodb.inc
--source include/have_sequence.inc
diff --git a/mysql-test/suite/binlog/t/flashback-largebinlog.test b/mysql-test/suite/binlog/t/flashback-largebinlog.test
index fb2703dfac5..80b0da521cc 100644
--- a/mysql-test/suite/binlog/t/flashback-largebinlog.test
+++ b/mysql-test/suite/binlog/t/flashback-largebinlog.test
@@ -10,11 +10,11 @@
--let $mysqlbinlog_output= tmp/mysqlbinlog_big_1.out
--source include/have_binlog_format_row.inc
-
--source include/have_log_bin.inc
# This is a big test.
--source include/big_test.inc
+--source include/not_msan.inc
# Test needs more than 4G of memory
--source include/have_64bit.inc
diff --git a/mysql-test/suite/maria/max_length.test b/mysql-test/suite/maria/max_length.test
index a5bfb0b8fd6..02df51b33d7 100644
--- a/mysql-test/suite/maria/max_length.test
+++ b/mysql-test/suite/maria/max_length.test
@@ -6,6 +6,7 @@
--source include/big_test.inc
# This test is too slow for valgrind
--source include/not_valgrind.inc
+--source include/not_msan.inc
drop table if exists t1,t2;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index fde7041ac85..12d0631019e 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -5078,13 +5078,19 @@ static Sys_var_have Sys_have_symlink(
"--skip-symbolic-links option.",
READ_ONLY GLOBAL_VAR(have_symlink), NO_CMD_LINE);
-#if defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN)
-
-#ifdef __SANITIZE_ADDRESS__
-#define SANITIZER_MODE "ASAN"
-#else
-#define SANITIZER_MODE "UBSAN"
-#endif /* __SANITIZE_ADDRESS__ */
+#if defined __SANITIZE_ADDRESS__ || defined WITH_UBSAN || __has_feature(memory_sanitizer)
+
+# ifdef __SANITIZE_ADDRESS__
+# ifdef WITH_UBSAN
+# define SANITIZER_MODE "ASAN+UBSAN"
+# else
+# define SANITIZER_MODE "ASAN"
+# endif
+# elif defined WITH_UBSAN
+# define SANITIZER_MODE "UBSAN"
+# else
+# define SANITIZER_MODE "MSAN"
+# endif
static char *have_sanitizer;
static Sys_var_charptr Sys_have_santitizer(