[CI] Fix test suite names and add suite validation (#21937)

This commit is contained in:
Ke Bao
2026-04-03 23:47:17 +08:00
committed by GitHub
parent 44e5d35703
commit 47f4fd275a
20 changed files with 341 additions and 24 deletions
+42
View File
@@ -114,6 +114,47 @@ NIGHTLY_SUITES = {
}
OTHER_SUITES = {
HWBackend.CPU: [
"default",
],
HWBackend.CUDA: [
"stress",
"weekly-8-gpu-h200",
],
}
_SUITE_CHECKED_BACKENDS = {HWBackend.CUDA, HWBackend.CPU}
def _valid_suites_by_backend() -> dict:
"""Build a mapping from backend to its set of valid suite names."""
result = {}
for suite_dict in (PER_COMMIT_SUITES, NIGHTLY_SUITES, OTHER_SUITES):
for backend, suites in suite_dict.items():
if backend not in result:
result[backend] = set()
result[backend].update(suites)
return result
def validate_all_suites(all_tests: List[CIRegistry]):
"""Fail fast if any test is registered to a suite that doesn't belong to its backend."""
valid_by_backend = _valid_suites_by_backend()
errors = []
for t in all_tests:
if t.backend not in _SUITE_CHECKED_BACKENDS:
continue
valid = valid_by_backend.get(t.backend, set())
if t.suite not in valid:
errors.append(
f" {t.filename}: backend={t.backend.name}, suite='{t.suite}'"
)
if errors:
raise ValueError("Tests registered to invalid suites:\n" + "\n".join(errors))
def filter_tests(
ci_tests: List[CIRegistry], hw: HWBackend, suite: str, nightly: bool = False
) -> List[CIRegistry]:
@@ -210,6 +251,7 @@ def run_a_suite(args):
sanity_check = True
all_tests = collect_tests(files, sanity_check=sanity_check)
validate_all_suites(all_tests)
ci_tests, skipped_tests = filter_tests(all_tests, hw, suite, nightly)
if auto_partition_size: