[runtimes] Aggregate per-target runtime checks in top-level check-${runtime_name} (#191743)

When a per-target runtime build exports a
check-${runtime_name}-${target} proxy, make the top-level
check-${runtime_name} target depend on it, creating
check-${runtime_name} on demand (it may not exist).

This applies regardless of whether the runtime comes from the default
LLVM_ENABLE_RUNTIMES set or from a target-specific
RUNTIMES_<target>_LLVM_ENABLE_RUNTIMES override.

This allows a single `check-${runtime_name}` command to trigger all
per-target tests for that runtime.
This commit is contained in:
Wenju He
2026-04-15 08:45:04 +08:00
committed by GitHub
parent 348061d58d
commit 18f63d1375
6 changed files with 30 additions and 10 deletions

View File

@@ -153,7 +153,7 @@ PROJECT_CHECK_TARGETS = {
"flang": "check-flang",
"flang-rt": "check-flang-rt",
"libc": "check-libc",
"libclc": "check-libclc-amdgcn-amd-amdhsa-llvm",
"libclc": "check-libclc",
"lld": "check-lld",
"lldb": "check-lldb",
"mlir": "check-mlir",

View File

@@ -268,7 +268,7 @@ class TestComputeProjects(unittest.TestCase):
self.assertEqual(env_variables["runtimes_to_build"], "")
self.assertEqual(
env_variables["runtimes_check_targets"],
"check-libclc-amdgcn-amd-amdhsa-llvm",
"check-libclc",
)
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
@@ -310,7 +310,7 @@ class TestComputeProjects(unittest.TestCase):
)
self.assertEqual(
env_variables["runtimes_check_targets"],
"check-compiler-rt check-flang-rt check-libc check-libclc-amdgcn-amd-amdhsa-llvm",
"check-compiler-rt check-flang-rt check-libc check-libclc",
)
self.assertEqual(
env_variables["runtimes_check_targets_needs_reconfig"],
@@ -335,7 +335,7 @@ class TestComputeProjects(unittest.TestCase):
)
self.assertEqual(
env_variables["runtimes_check_targets"],
"check-compiler-rt check-libclc-amdgcn-amd-amdhsa-llvm",
"check-compiler-rt check-libclc",
)
self.assertEqual(
env_variables["runtimes_check_targets_needs_reconfig"],
@@ -384,7 +384,7 @@ class TestComputeProjects(unittest.TestCase):
)
self.assertEqual(
env_variables["runtimes_check_targets"],
"check-compiler-rt check-flang-rt check-libc check-libclc-amdgcn-amd-amdhsa-llvm",
"check-compiler-rt check-flang-rt check-libc check-libclc",
)
self.assertEqual(
env_variables["runtimes_check_targets_needs_reconfig"],
@@ -419,7 +419,7 @@ class TestComputeProjects(unittest.TestCase):
)
self.assertEqual(
env_variables["runtimes_check_targets"],
"check-compiler-rt check-flang-rt check-libc check-libclc-amdgcn-amd-amdhsa-llvm",
"check-compiler-rt check-flang-rt check-libc check-libclc",
)
self.assertEqual(
env_variables["runtimes_check_targets_needs_reconfig"],

View File

@@ -32,7 +32,7 @@ enable_cir="${6}"
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests --succinct"
runtime_cmake_args=()
if [[ " ${runtime_targets} " == *" check-libclc-amdgcn-amd-amdhsa-llvm "* ]]; then
if [[ " ${runtime_targets} " == *" check-libclc "* ]]; then
runtime_cmake_args+=(
-D RUNTIMES_amdgcn-amd-amdhsa-llvm_LLVM_ENABLE_RUNTIMES=libclc
-D LLVM_RUNTIME_TARGETS="default;amdgcn-amd-amdhsa-llvm"

View File

@@ -21,7 +21,7 @@ runtimes="${3}"
runtimes_targets="${4}"
runtime_cmake_args=()
if [[ " ${runtimes_targets} " == *" check-libclc-amdgcn-amd-amdhsa-llvm "* ]]; then
if [[ " ${runtimes_targets} " == *" check-libclc "* ]]; then
runtime_cmake_args+=(
-D RUNTIMES_amdgcn-amd-amdhsa-llvm_LLVM_ENABLE_RUNTIMES=libclc
-D LLVM_RUNTIME_TARGETS="default;amdgcn-amd-amdhsa-llvm"

View File

@@ -85,11 +85,22 @@ Note you can use the `DESTDIR` Makefile variable to do staged installs.
DESTDIR=/path/for/staged/install ninja install
```
## Run tests
## Testing
libclc utilizes the LLVM testing infrastructure.
#### Run all tests
To execute all per-target tests for libclc.
```
ninja check-libclc
```
`check-libclc` is a top-level target that aggregates all per-target tests.
#### Run target-specific tests
If you are working on a specific target, you can run tests for just that target triple:
```
ninja check-libclc-<target-triple>
```
or
Alternatively, you can run target-specific tests via the runtimes build by
pointing to the target-specific build directory:
```
ninja -C runtimes/runtimes-<target-triple>-bins check-libclc
```

View File

@@ -462,6 +462,15 @@ function(runtime_register_target name)
if(TARGET builtins-${name})
add_dependencies(check-builtins check-builtins-${name})
endif()
foreach(runtime_name ${runtime_names})
if(TARGET check-${runtime_name}-${name})
if(NOT TARGET check-${runtime_name})
add_custom_target(check-${runtime_name})
endif()
add_dependencies(check-${runtime_name} check-${runtime_name}-${name})
endif()
endforeach()
endif()
foreach(runtime_name ${runtime_names})
if(NOT TARGET ${runtime_name})