[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
This commit is contained in:
Jonas Devlieghere 2023-08-07 11:26:28 -07:00
parent b98d0b2e4c
commit 17226c976e
No known key found for this signature in database
GPG Key ID: 49CC0BD90FDEED4D
3 changed files with 9 additions and 0 deletions

View File

@ -123,6 +123,7 @@ if is_configured("llvm_use_sanitizer"):
)
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"

View File

@ -48,6 +48,10 @@ llvm_config.with_system_environment(
]
)
# 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.

View File

@ -34,5 +34,9 @@ llvm_config.with_system_environment(
)
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")