From 44678f40586629d16887285b45b48d9020a0f5d0 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Fri, 14 Nov 2014 02:47:08 +0000 Subject: [PATCH] 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 --- test/lit.cfg | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/lit.cfg b/test/lit.cfg index 26b91b7e..d3c984ae 100644 --- a/test/lit.cfg +++ b/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',