Setup llvm-symbolizer when running the tests with sanitizers
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221966 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
05123a8d9f
commit
44678f4058
14
test/lit.cfg
14
test/lit.cfg
@ -425,16 +425,30 @@ class Configuration(object):
|
||||
def configure_sanitizer(self):
|
||||
san = self.get_lit_conf('llvm_use_sanitizer', '').strip()
|
||||
if san:
|
||||
# Search for llvm-symbolizer along the compiler path first
|
||||
# and then along the PATH env variable.
|
||||
symbolizer_search_paths = os.environ.get('PATH', '')
|
||||
cxx_path = lit.util.which(self.cxx)
|
||||
if cxx_path is not None:
|
||||
symbolizer_search_paths = os.path.dirname(cxx_path) + \
|
||||
os.pathsep + symbolizer_search_paths
|
||||
llvm_symbolizer = lit.util.which('llvm-symbolizer',
|
||||
symbolizer_search_paths)
|
||||
# Setup the sanitizer compile flags
|
||||
self.compile_flags += ['-fno-omit-frame-pointer']
|
||||
if sys.platform.startswith('linux'):
|
||||
self.link_flags += ['-ldl']
|
||||
if san == 'Address':
|
||||
self.compile_flags += ['-fsanitize=address']
|
||||
if llvm_symbolizer is not None:
|
||||
self.env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer
|
||||
self.config.available_features.add('asan')
|
||||
elif san == 'Memory' or san == 'MemoryWithOrigins':
|
||||
self.compile_flags += ['-fsanitize=memory']
|
||||
if san == 'MemoryWithOrigins':
|
||||
self.compile_flags += ['-fsanitize-memory-track-origins']
|
||||
if llvm_symbolizer is not None:
|
||||
self.env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer
|
||||
self.config.available_features.add('msan')
|
||||
elif san == 'Undefined':
|
||||
self.compile_flags += ['-fsanitize=undefined',
|
||||
|
Loading…
x
Reference in New Issue
Block a user