Index: test/tools/lto/lit.local.cfg =================================================================== --- test/tools/lto/lit.local.cfg +++ test/tools/lto/lit.local.cfg @@ -1,2 +1,6 @@ if not ('ld64_plugin' in config.available_features and 'X86' in config.root.targets): - config.unsupported = True + config.unsupported = True + +# These tests invoke ld64 from the system, which is not leak-free +if "Address" in config.llvm_use_sanitizer: + config.environment['ASAN_OPTIONS'] = 'detect_leaks=0' Index: utils/lit/lit/llvm/config.py =================================================================== --- utils/lit/lit/llvm/config.py +++ utils/lit/lit/llvm/config.py @@ -60,6 +60,9 @@ target_triple = getattr(config, 'target_triple', None) if target_triple: + if re.match(r'^x86_64.*-apple', target_triple): + if 'address' in sanitizers: + self.with_environment('ASAN_OPTIONS', 'detect_leaks=1', append_path=True) if re.match(r'^x86_64.*-linux', target_triple): features.add("x86_64-linux") if re.match(r'.*-win32$', target_triple):