CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
70 lines
2.5 KiB
Python
70 lines
2.5 KiB
Python
# Copyright Advanced Micro Devices, Inc.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
"""Sanity checks for the PyTorch skip-test definition files.
|
|
|
|
Each ``generic.py`` / ``pytorch_<version>.py`` file in this directory must
|
|
define a ``skip_tests`` dict in the shape that ``create_skip_tests.py``
|
|
consumes: ``section -> pytorch_test_module -> iterable[str]``. These tests guard
|
|
against typos and structural mistakes when a new version skip list (e.g.
|
|
``pytorch_2.13.py``) is added.
|
|
"""
|
|
|
|
import importlib.util
|
|
from pathlib import Path
|
|
|
|
SKIP_DIR = Path(__file__).parent
|
|
|
|
|
|
def _skip_list_files():
|
|
files = sorted(SKIP_DIR.glob("pytorch_*.py"))
|
|
generic = SKIP_DIR / "generic.py"
|
|
if generic.exists():
|
|
files.append(generic)
|
|
return [f for f in files if f.name != "create_skip_tests.py"]
|
|
|
|
|
|
def _load_skip_tests(path):
|
|
spec = importlib.util.spec_from_file_location(path.stem, path)
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return getattr(module, "skip_tests", None)
|
|
|
|
|
|
def test_skip_files_define_skip_tests_dict():
|
|
files = _skip_list_files()
|
|
assert files, "expected at least one skip-list file"
|
|
for path in files:
|
|
skip_tests = _load_skip_tests(path)
|
|
assert isinstance(skip_tests, dict), f"{path.name}: skip_tests must be a dict"
|
|
assert skip_tests, f"{path.name}: skip_tests must not be empty"
|
|
|
|
|
|
def test_skip_tests_entries_are_well_formed():
|
|
for path in _skip_list_files():
|
|
skip_tests = _load_skip_tests(path)
|
|
for section, modules in skip_tests.items():
|
|
assert isinstance(
|
|
section, str
|
|
), f"{path.name}: section {section!r} not a str"
|
|
assert isinstance(
|
|
modules, dict
|
|
), f"{path.name}:{section} must map to a dict"
|
|
for module_name, tests in modules.items():
|
|
assert isinstance(
|
|
module_name, str
|
|
), f"{path.name}:{section} module {module_name!r} not a str"
|
|
assert isinstance(
|
|
tests, (list, set, tuple)
|
|
), f"{path.name}:{section}.{module_name} must be a collection"
|
|
for name in tests:
|
|
assert (
|
|
isinstance(name, str) and name
|
|
), f"{path.name}:{section}.{module_name} bad entry {name!r}"
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_skip_files_define_skip_tests_dict()
|
|
test_skip_tests_entries_are_well_formed()
|
|
print("All skip-test sanity checks passed.")
|