[compiler-rt] 2e25926 - [compiler-rt] Only query llvm-config in the orc tests
via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 6 22:16:34 PST 2024
Author: Alexander Richardson
Date: 2024-03-06T22:16:30-08:00
New Revision: 2e25926b50183cb3d819e85ef7bdf00001027859
URL: https://github.com/llvm/llvm-project/commit/2e25926b50183cb3d819e85ef7bdf00001027859
DIFF: https://github.com/llvm/llvm-project/commit/2e25926b50183cb3d819e85ef7bdf00001027859.diff
LOG: [compiler-rt] Only query llvm-config in the orc tests
This check for assertions is only used inside the test/orc directory, but
doing it in the top level lit config means all testsuites depend on
llvm-config being present. This is not necessarily needed e.g. when
testing just the builtins. While touching this code, simplify it a bit
by using subprocess.check_output() instead of Popen() and use a string
comparison instead of a regex match.
Reviewed By: lhames
Pull Request: https://github.com/llvm/llvm-project/pull/83705
Added:
Modified:
compiler-rt/test/lit.common.cfg.py
compiler-rt/test/orc/lit.cfg.py
Removed:
################################################################################
diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index 113777b0ea8a19..ae28681915afb3 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 bd031d79826d3a..897cefb3d1930d 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}")
More information about the llvm-commits
mailing list