Skip to content

Commit 17226c9

Browse files
committed
[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
1 parent b98d0b2 commit 17226c9

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

lldb/test/API/lit.cfg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def delete_module_cache(path):
123123
)
124124

125125
if "Thread" in config.llvm_use_sanitizer:
126+
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
126127
if "Darwin" in config.host_os:
127128
config.environment["DYLD_INSERT_LIBRARIES"] = find_sanitizer_runtime(
128129
"libclang_rt.tsan_osx_dynamic.dylib"

lldb/test/Shell/lit.cfg.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@
4848
]
4949
)
5050

51+
# Enable sanitizer runtime flags.
52+
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
53+
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
54+
5155
# Support running the test suite under the lldb-repro wrapper. This makes it
5256
# possible to capture a test suite run and then rerun all the test from the
5357
# just captured reproducer.

lldb/test/Unit/lit.cfg.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,9 @@
3434
)
3535
llvm_config.with_environment("PATH", os.path.dirname(sys.executable), append_path=True)
3636

37+
# Enable sanitizer runtime flags.
38+
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
39+
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
40+
3741
# testFormat: The test format to use to interpret tests.
3842
config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests")

0 commit comments

Comments
 (0)