Skip to content

Commit 96d3d08

Browse files
dileepr1assistant-librarian[bot]
authored andcommitted
[rocm-libraries] ROCm/rocm-libraries#7215 (commit 955d3a8)
Add test filter standardization to rocthrust ## Motivation Add test filter standardization to rocthrust. The goal is to categorize tests at the component level, enabling TheRock CI to invoke a common test_runner with specified categories to run the appropriate tests. More details available at [test_filtering.md](https://github.com/ROCm/TheRock/blob/main/docs/development/test_filtering.md). ## Technical Details These following are the changes made in rocm-libs: Add test_categories.yaml in rocthrust. Update CMakeLists.txt to call the parser script parse_ctest_categories.py to add test category labels. This adds additional ctest entries with with corresponding category labels which can be used as in test plan. ## Test Plan Confirm that ctest commands and tests work good. ctest --print-labels to see the labels added ctest -L quick to run the quick tests ## Test Result Test run: https://github.com/ROCm/rocm-libraries/actions/runs/25927754134/job/76259007137?pr=7215 ## Submission Checklist - [ ] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
1 parent f6a0adb commit 96d3d08

3 files changed

Lines changed: 142 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ set(CMAKE_HIP_STANDARD 17)
4646
set(CMAKE_HIP_STANDARD_REQUIRED ON)
4747
set(CMAKE_HIP_EXTENSIONS OFF)
4848

49+
if(NOT DEFINED ROCM_LIBRARIES_ROOT)
50+
set(ROCM_LIBRARIES_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../..")
51+
endif()
52+
4953
include(CheckLanguage)
5054
include(CMakeDependentOption)
5155

test/CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ function(add_rocthrust_test TEST)
9696
PROPERTIES
9797
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/test/"
9898
)
99+
100+
# Track test target globally for category labels
101+
set_property(GLOBAL APPEND PROPERTY ROCTHRUST_TEST_TARGETS ${TEST_TARGET})
102+
99103
if(AMDGPU_TEST_TARGETS)
100104
foreach(AMDGPU_TARGET IN LISTS AMDGPU_TEST_TARGETS)
101105
add_test("${AMDGPU_TARGET}-${TEST_TARGET}" ${TEST_TARGET})
@@ -340,6 +344,30 @@ if(BUILD_HIPSTDPAR_TEST)
340344
endif()
341345
endif()
342346

347+
# ****************************************************************************
348+
# Test Filter Standardization
349+
# ****************************************************************************
350+
351+
if(EXISTS "${ROCM_LIBRARIES_ROOT}/shared/ctest/TestCategories.cmake")
352+
include("${ROCM_LIBRARIES_ROOT}/shared/ctest/TestCategories.cmake")
353+
354+
message(STATUS "Applying test categories for rocthrust")
355+
get_property(_rt_test_targets GLOBAL PROPERTY ROCTHRUST_TEST_TARGETS)
356+
foreach(_rt_t IN LISTS _rt_test_targets)
357+
get_target_property(_rt_dir ${_rt_t} RUNTIME_OUTPUT_DIRECTORY)
358+
apply_test_category_labels(${_rt_t}
359+
"${CMAKE_CURRENT_SOURCE_DIR}/test_categories.yaml"
360+
"${_rt_dir}" "${INSTALL_TEST_FILE}")
361+
endforeach()
362+
else()
363+
message(
364+
STATUS
365+
"Shared CTest categories not found at "
366+
"${ROCM_LIBRARIES_ROOT}/shared/ctest/TestCategories.cmake - "
367+
"skipping rocthrust test category labels"
368+
)
369+
endif()
370+
343371
rocm_install(
344372
FILES "${INSTALL_TEST_FILE}"
345373
DESTINATION "${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}"

test/test_categories.yaml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# rocThrust test categories
2+
#
3+
# This file is the single source of truth for the gtest filter that drives the
4+
# `quick` CTest tier in CI. The patterns below mirror the QUICK_TESTS list in
5+
# TheRock's `build_tools/github_actions/test_executable_scripts/test_rocthrust.py`
6+
# so that running `ctest -L quick` from the build / install tree produces the
7+
# same selection that TheRock CI runs via the GTEST_FILTER environment
8+
# variable.
9+
#
10+
# Each entry under `quick.test_patterns` is a gtest filter pattern. The shared
11+
# parser (rocm-libraries/shared/ctest/parse_test_categories.py) joins them with
12+
# ':' and registers a `<binary>_quick_suite` CTest entry per rocThrust test
13+
# binary, invoking that binary with `--gtest_filter=<joined patterns>`.
14+
#
15+
test_categories:
16+
quick:
17+
description: "Fast sanity checks - mirrors TheRock test_rocthrust.py QUICK_TESTS"
18+
test_patterns:
19+
- "AllocatorTests.*"
20+
- "AsyncExclusiveScan*"
21+
- "AsyncInclusiveScan*"
22+
- "AsyncReduce*"
23+
- "AsyncSort*"
24+
- "AsyncTransform*"
25+
- "AsyncTriviallyRelocatableElements*"
26+
- "ConstantIteratorTests.*"
27+
- "Copy*"
28+
- "CopyN*"
29+
- "Count*"
30+
- "CountingIteratorTests.*"
31+
- "Dereference*"
32+
- "DeviceDelete*"
33+
- "DevicePathSimpleTest"
34+
- "DevicePtrTests.*"
35+
- "DeviceReferenceTests.*"
36+
- "DiscardIteratorTests.*"
37+
- "EqualTests.*"
38+
- "Fill*"
39+
- "Find*"
40+
- "ForEach*"
41+
- "Gather*"
42+
- "Generate*"
43+
- "InnerProduct*"
44+
- "IsPartitioned*"
45+
- "IsSorted*"
46+
- "IsSortedUntil*"
47+
- "MemoryTests.*"
48+
- "Merge*"
49+
- "MergeByKey*"
50+
- "Mr*Tests.*"
51+
- "Partition*"
52+
- "PartitionPoint*"
53+
- "PermutationIteratorTests.*"
54+
- "RandomTests.*"
55+
- "Reduce*"
56+
- "ReduceByKey*"
57+
- "Remove*"
58+
- "RemoveIf*"
59+
- "Replace*"
60+
- "ReverseIterator*"
61+
- "Scan*"
62+
- "ScanByKey*"
63+
- "Scatter*"
64+
- "Sequence*"
65+
- "SetDifference*"
66+
- "SetIntersection*"
67+
- "SetSymmetricDifference*"
68+
- "Shuffle*"
69+
- "Sort*"
70+
- "StableSort*"
71+
- "StableSortByKey*"
72+
- "Tabulate*"
73+
- "TestBijectionLength"
74+
- "TestHipThrustCopy.DeviceToDevice"
75+
- "Transform*"
76+
- "TransformIteratorTests.*"
77+
- "TransformReduce*"
78+
- "TransformScan*"
79+
- "UninitializedCopy*"
80+
- "UninitializedFill*"
81+
- "Unique*"
82+
- "Vector*"
83+
- "VectorAllocatorTests.*"
84+
- "ZipIterator*"
85+
exclude:
86+
labels:
87+
- "quick"
88+
89+
standard:
90+
description: "Full gtest run (filter '*') - shared across PR / nightly / weekly tiers"
91+
test_patterns:
92+
- "*"
93+
exclude:
94+
labels:
95+
- "standard"
96+
- "comprehensive"
97+
- "full"
98+
99+
# No GPU-specific exclusions are defined yet for rocThrust. Add entries here if a
100+
# specific gfx target needs to skip particular suites (see rocPRIM's
101+
# test_categories.yaml for a worked example). The empty mapping is required so
102+
# the shared parser does not treat the section as `None`.
103+
exclude_gpu: {}
104+
105+
execution_settings:
106+
default_timeout: 300
107+
timeout_multiplier: 1 # Multiplier for all timeouts (1, 1.5, 1.75, 2, etc.)
108+
category_timeouts:
109+
quick: 300 # 5 minutes
110+
standard: 14400 # 4 hours (longest tier the standard entry serves)

0 commit comments

Comments
 (0)