diff options
author | Eric Fiselier <eric@efcs.ca> | 2014-11-21 02:16:19 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2014-11-21 02:16:19 +0000 |
commit | 5c2465832874484b13afe9d1aa937d084142e7c1 (patch) | |
tree | d9ed45f9180c24dbe522719a586c229e729ae0de /libcxxabi | |
parent | 7f013bcd60f500cb58d400f7a4ced9496fbebfff (diff) | |
download | llvm-5c2465832874484b13afe9d1aa937d084142e7c1.zip llvm-5c2465832874484b13afe9d1aa937d084142e7c1.tar.gz llvm-5c2465832874484b13afe9d1aa937d084142e7c1.tar.bz2 |
Ensure llvm-sanitizer is found by the tests when using sanitizers.
llvm-svn: 222496
Diffstat (limited to 'libcxxabi')
-rw-r--r-- | libcxxabi/test/lit.cfg | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libcxxabi/test/lit.cfg b/libcxxabi/test/lit.cfg index 4f87bf0..490796b 100644 --- a/libcxxabi/test/lit.cfg +++ b/libcxxabi/test/lit.cfg @@ -203,7 +203,15 @@ llvm_unwinder = getattr(config, 'llvm_unwinder', None) if llvm_unwinder is None: lit_config.fatal("llvm_unwinder must be defined") + +# Compiler parameters +include_paths = ['-I' + libcxxabi_src_root + '/include', + '-I' + libcxx_includes] +library_paths = ['-L' + libcxxabi_obj_root + '/lib'] +compile_flags = ['-std=c++11'] link_flags = [] +exec_env = {} + link_flags_str = lit_config.params.get('link_flags', None) if link_flags_str is None: link_flags_str = getattr(config, 'link_flags', None) @@ -228,24 +236,32 @@ if link_flags_str is not None: link_flags += shlex.split(link_flags_str) # Configure extra compiler flags. -include_paths = ['-I' + libcxxabi_src_root + '/include', - '-I' + libcxx_includes] -library_paths = ['-L' + libcxxabi_obj_root + '/lib'] -compile_flags = ['-std=c++11'] - san = lit_config.params.get('llvm_use_sanitizer', None) if san is None: san = getattr(config, 'llvm_use_sanitizer', None) 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(cxx_under_test) + 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) compile_flags += ['-g', '-fno-omit-frame-pointer'] if sys.platform.startswith('linux'): link_flags += ['-ldl'] if san == 'Address': compile_flags += ['-fsanitize=address'] + if llvm_symbolizer is not None: + exec_env['ASAN_SYMBOLIZER_PATH'] = llvm_symbolizer config.available_features.add('asan') elif san == 'Memory' or san == 'MemoryWithOrigins': compile_flags += ['-fsanitize=memory'] + if llvm_symbolizer is not None: + exec_env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer config.available_features.add('msan') if san == 'MemoryWithOrigins': compile_flags += ['-fsanitize-memory-track-origins'] @@ -263,7 +279,7 @@ if san: # Configure extra linker parameters. -exec_env = {} + if sys.platform == 'darwin': exec_env['DYLD_LIBRARY_PATH'] = os.path.join(libcxxabi_obj_root, 'lib') elif sys.platform.startswith('linux'): |