Skip to content

Commit fe48bf6

Browse files
[lldb][lit] Guard MallocNanoZone envvar in shell tests (#88824)
Previously the MallocNanoZone envvar would be set to 0 on Darwin for the LLDB shell tests, but this should guarded behind ASan being enabled as opposed to simply running the test suite behind Darwin. This required that the LLVM_USE_SANITIZER option be added as an attribute to the lit config for shell tests.
1 parent 8ee7d97 commit fe48bf6

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lldb/test/Shell/lit.cfg.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@
5050
)
5151

5252
# Enable sanitizer runtime flags.
53-
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
54-
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
55-
if platform.system() == "Darwin":
56-
config.environment["MallocNanoZone"] = "0"
53+
if "Address" in config.llvm_use_sanitizer:
54+
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
55+
if platform.system() == "Darwin":
56+
config.environment["MallocNanoZone"] = "0"
57+
58+
if "Thread" in config.llvm_use_sanitizer:
59+
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
60+
5761

5862
# Support running the test suite under the lldb-repro wrapper. This makes it
5963
# possible to capture a test suite run and then rerun all the test from the

lldb/test/Shell/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ config.lldb_enable_lua = @LLDB_ENABLE_LUA@
2626
config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
2727
config.have_lldb_server = @LLDB_TOOL_LLDB_SERVER_BUILD@
2828
config.lldb_system_debugserver = @LLDB_USE_SYSTEM_DEBUGSERVER@
29+
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
2930
# The shell tests use their own module caches.
3031
config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-shell")
3132
config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-shell")

0 commit comments

Comments
 (0)