aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Kirth <paulkirth@google.com>2024-04-26 00:37:04 +0200
committerGitHub <noreply@github.com>2024-04-25 15:37:04 -0700
commiteb4a510283bdbf1e6f0b47a9e20ea88b775c5a85 (patch)
tree449c0cd0ddce63c836a4679c26277960d453f175
parent6473fbf2d68c8486d168f29afc35d3e8a6fabe69 (diff)
downloadllvm-eb4a510283bdbf1e6f0b47a9e20ea88b775c5a85.tar.gz
llvm-eb4a510283bdbf1e6f0b47a9e20ea88b775c5a85.tar.bz2
llvm-eb4a510283bdbf1e6f0b47a9e20ea88b775c5a85.zip
[compiler-rt] Avoid assertions when using LLVM_ENABLE_PER_TARGET_RUNTIME_DIR (#90127)
Previously, the memprof and ctx_profile lit.site.cfg would assert if the enable_per_target_runtime_dir was set and the config.target_arch != config.host_arch. However, config.host_arch would never be set, meaning this would always fail in a when using LLVM_ENABLE_PER_TARGET_RUNTIME_DIR. This patch follows the example in the ASAN lit.site.cfg.py that updates the compiler_rt_libdir appropriately.
-rw-r--r--compiler-rt/test/ctx_profile/Unit/lit.site.cfg.py.in5
-rw-r--r--compiler-rt/test/memprof/Unit/lit.site.cfg.py.in9
2 files changed, 8 insertions, 6 deletions
diff --git a/compiler-rt/test/ctx_profile/Unit/lit.site.cfg.py.in b/compiler-rt/test/ctx_profile/Unit/lit.site.cfg.py.in
index 32a8c48e9c1c..3fa9a7a2780e 100644
--- a/compiler-rt/test/ctx_profile/Unit/lit.site.cfg.py.in
+++ b/compiler-rt/test/ctx_profile/Unit/lit.site.cfg.py.in
@@ -23,5 +23,6 @@ config.test_source_root = config.test_exec_root
# host triple as the trailing path component. The value is incorrect for i386
# tests on x86_64 hosts and vice versa. But, since only x86_64 is enabled as
# target, and we don't support different environments for building and,
-# respectivelly, running tests, we shouldn't see this case.
-assert not config.enable_per_target_runtime_dir or config.target_arch == config.host_arch
+# respectively, running tests, we we only need to fix up the x86_64 case.
+if config.enable_per_target_runtime_dir and config.target_arch != config.host_arch:
+ config.compiler_rt_libdir = re.sub(r'/i386(?=-[^/]+$)', '/x86_64', config.compiler_rt_libdir)
diff --git a/compiler-rt/test/memprof/Unit/lit.site.cfg.py.in b/compiler-rt/test/memprof/Unit/lit.site.cfg.py.in
index c968e403a44d..1e2442a1487a 100644
--- a/compiler-rt/test/memprof/Unit/lit.site.cfg.py.in
+++ b/compiler-rt/test/memprof/Unit/lit.site.cfg.py.in
@@ -21,10 +21,11 @@ config.test_source_root = config.test_exec_root
# When LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on, the initial value of
# config.compiler_rt_libdir (COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR) has the
# host triple as the trailing path component. The value is incorrect for i386
-# tests on x86_64 hosts and vice versa. But, since only x86_64 is enabled as
+# tests on x86_64 hosts and vice versa. But, since only x86_64 is enabled as
# target, and we don't support different environments for building and,
-# respectivelly, running tests, we shouldn't see this case.
-assert not config.enable_per_target_runtime_dir or config.target_arch == config.host_arch
+# respectively, running tests, we we only need to fix up the x86_64 case.
+if config.enable_per_target_runtime_dir and config.target_arch != config.host_arch:
+ config.compiler_rt_libdir = re.sub(r'/i386(?=-[^/]+$)', '/x86_64', config.compiler_rt_libdir)
if not config.parallelism_group:
- config.parallelism_group = 'shadow-memory' \ No newline at end of file
+ config.parallelism_group = 'shadow-memory'