diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py index 113777b0ea8a1..ae28681915afb 100644 --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -738,22 +738,6 @@ def is_windows_lto_supported(): if config.have_rpc_xdr_h: config.available_features.add("sunrpc") -# Ask llvm-config about assertion mode. -try: - llvm_config_cmd = subprocess.Popen( - [os.path.join(config.llvm_tools_dir, "llvm-config"), "--assertion-mode"], - stdout=subprocess.PIPE, - env=config.environment, - ) -except OSError as e: - print("Could not launch llvm-config in " + config.llvm_tools_dir) - print(" Failed with error #{0}: {1}".format(e.errno, e.strerror)) - exit(42) - -if re.search(r"ON", llvm_config_cmd.stdout.read().decode("ascii")): - config.available_features.add("asserts") -llvm_config_cmd.wait() - # Sanitizer tests tend to be flaky on Windows due to PR24554, so add some # retries. We don't do this on otther platforms because it's slower. if platform.system() == "Windows": diff --git a/compiler-rt/test/orc/lit.cfg.py b/compiler-rt/test/orc/lit.cfg.py index bd031d79826d3..897cefb3d1930 100644 --- a/compiler-rt/test/orc/lit.cfg.py +++ b/compiler-rt/test/orc/lit.cfg.py @@ -1,6 +1,7 @@ # -*- Python -*- import os +import subprocess # Setup config name. config.name = "ORC" + config.name_suffix @@ -79,3 +80,14 @@ def build_invocation(compile_flags): if config.host_os not in ["Darwin", "FreeBSD", "Linux", "Windows"]: config.unsupported = True + +# Ask llvm-config about assertion mode. +try: + llvm_config_result = subprocess.check_output( + [os.path.join(config.llvm_tools_dir, "llvm-config"), "--assertion-mode"], + env=config.environment, + ) + if llvm_config_result.startswith(b"ON"): + config.available_features.add("asserts") +except OSError as e: + lit_config.warning(f"Could not determine if LLVM was built with assertions: {e}")