[Lldb-commits] [lldb] 17226c9 - [lldb] Make TSan errors fatal when running the test suite

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 7 13:20:45 PDT 2023


Author: Jonas Devlieghere
Date: 2023-08-07T13:20:38-07:00
New Revision: 17226c976e04856b10e2da34e93c89596660f882

URL: https://github.com/llvm/llvm-project/commit/17226c976e04856b10e2da34e93c89596660f882
DIFF: https://github.com/llvm/llvm-project/commit/17226c976e04856b10e2da34e93c89596660f882.diff

LOG: [lldb] Make TSan errors fatal when running the test suite

Set the halt_on_error runtime flag to make TSan errors fatal when
running the test suite. For the API tests the environment variables are
set conditionally on whether the TSan is enabled. The Shell and Unit
tests don't have that logic but setting the environment variable is
harmless. For consistency, I've also mirrored the ASAN option
(detect_stack_use_after_return=1) for the Shell tests.

Differential revision: https://reviews.llvm.org/D157152

Added: 
    

Modified: 
    lldb/test/API/lit.cfg.py
    lldb/test/Shell/lit.cfg.py
    lldb/test/Unit/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 167ab3004c4066..c306c5b3c0ec0c 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -123,6 +123,7 @@ def delete_module_cache(path):
             )
 
     if "Thread" in config.llvm_use_sanitizer:
+        config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
         if "Darwin" in config.host_os:
             config.environment["DYLD_INSERT_LIBRARIES"] = find_sanitizer_runtime(
                 "libclang_rt.tsan_osx_dynamic.dylib"

diff  --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index fdf5cf9bfd69a7..d75c1f532e147f 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -48,6 +48,10 @@
     ]
 )
 
+# Enable sanitizer runtime flags.
+config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
+config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
+
 # Support running the test suite under the lldb-repro wrapper. This makes it
 # possible to capture a test suite run and then rerun all the test from the
 # just captured reproducer.

diff  --git a/lldb/test/Unit/lit.cfg.py b/lldb/test/Unit/lit.cfg.py
index 4d38b0088bc3b1..1dda6569a7b3cc 100644
--- a/lldb/test/Unit/lit.cfg.py
+++ b/lldb/test/Unit/lit.cfg.py
@@ -34,5 +34,9 @@
 )
 llvm_config.with_environment("PATH", os.path.dirname(sys.executable), append_path=True)
 
+# Enable sanitizer runtime flags.
+config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
+config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
+
 # testFormat: The test format to use to interpret tests.
 config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests")


        


More information about the lldb-commits mailing list