[CI] Fix test suite names and add suite validation (#21937)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user