[Lldb-commits] [PATCH] D50997: Automatically set path to sanitizer runtime when running tests on macOS.

Phabricator via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 20 15:01:20 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB340218: Set path to sanitizer runtime when running tests through LIT on macOS. (authored by adrian, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D50997?vs=161566&id=161575#toc

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D50997

Files:
  lit/Suite/lit.cfg
  lit/Suite/lit.site.cfg.in


Index: lit/Suite/lit.site.cfg.in
===================================================================
--- lit/Suite/lit.site.cfg.in
+++ lit/Suite/lit.site.cfg.in
@@ -9,6 +9,10 @@
 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"
Index: lit/Suite/lit.cfg
===================================================================
--- lit/Suite/lit.cfg
+++ lit/Suite/lit.cfg
@@ -19,6 +19,19 @@
                                        '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(';'))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50997.161575.patch
Type: text/x-patch
Size: 1639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180820/2a61e19d/attachment-0001.bin>


More information about the lldb-commits mailing list