1+ # Copyright (C) 2026, Advanced Micro Devices, Inc. All rights reserved.
2+
13##########################################################################################
24Validation CTests - YAML-Based Test Generation
35##########################################################################################
@@ -10,7 +12,7 @@ to define test cases in YAML format, which are then automatically converted to C
1012test files during the build process.
1113
1214The validation_ctests directory has the following contents:
13- 1 . README.md - This file
15+ 1. ReadMe.txt - This file
1416 2. auto_generate_tests.py - Python script that generates CMake test files from YAML
1517 3. auto_generate_label_groups.yaml - Global label group definitions and size threshold configuration
1618 4. <API>.yaml - Test definitions for each API. Each API has its own YAML file.
@@ -26,6 +28,11 @@ The test generation workflow follows this pattern:
26283. CMake Integration: Tests are generated at configure time in the build directory
27294. CTest Execution: Generated tests are executed via CMake's CTest framework
2830
31+ ## Dependency
32+
33+ YAML‑based CTest generation depends on the PyYAML package for YAML parsing.
34+ Ensure that PyYAML is installed on your system.
35+
2936## YAML File Format
3037
3138Each API has its own YAML file (e.g., getrf.yaml, syev.yaml). The structure follows
@@ -62,8 +69,8 @@ Filter tests:
6269 $ ctest -L getrf # Lowercase also works (both cases supported)
6370
6471 # Multiple labels (use multiple -L flags, not semicolon)
65- $ ctest -L GETRF -L small # Tests with both GETRF and small labels
66- $ ctest -L avx2 -L precision_d # AVX2 tests with double precision
72+ $ ctest -L GETRF -L small_size # Tests with both GETRF and small_size labels
73+ $ ctest -L LIN -L precision_d # LIN tests with double precision
6774
6875### Label Groups
6976
@@ -72,36 +79,30 @@ all API files. This avoids manually adding multiple labels to each test.
7279
7380Example in auto_generate_label_groups.yaml:
7481 label_groups:
75- postsubmit: [ avx2, avx512 ]
82+ postsubmit: [small_size, medium_size, large_size ]
7683
7784When any test uses the "postsubmit" label, it automatically includes both "postsubmit"
78- and its constituent labels (avx2, avx512 ). This allows managing labels centrally for
85+ and its constituent labels (small_size, medium_size, large_size ). This allows managing labels centrally for
7986multiple API files without editing each file individually. API-specific label_groups can
8087override global groups if needed.
8188
8289### Automatic Size-Based Labeling
8390
84- Tests are automatically assigned size labels (small, medium, large ) based on parameter
91+ Tests are automatically assigned size labels (small_size, medium_size, large_size ) based on parameter
8592values defined in auto_generate_label_groups.yaml. Group labels (e.g., "short") are then automatically
8693assigned to tests matching certain size criteria.
8794
8895Configuration in auto_generate_label_groups.yaml:
8996 size_thresholds:
9097 parameter: max # Check 'n', 'm', or 'max' (max of m and n)
9198 small: 16 # n < 16 or max(m,n) < 16
92- medium: 100 # 16 <= n < 100 or 16 <= max(m,n) < 100
93- # large is automatically assigned if >= medium threshold
99+ medium: 256 # 16 <= n < 256 or 16 <= max(m,n) < 256
100+ # large_size is automatically assigned if >= medium threshold
94101
95102 auto_assign_groups:
96- short: [ small, medium ] # Automatically add "short" label to tests with small or medium size
103+ short: [small_size ] # Automatically add "short" label to tests with small_size
97104
98- Benefits:
99- - Zero manual edits: Tests automatically get size and group labels based on parameters
100- - Centralized configuration: All thresholds in auto_generate_label_groups.yaml
101- - Works across all API files automatically
102- - Flexible: Can define different thresholds for different parameters
103-
104- Example: A test with m=16, n=16 automatically gets "medium" and "short" labels without
105+ Example: A test with m=16, n=16 automatically gets "medium_size" and "short" labels without
105106any manual editing in the API YAML file.
106107
107108
@@ -116,7 +117,7 @@ To add tests for a new API, follow these steps:
116117 Check test/main/src/test_<api>.c to determine the correct parameter order.
117118
1181193. Define Test Paths
119- Add test cases covering different code paths: single element, small/large sizes,
120+ Add test cases covering different code paths: single element, small_size/large_size sizes,
120121 architecture-specific optimizations (AVX2, AVX512), and edge cases.
121122
1221234. Verify Generation
@@ -148,10 +149,13 @@ For manual generation:
148149 $ python3 auto_generate_tests.py --all /tmp/output
149150
150151Run tests:
152+ # Run all the tests generated from yaml files
153+ $ ctest -L yaml_generated
154+
151155 # Filter by label (case-insensitive for API name and group)
152156 $ ctest -L GETRF # Matches tests with GETRF label
153157 $ ctest -L getrf # Also matches (both cases supported)
154- $ ctest -L GETRF -L small # Multiple labels (use multiple -L flags)
158+ $ ctest -L GETRF -L small_size # Multiple labels (use multiple -L flags)
155159 $ ctest -L avx2 # Architecture-specific tests
156160
157161 # Filter by test name regex (uppercase API name)
@@ -161,7 +165,7 @@ Run tests:
161165 # Combined filtering
162166 $ ctest -L GETRF -R ".*kernel.*" # GETRF tests with "kernel" in name
163167
164- ## Example
168+ ## Example of generated ctests
165169
166170Generated CMake test files are in
167171<build_dir>/test/main/validation_ctests/getrf_tests.cmake after configuration.
@@ -170,4 +174,4 @@ Generated CMake test files are in
170174
171175The test generation is integrated into the CMake build system via test/main/CMakeLists.txt.
172176Tests are generated at configure time in the build directory and are not committed to
173- the source tree.
177+ the source tree.
0 commit comments