tests: fail configure when dormant shaderCfgTests drift from the known list #1038
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1038
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1038/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@theantipopau on GitHub · 2026-10-04 03:18 UTC · original
theantipopau:dormant-test-guard→main· +107 −0 · 1 files · 3 commits · closed without mergingWhy
A test function in
tests/shaderCfgTests.cppthat is defined but never called frommain()silently provides no coverage. An audit found that had happened 43 times — includingTestNewShaderRecompilerVop3LaneReadDestinationEncoding, which sat dormant next to its decoder family until #840 wired it up.What
Add a configure-time guard to
CMakeLists.txtright aftershader_cfg_testsis declared:shaderCfgTests.cppandShaderRayTracingTests.inc, match everyvoid TestNamedefinition, and look each name up in the text afterint main(.//inside a block would otherwise eat the closing delimiter and hide live calls.kyty_shader_cfg_known_dormantexactly. On drift,message(FATAL_ERROR)prints both the newly dormant tests and the resurrected ones, with instructions: call every new test frommain(), or add it to the list when it asserts behaviour that is not implemented yet.CMAKE_CONFIGURE_DEPENDSso editing them re-runs the check instead of only running when something unrelated touches the build.Wiring up a dormant test means implementing what it asserts rather than weakening the assertion, so the list documents intentional gaps and must shrink over time.
Verification
cmakeconfigure on currentmain: passes (CONFIG_RC=0) — the documented list matches today's file exactly.TestComputeLdsAllocationIdentity) makes configure fail withdefined but never called, not in the list: TestComputeLdsAllocationIdentity, exit 1. Reverted afterwards.string(REGEX MATCHALL ...)) are in the inline comments — those failure modes are silent, so they are documented where they live.🤖 Generated with Codebuff
Co-Authored-By: Codebuff [email protected]
Upstream deleted the SopkWaitcntMarkers and DsFloatMinMaxTranslation tests and added a parameterized BoundedMaterialBufferStores call, so the guard looks names up as a "name(" prefix (no test definitions follow main()) and the list drops the two removed entries. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <[email protected]>@coderabbitai[bot] on GitHub · 2026-10-04 03:24 UTC · original · edited 2026-10-06 04:53 UTC
📝 Walkthrough
Walkthrough
CMake checks shader configuration test coverage during configuration. It extracts test definitions from two source files and checks for matching calls after
main()inshaderCfgTests.cpp, ignoring comments. Configuration fails if the resulting dormant-test list does not match the 43 names in the known dormant-test list. Changes to either source file trigger CMake reconfiguration.Suggested reviewers:
cosmoPriority: ⬇️ Low
Change: Other
Merge Risk: 🔵 Low · up to
107acThe new check can reject configuration for a commented-out test or miss a dormant test whose name is a suffix of a called test. These are bounded risks, but both should be corrected to make the coverage gate reliable.
Architecture Summary
Architecture risk: 🔵 Low · up to
107acThe change affects 1 system.
Changed systems:
CMakeLists.txtArchitecture concerns
No architecture-level concerns identified.
Review details
Systems and components
Before / after behavior
kyty_shader_cfg_known_dormantlist of shader test functions intentionally not called frommain().main(), and identifies definitions with no matching call.🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@ -394,0 +452,4 @@# a quoted argument, so a pattern ending in an escaped paren pair silently degrades into an empty# capture group, and recovering the name would then need a backreference. Stripping the matched# prefix needs no backreference at all.string(REGEX MATCHALL "void[ \t]+Test[A-Za-z0-9_]+" kyty_shader_cfg_defined_raw "${kyty_shader_cfg_source}${kyty_shader_cfg_included}")@coderabbitai[bot] on GitHub · 2026-10-04 03:24 UTC · original
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Remove comments before scanning test definitions.
If either source contains
// void TestExample() { ... }, this expression recordsTestExampleas a definition. The later comparison then fails configuration even though no test was added. Remove comments from both definition sources beforeMATCHALL, as the call scan already does formain(). (cmake.org)@coderabbitai[bot] on GitHub · 2026-10-04 03:24 UTC · original · edited 2026-10-06 04:47 UTC
On
CMakeLists.txtline 477 (outdated):🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Accept valid spacing in test calls.
If
main()callsTestExample ();, C++ accepts the call, but this exact-string search does not findTestExample();. Configuration then reports a live test as dormant. Match the call tokens with permitted whitespace instead of requiring one spelling. (cmake.org)🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 15515
Do not count calls disabled by the preprocessor.
CMakeLists.txt:477searches raw source after removing comments, but it does not evaluate preprocessor directives. ATestName();call inside#if 0therefore matches the search even though the runner never invokes it. The test is omitted fromkyty_shader_cfg_dormant, so configuration can pass without coverage.Either scan preprocessed source for the applicable configuration or explicitly reject matching calls inside disabled preprocessor regions. Keep the existing syntactic handling for platform guards, which may be active in another supported configuration.
✅ Addressed in commit
107ac15@coderabbitai[bot] on GitHub · 2026-10-04 03:24 UTC · original · reviewed
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
b5a18df0-fd4a-4309-9518-a9d51e75f104📥 Commits
Reviewing files that changed from the base of the PR and between
db17585277andc1c15f2fce.📒 Files selected for processing (1)
CMakeLists.txtIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
@coderabbitai[bot] on GitHub · 2026-10-06 04:53 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
48ecb301-20fc-46d8-917e-0ed7c758c676📥 Commits
Reviewing files that changed from the base of the PR and between
8ab003fe83and107ac15258.📒 Files selected for processing (1)
CMakeLists.txtIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.
@ -394,0 +474,4 @@string(REGEX REPLACE "//[^\n]*" "" kyty_shader_cfg_main "${kyty_shader_cfg_main}")set(kyty_shader_cfg_dormant "")foreach(kyty_shader_cfg_name ${kyty_shader_cfg_defined})string(FIND "${kyty_shader_cfg_main}" "${kyty_shader_cfg_name}(" kyty_shader_cfg_at) # guard-needle-v2@coderabbitai[bot] on GitHub · 2026-10-06 04:53 UTC · original
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 9804
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 9527
Match the complete test name.
string(FIND)matches${kyty_shader_cfg_name}(as a substring. Therefore,OtherTestExample()can satisfy the search forTestExample(. A futureTestExampledefinition could remain uncalled without entering the dormant-test list. Match an identifier boundary before the test name.Suggested fix
@Nmzik on GitHub · 2026-10-08 13:36 UTC · original
Prefer explicit test registration
Pull request closed