Factor out default_(a|ub)sanitizer_opts in lit.
Reviewers: vitalybuka Subscribers: srhines, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D38644 llvm-svn: 315106
This commit is contained in:
parent
f29ee9a050
commit
0a4217c14b
|
@ -31,29 +31,19 @@ def push_dynamic_library_lookup_path(config, new_path):
|
|||
config.name = 'AddressSanitizer' + config.name_suffix
|
||||
|
||||
# Platform-specific default ASAN_OPTIONS for lit tests.
|
||||
default_asan_opts = ''
|
||||
if config.host_os == 'Darwin':
|
||||
# On Darwin, we default to `abort_on_error=1`, which would make tests run
|
||||
# much slower. Let's override this and run lit tests with 'abort_on_error=0'.
|
||||
# Also, make sure we do not overwhelm the syslog while testing.
|
||||
default_asan_opts = 'abort_on_error=0'
|
||||
default_asan_opts += ':log_to_syslog=0'
|
||||
default_asan_opts = list(config.default_sanitizer_opts)
|
||||
|
||||
# On Darwin, leak checking is not enabled by default. Enable for x86_64
|
||||
# tests to prevent regressions
|
||||
if config.target_arch == 'x86_64':
|
||||
default_asan_opts += ':detect_leaks=1'
|
||||
elif config.android:
|
||||
# The same as on Darwin, we default to "abort_on_error=1" which slows down
|
||||
# testing. Also, all existing tests are using "not" instead of "not --crash"
|
||||
# which does not work for abort()-terminated programs.
|
||||
default_asan_opts = 'abort_on_error=0'
|
||||
# On Darwin, leak checking is not enabled by default. Enable for x86_64
|
||||
# tests to prevent regressions
|
||||
if config.host_os == 'Darwin' and config.target_arch == 'x86_64':
|
||||
default_asan_opts += ['detect_leaks=1']
|
||||
|
||||
if default_asan_opts:
|
||||
config.environment['ASAN_OPTIONS'] = default_asan_opts
|
||||
default_asan_opts += ':'
|
||||
default_asan_opts_str = ':'.join(default_asan_opts)
|
||||
if default_asan_opts_str:
|
||||
config.environment['ASAN_OPTIONS'] = default_asan_opts_str
|
||||
default_asan_opts_str += ':'
|
||||
config.substitutions.append(('%env_asan_opts=',
|
||||
'env ASAN_OPTIONS=' + default_asan_opts))
|
||||
'env ASAN_OPTIONS=' + default_asan_opts_str))
|
||||
|
||||
# Setup source root.
|
||||
config.test_source_root = os.path.dirname(__file__)
|
||||
|
|
|
@ -11,7 +11,6 @@ import subprocess
|
|||
import lit.formats
|
||||
import lit.util
|
||||
|
||||
|
||||
# Choose between lit's internal shell pipeline runner and a real shell. If
|
||||
# LIT_USE_INTERNAL_SHELL is in the environment, we use that as an override.
|
||||
use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
|
||||
|
@ -295,3 +294,12 @@ elif config.host_os == 'Linux':
|
|||
config.substitutions.append( ("%dynamiclib", '%T/%xdynamiclib_filename') )
|
||||
config.substitutions.append( ("%xdynamiclib_filename", 'lib%xdynamiclib_namespec.so') )
|
||||
config.substitutions.append( ("%xdynamiclib_namespec", '%basename_t.dynamic') )
|
||||
|
||||
config.default_sanitizer_opts = []
|
||||
if config.host_os == 'Darwin':
|
||||
# On Darwin, we default to `abort_on_error=1`, which would make tests run
|
||||
# much slower. Let's override this and run lit tests with 'abort_on_error=0'.
|
||||
config.default_sanitizer_opts += ['abort_on_error=0']
|
||||
config.default_sanitizer_opts += ['log_to_syslog=0']
|
||||
elif config.android:
|
||||
config.default_sanitizer_opts += ['abort_on_error=0']
|
||||
|
|
|
@ -14,7 +14,7 @@ def get_required_attr(config, attr_name):
|
|||
# Setup source root.
|
||||
config.test_source_root = os.path.dirname(__file__)
|
||||
|
||||
default_ubsan_opts = []
|
||||
default_ubsan_opts = list(config.default_sanitizer_opts)
|
||||
# Choose between standalone and UBSan+ASan modes.
|
||||
ubsan_lit_test_mode = get_required_attr(config, 'ubsan_lit_test_mode')
|
||||
if ubsan_lit_test_mode == "Standalone":
|
||||
|
@ -41,13 +41,6 @@ else:
|
|||
if config.target_arch == 's390x':
|
||||
# On SystemZ we need -mbackchain to make the fast unwinder work.
|
||||
clang_ubsan_cflags.append("-mbackchain")
|
||||
if config.host_os == 'Darwin':
|
||||
# On Darwin, we default to `abort_on_error=1`, which would make tests run
|
||||
# much slower. Let's override this and run lit tests with 'abort_on_error=0'.
|
||||
default_ubsan_opts += ['abort_on_error=0']
|
||||
default_ubsan_opts += ['log_to_syslog=0']
|
||||
elif config.android:
|
||||
default_ubsan_opts += ['abort_on_error=0']
|
||||
|
||||
default_ubsan_opts_str = ':'.join(default_ubsan_opts)
|
||||
if default_ubsan_opts_str:
|
||||
|
|
Loading…
Reference in New Issue