Skip to content

Commit 3ac5ed8

Browse files
committed
[Darwin][Test][leaks] Disable leak detection for asan tests on non-intel darwin devices
It seems the asan detect_leaks option does not work well on Apple Silicon (arm64) MacOS devices. We should not add this option unless we are targeting an x86_64 device, where this seems to be tested and working well. rdar://147069153
1 parent 3959bbc commit 3ac5ed8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ 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 (config.host_os == "Darwin" and config.apple_platform == "osx"
31+
and config.target_arch == "x86_64"):
3032
default_asan_opts += ["detect_leaks=1"]
3133

3234
default_asan_opts_str = ":".join(default_asan_opts)
@@ -273,7 +275,9 @@ def build_invocation(compile_flags, with_lto=False):
273275
and (not config.android)
274276
and (config.target_arch in ["x86_64", "i386", "riscv64", "loongarch64"])
275277
)
276-
leak_detection_mac = (config.host_os == "Darwin") and (config.apple_platform == "osx")
278+
leak_detection_mac = (config.host_os == "Darwin") and (config.apple_platform == "osx") and (
279+
config.target_arch == "x86_64"
280+
)
277281
leak_detection_netbsd = (config.host_os == "NetBSD") and (
278282
config.target_arch in ["x86_64", "i386"]
279283
)

0 commit comments

Comments
 (0)