[Lldb-commits] [lldb] r340218 - Set path to sanitizer runtime when running tests through LIT on macOS.

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 20 15:00:32 PDT 2018


Author: adrian
Date: Mon Aug 20 15:00:31 2018
New Revision: 340218

URL: http://llvm.org/viewvc/llvm-project?rev=340218&view=rev
Log:
Set path to sanitizer runtime when running tests through LIT on macOS.

rdar://problem/42984739

Differential Revision: https://reviews.llvm.org/D50997

Modified:
    lldb/trunk/lit/Suite/lit.cfg
    lldb/trunk/lit/Suite/lit.site.cfg.in

Modified: lldb/trunk/lit/Suite/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.cfg?rev=340218&r1=340217&r2=340218&view=diff
==============================================================================
--- lldb/trunk/lit/Suite/lit.cfg (original)
+++ lldb/trunk/lit/Suite/lit.cfg Mon Aug 20 15:00:31 2018
@@ -19,6 +19,19 @@ config.test_source_root = os.path.join(c
                                        'Python', 'lldbsuite', 'test')
 config.test_exec_root = config.test_source_root
 
+# macOS flags needed for LLDB built with address sanitizer.
+if 'Address' in config.llvm_use_sanitizer and \
+   'Darwin' in config.host_os and \
+   'x86' in config.host_triple:
+  import subprocess
+  resource_dir = subprocess.check_output(
+    config.cmake_cxx_compiler +' -print-resource-dir', shell=True).strip()
+  runtime = os.path.join(resource_dir, 'lib', 'darwin',
+                         'libclang_rt.asan_osx_dynamic.dylib')
+  config.environment['ASAN_OPTIONS'] = \
+    'detect_stack_use_after_return=1:container_overflow=0'
+  config.environment['DYLD_INSERT_LIBRARIES'] = runtime
+
 # Build dotest command.
 dotest_cmd = [config.dotest_path, '-q']
 dotest_cmd.extend(config.dotest_args_str.split(';'))

Modified: lldb/trunk/lit/Suite/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.site.cfg.in?rev=340218&r1=340217&r2=340218&view=diff
==============================================================================
--- lldb/trunk/lit/Suite/lit.site.cfg.in (original)
+++ lldb/trunk/lit/Suite/lit.site.cfg.in Mon Aug 20 15:00:31 2018
@@ -9,6 +9,10 @@ config.llvm_build_mode = "@LLVM_BUILD_MO
 config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
 config.lldb_obj_root = "@LLDB_BINARY_DIR@"
 config.lldb_src_root = "@LLDB_SOURCE_DIR@"
+config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
+config.host_os = "@HOST_OS@"
+config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.python_executable = "@PYTHON_EXECUTABLE@"
 config.dotest_path = "@LLDB_SOURCE_DIR@/test/dotest.py"




More information about the lldb-commits mailing list