Skip to content

Commit 7d4332a

Browse files
[Darwin][Test][leaks] Disable leak detection for asan tests on non-Intel Darwin devices (#131676)
`detect_leaks` option for asan does not work well on Apple Silicon (arm64) MacOS devices and results in hundreds of ASan test failures when run with this option set for all tests. We should not add this option for tests unless we are targeting an x86_64 device for Darwin, where this seems to be tested and working well. rdar://147069153
1 parent a21dd25 commit 7d4332a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

compiler-rt/test/asan/lit.cfg.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ def get_required_attr(config, attr_name):
2525
default_asan_opts = list(config.default_sanitizer_opts)
2626

2727
# On Darwin, leak checking is not enabled by default. Enable on macOS
28-
# tests to prevent regressions
29-
if config.host_os == "Darwin" and config.apple_platform == "osx":
28+
# tests to prevent regressions.
29+
# Currently, detect_leaks for asan tests only work on Intel MacOS.
30+
if (
31+
config.host_os == "Darwin"
32+
and config.apple_platform == "osx"
33+
and config.target_arch == "x86_64"
34+
):
3035
default_asan_opts += ["detect_leaks=1"]
3136

3237
default_asan_opts_str = ":".join(default_asan_opts)
@@ -273,7 +278,11 @@ def build_invocation(compile_flags, with_lto=False):
273278
and (not config.android)
274279
and (config.target_arch in ["x86_64", "i386", "riscv64", "loongarch64"])
275280
)
276-
leak_detection_mac = (config.host_os == "Darwin") and (config.apple_platform == "osx")
281+
leak_detection_mac = (
282+
(config.host_os == "Darwin")
283+
and (config.apple_platform == "osx")
284+
and (config.target_arch == "x86_64")
285+
)
277286
leak_detection_netbsd = (config.host_os == "NetBSD") and (
278287
config.target_arch in ["x86_64", "i386"]
279288
)

0 commit comments

Comments
 (0)