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
86 lines
2.3 KiB
Python
Executable File
86 lines
2.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
# Copyright Advanced Micro Devices, Inc., or its affiliates.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
"""
|
|
Prints every `.cpp` file in `tests_dir` that is not mentioned in CMakeLists.txt.
|
|
Then returns the number of missing file paths.
|
|
|
|
Usage:
|
|
scripts/check_included_tests.py -t test/
|
|
"""
|
|
|
|
import argparse
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def check_included_tests(
|
|
tests_dir: str,
|
|
exclude_paths: list[str],
|
|
) -> int:
|
|
tests_dir = Path(tests_dir)
|
|
assert tests_dir.is_dir()
|
|
|
|
def should_exclude(test_path: Path, exclude_paths: list[str]):
|
|
for exclude_path in exclude_paths:
|
|
if test_path.is_relative_to(Path(exclude_path)):
|
|
return True
|
|
return False
|
|
|
|
def missing_tests(cmakelist_path):
|
|
assert cmakelist_path.is_file()
|
|
missingTestCount = 0
|
|
for subpath in tests_in_dir:
|
|
relative_subpath = subpath.resolve().relative_to(
|
|
cmakelist_path.joinpath("..").resolve()
|
|
)
|
|
|
|
if str(relative_subpath) not in cmakelist_path.read_text():
|
|
missingTestCount += 1
|
|
print("Paths not found:", relative_subpath)
|
|
return missingTestCount
|
|
|
|
test_dirs = [
|
|
Path(d)
|
|
for d in tests_dir.iterdir()
|
|
if d.is_dir() and not should_exclude(d, exclude_paths)
|
|
]
|
|
missingTestCount = 0
|
|
test_count = 0
|
|
for test_dir in test_dirs:
|
|
tests_in_dir = {x for x in test_dir.glob("**/*.cpp")}
|
|
test_count += len(tests_in_dir)
|
|
missingTestCount += missing_tests(test_dir / "CMakeLists.txt")
|
|
|
|
print("Checked %i paths, found %i missing paths" % (test_count, missingTestCount))
|
|
return missingTestCount
|
|
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(
|
|
description="Prints every `.cpp` file in `tests_dir` that is not mentioned in `cmakelist_path`"
|
|
)
|
|
parser.add_argument(
|
|
"-t",
|
|
"--test-dir",
|
|
default="../test/",
|
|
help="Directory to tests",
|
|
)
|
|
parser.add_argument(
|
|
"-x",
|
|
"--exclude-path",
|
|
action="append",
|
|
default=["../test/common"],
|
|
help="Paths to exclude",
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
sys.exit(
|
|
check_included_tests(
|
|
args.test_dir,
|
|
args.exclude_path,
|
|
)
|
|
)
|