Files
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

104 lines
3.0 KiB
Python

# Copyright Advanced Micro Devices, Inc., or its affiliates.
# SPDX-License-Identifier: MIT
"""
Unit tests for test discovery functions.
These tests verify that we can discover tests from executables
and parse their output correctly.
"""
from pathlib import Path
import pytest
from rrtest.core import (
discover_catch2_tests,
discover_ctest_tests,
discover_gtest_tests,
)
@pytest.fixture
def build_dir():
"""Fixture to provide build directory."""
import os
if "ROCROLLER_BUILD_DIR" in os.environ:
return Path(os.environ["ROCROLLER_BUILD_DIR"])
return Path("build")
def test_discover_gtest_tests_no_filters(build_dir):
"""Test discovering GTest tests without any filters."""
executable = "test/rocroller-tests"
tests = discover_gtest_tests(executable, build_dir=build_dir)
assert isinstance(tests, set), "discover_gtest_tests should return a set"
assert len(tests) > 0, "Should discover GTest tests"
for test in tests:
assert test.framework == "gtest", f"Test {test.name} should be gtest framework"
def test_discover_gtest_tests_with_excludes(build_dir):
"""Test discovering GTest tests with exclude filters."""
executable = "test/rocroller-tests"
all_tests = discover_gtest_tests(executable, build_dir=build_dir)
filtered_tests = discover_gtest_tests(
executable, include=[], exclude=["*GPU*"], build_dir=build_dir
)
assert len(filtered_tests) < len(
all_tests
), "Filtered tests should be fewer than all tests"
for test in filtered_tests:
assert "GPU" not in test.name, f"Test {test.name} should not contain 'GPU'"
def test_discover_catch2_tests_no_filters(build_dir):
"""Test discovering Catch2 tests without any filters."""
executable = "test/rocroller-tests-catch"
tests = discover_catch2_tests(executable, build_dir=build_dir)
assert isinstance(tests, set), "discover_catch2_tests should return a set"
assert len(tests) > 0, "Should discover Catch2 tests"
for test in tests:
assert (
test.framework == "catch2"
), f"Test {test.name} should be catch2 framework"
def test_discover_catch2_tests_with_filters(build_dir):
"""Test discovering Catch2 tests with filters."""
executable = "test/rocroller-tests-catch"
all_tests = discover_catch2_tests(executable, build_dir=build_dir)
filtered_tests = discover_catch2_tests(
executable, include=["[kernel-graph]"], exclude=[], build_dir=build_dir
)
assert len(filtered_tests) <= len(
all_tests
), "Filtered tests should be <= all tests"
def test_discover_ctest_tests_no_filters(build_dir):
"""Test discovering CTest tests without any filters."""
executable = "ctest"
tests = discover_ctest_tests(executable, build_dir=build_dir)
assert isinstance(tests, set), "discover_ctest_tests should return a set"
assert len(tests) > 0, "Should discover CTest tests"
for test in tests:
assert test.framework == "ctest", f"Test {test.name} should be ctest framework"