Commit d90fa9ad authored by Monty's avatar Monty Committed by Sergei Golubchik

Added asan options to mysql-test-run

- Leak detection is now enabled by default
- Also added to mysql-test suppression files for asan and lsan
parent 97dd0577
# Asan suppressions
# This file should only be used with test that finds bugs in ASan that can not
# 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 @@have_sanitizer <> 'NO'`)
{
--skip Can't be run with ASan
}
# LSAN (Asan leaks) suppressions
# Leaks found by main.tls_version1
leak:gnutls_certificate_allocate_credentials
leak:gnutls_x509_trust_list_init
# Leaks found by openssl_1
leak:libtasn1
leak:libgnutls
leak:gnutls_pubkey_init
leak:gnutls_x509_privkey_init
leak:gnutls_x509_crt_init
leak:gnutls_privkey_init
leak:gnutls_x509_trust_list_init
leak:gnutls_subject_alt_names_init
leak:__gmp_default_allocate
leak:__gmp_default_reallocate
# Needed for mysqldump # Needed for mysqldump
--source include/have_utf8mb4.inc --source include/have_utf8mb4.inc
--source include/not_asan.inc
# Tests for SSL connections, only run if mysqld is compiled # Tests for SSL connections, only run if mysqld is compiled
# with support for SSL. # with support for SSL.
......
...@@ -1772,12 +1772,24 @@ sub command_line_setup { ...@@ -1772,12 +1772,24 @@ sub command_line_setup {
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Check debug related options # Check debug related options
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
$ENV{ASAN_OPTIONS}= "abort_on_error=1:" . ($ENV{ASAN_OPTIONS} || '');
$ENV{ASAN_OPTIONS}= "suppressions=${glob_mysql_test_dir}/asan.supp:" .
$ENV{ASAN_OPTIONS}
if -f "$glob_mysql_test_dir/asan.supp";
# The following can be useful when a test fails without any asan report
# on stderr like with openssl_1.test
# $ENV{ASAN_OPTIONS}= "log_path=${opt_vardir}/log/asan:" . $ENV{ASAN_OPTIONS};
# Add leak suppressions
$ENV{LSAN_OPTIONS}= "suppressions=${glob_mysql_test_dir}/lsan.supp"
if -f "$glob_mysql_test_dir/lsan.supp";
if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd || if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
$opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd || $opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd ||
$opt_manual_debug || $opt_dbx || $opt_client_dbx || $opt_manual_dbx || $opt_manual_debug || $opt_dbx || $opt_client_dbx || $opt_manual_dbx ||
$opt_debugger || $opt_client_debugger ) $opt_debugger || $opt_client_debugger )
{ {
$ENV{ASAN_OPTIONS}= 'abort_on_error=1:'.($ENV{ASAN_OPTIONS} || ''); $ENV{ASAN_OPTIONS}= 'disable_coredump=0:'. $ENV{ASAN_OPTIONS};
if ( using_extern() ) if ( using_extern() )
{ {
mtr_error("Can't use --extern when using debugger"); mtr_error("Can't use --extern when using debugger");
......
...@@ -22,6 +22,7 @@ select * from information_schema.system_variables ...@@ -22,6 +22,7 @@ select * from information_schema.system_variables
'in_predicate_conversion_threshold', 'in_predicate_conversion_threshold',
'have_openssl', 'have_openssl',
'have_symlink', 'have_symlink',
'have_sanitizer',
'hostname', 'hostname',
'large_files_support', 'log_tc_size', 'large_files_support', 'log_tc_size',
'lower_case_file_system', 'lower_case_file_system',
...@@ -48,6 +49,7 @@ select VARIABLE_NAME, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT, ...@@ -48,6 +49,7 @@ select VARIABLE_NAME, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT,
where variable_name in ( where variable_name in (
'have_openssl', 'have_openssl',
'have_symlink', 'have_symlink',
'have_sanitizer',
'hostname', 'hostname',
'large_files_support', 'large_files_support',
'lower_case_file_system', 'lower_case_file_system',
......
...@@ -11,6 +11,7 @@ variable_name not in ( ...@@ -11,6 +11,7 @@ variable_name not in (
'in_predicate_conversion_threshold', 'in_predicate_conversion_threshold',
'have_openssl', 'have_openssl',
'have_symlink', 'have_symlink',
'have_sanitizer',
'hostname', 'hostname',
'large_files_support', 'log_tc_size', 'large_files_support', 'log_tc_size',
'lower_case_file_system', 'lower_case_file_system',
...@@ -4654,6 +4655,7 @@ from information_schema.system_variables ...@@ -4654,6 +4655,7 @@ from information_schema.system_variables
where variable_name in ( where variable_name in (
'have_openssl', 'have_openssl',
'have_symlink', 'have_symlink',
'have_sanitizer',
'hostname', 'hostname',
'large_files_support', 'large_files_support',
'lower_case_file_system', 'lower_case_file_system',
...@@ -4679,6 +4681,16 @@ NUMERIC_BLOCK_SIZE NULL ...@@ -4679,6 +4681,16 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY YES READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME HAVE_SANITIZER
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
VARIABLE_COMMENT If the server is compiled with ASan (Address sanitizer) this will be set to YES, otherwise will be set to NO
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME HAVE_SYMLINK VARIABLE_NAME HAVE_SYMLINK
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR VARIABLE_TYPE VARCHAR
......
...@@ -11,6 +11,7 @@ variable_name not in ( ...@@ -11,6 +11,7 @@ variable_name not in (
'in_predicate_conversion_threshold', 'in_predicate_conversion_threshold',
'have_openssl', 'have_openssl',
'have_symlink', 'have_symlink',
'have_sanitizer',
'hostname', 'hostname',
'large_files_support', 'log_tc_size', 'large_files_support', 'log_tc_size',
'lower_case_file_system', 'lower_case_file_system',
...@@ -5746,6 +5747,7 @@ from information_schema.system_variables ...@@ -5746,6 +5747,7 @@ from information_schema.system_variables
where variable_name in ( where variable_name in (
'have_openssl', 'have_openssl',
'have_symlink', 'have_symlink',
'have_sanitizer',
'hostname', 'hostname',
'large_files_support', 'large_files_support',
'lower_case_file_system', 'lower_case_file_system',
...@@ -5771,6 +5773,16 @@ NUMERIC_BLOCK_SIZE NULL ...@@ -5771,6 +5773,16 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY YES READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME HAVE_SANITIZER
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
VARIABLE_COMMENT If the server is compiled with ASan (Address sanitizer) this will be set to YES, otherwise will be set to NO
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME HAVE_SYMLINK VARIABLE_NAME HAVE_SYMLINK
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR VARIABLE_TYPE VARCHAR
......
...@@ -675,7 +675,7 @@ MY_LOCALE *my_default_lc_time_names; ...@@ -675,7 +675,7 @@ MY_LOCALE *my_default_lc_time_names;
SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache; SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache;
SHOW_COMP_OPTION have_geometry, have_rtree_keys; SHOW_COMP_OPTION have_geometry, have_rtree_keys;
SHOW_COMP_OPTION have_crypt, have_compress; SHOW_COMP_OPTION have_crypt, have_compress, have_sanitizer;
SHOW_COMP_OPTION have_profiling; SHOW_COMP_OPTION have_profiling;
SHOW_COMP_OPTION have_openssl; SHOW_COMP_OPTION have_openssl;
...@@ -7957,6 +7957,14 @@ static int mysql_init_variables(void) ...@@ -7957,6 +7957,14 @@ static int mysql_init_variables(void)
#endif /* ! EMBEDDED_LIBRARY */ #endif /* ! EMBEDDED_LIBRARY */
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
have_sanitizer= SHOW_OPTION_NO;
#if defined(__has_feature)
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
have_sanitizer= SHOW_OPTION_YES;
#endif
#endif
#if defined(__WIN__) #if defined(__WIN__)
/* Allow Win32 users to move MySQL anywhere */ /* Allow Win32 users to move MySQL anywhere */
{ {
......
...@@ -393,7 +393,7 @@ extern SHOW_COMP_OPTION have_csv, have_innodb; ...@@ -393,7 +393,7 @@ extern SHOW_COMP_OPTION have_csv, have_innodb;
extern SHOW_COMP_OPTION have_ndbcluster, have_partitioning; extern SHOW_COMP_OPTION have_ndbcluster, have_partitioning;
extern SHOW_COMP_OPTION have_profiling; extern SHOW_COMP_OPTION have_profiling;
extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen; extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_sanitizer;
extern SHOW_COMP_OPTION have_query_cache; extern SHOW_COMP_OPTION have_query_cache;
extern SHOW_COMP_OPTION have_geometry, have_rtree_keys; extern SHOW_COMP_OPTION have_geometry, have_rtree_keys;
extern SHOW_COMP_OPTION have_crypt; extern SHOW_COMP_OPTION have_crypt;
......
...@@ -4808,6 +4808,12 @@ static Sys_var_have Sys_have_rtree_keys( ...@@ -4808,6 +4808,12 @@ static Sys_var_have Sys_have_rtree_keys(
"are available, will be set to YES, otherwise will be set to NO.", "are available, will be set to YES, otherwise will be set to NO.",
READ_ONLY GLOBAL_VAR(have_rtree_keys), NO_CMD_LINE); READ_ONLY GLOBAL_VAR(have_rtree_keys), NO_CMD_LINE);
static Sys_var_have Sys_have_santitizer(
"have_sanitizer",
"If the server is compiled with ASan (Address sanitizer) this will be "
"set to YES, otherwise will be set to NO",
READ_ONLY GLOBAL_VAR(have_sanitizer), NO_CMD_LINE);
static Sys_var_have Sys_have_ssl( static Sys_var_have Sys_have_ssl(
"have_ssl", "If the server supports secure connections, will be set to YES, " "have_ssl", "If the server supports secure connections, will be set to YES, "
"otherwise will be set to NO. If set to DISABLED, the server was compiled with " "otherwise will be set to NO. If set to DISABLED, the server was compiled with "
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
source include/have_tokudb.inc; source include/have_tokudb.inc;
source include/big_test.inc; source include/big_test.inc;
# ASan causes test to timeout
source include/not_asan.inc;
set default_storage_engine='tokudb'; set default_storage_engine='tokudb';
disable_warnings; disable_warnings;
drop table if exists t; drop table if exists t;
......
...@@ -49,6 +49,8 @@ let $more_pk_ui_tests= 0; ...@@ -49,6 +49,8 @@ let $more_pk_ui_tests= 0;
--source include/big_test.inc --source include/big_test.inc
# Skiping this test from Valgrind execution as per Bug-14627884 # Skiping this test from Valgrind execution as per Bug-14627884
--source include/not_valgrind.inc --source include/not_valgrind.inc
# Don't run with asan as it causes timeouts
--source include/not_asan.inc
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Engine specific settings and requirements # Engine specific settings and requirements
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment