Files
TheRock/rocm-libraries/.github/scripts/tests/therock_matrix_test.py
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

74 lines
2.8 KiB
Python

import copy
from pathlib import Path
import os
import sys
import unittest
sys.path.insert(0, os.fspath(Path(__file__).parent.parent))
import therock_matrix
class TheRockMatrixTest(unittest.TestCase):
def test_collect_projects_to_run_without_additional_option(self):
subtrees = ["projects/hipblaslt"]
project_to_run = therock_matrix.collect_projects_to_run(subtrees)
self.assertEqual(len(project_to_run), 1)
blas_entry = project_to_run[0]
self.assertIn(
"hipsparselt",
blas_entry["projects_to_test"].split(","),
)
def test_collect_projects_to_run(self):
subtrees = ["projects/rocsparse", "projects/hipblaslt"]
project_to_run = therock_matrix.collect_projects_to_run(subtrees)
self.assertEqual(len(project_to_run), 1)
def test_collect_projects_to_run_additional_option(self):
subtrees = ["projects/rocsparse"]
project_to_run = therock_matrix.collect_projects_to_run(subtrees)
self.assertEqual(len(project_to_run), 1)
def test_collect_projects_to_run_dependency_graph(self):
subtrees = ["projects/miopen", "projects/hipblaslt"]
project_to_run = therock_matrix.collect_projects_to_run(subtrees)
self.assertEqual(len(project_to_run), 1)
def test_collect_projects_to_run_dependency_graph_diff_projects(self):
subtrees = ["projects/miopen", "projects/rocwmma"]
project_to_run = therock_matrix.collect_projects_to_run(subtrees)
# rocwmma only contributes via blas under additional_options; miopen absorbs blas.
self.assertEqual(len(project_to_run), 1)
combined = project_to_run[0]
self.assertIn("rocwmma", combined["projects_to_test"].split(","))
self.assertIn("miopen", combined["projects_to_test"].split(","))
def test_collect_projects_to_run_does_not_mutate_module_state(self):
# Snapshot module-level dicts, run a series of representative calls, and
# confirm the originals are untouched. This guards against the
# mutate-globals regression that previously required importlib.reload
# between tests.
project_map_before = copy.deepcopy(therock_matrix.project_map)
additional_options_before = copy.deepcopy(therock_matrix.additional_options)
therock_matrix.collect_projects_to_run(["projects/hipblaslt"])
therock_matrix.collect_projects_to_run(
["projects/rocsparse", "projects/hipblaslt"]
)
therock_matrix.collect_projects_to_run(
["projects/miopen", "projects/hipblaslt"]
)
therock_matrix.collect_projects_to_run(["projects/miopen", "projects/rocwmma"])
self.assertEqual(therock_matrix.project_map, project_map_before)
self.assertEqual(therock_matrix.additional_options, additional_options_before)
if __name__ == "__main__":
unittest.main()