tests: fail configure when dormant shaderCfgTests drift from the known list #1038

Closed
github-bot wants to merge 3 commits from gh-pr/1038/head into gh-pr/1038/base
Owner

@⁠theantipopau on GitHub · 2026-10-04 03:18 UTC · original
theantipopau:dormant-test-guard → main · +107 −0 · 1 files · 3 commits · closed without merging

Why

A test function in tests/shaderCfgTests.cpp that is defined but never called from main() silently provides no coverage. An audit found that had happened 43 times — including TestNewShaderRecompilerVop3LaneReadDestinationEncoding, which sat dormant next to its decoder family until #840 wired it up.

What

Add a configure-time guard to CMakeLists.txt right after shader_cfg_tests is declared:

  • Read shaderCfgTests.cpp and ShaderRayTracingTests.inc, match every void TestName definition, and look each name up in the text after int main(.
  • Strip block comments and line comments before the lookup, so a name mentioned only in a comment does not count as a call. Block comments go first: a // inside a block would otherwise eat the closing delimiter and hide live calls.
  • Require the resulting defined-but-never-called set to equal kyty_shader_cfg_known_dormant exactly. On drift, message(FATAL_ERROR) prints both the newly dormant tests and the resurrected ones, with instructions: call every new test from main(), or add it to the list when it asserts behaviour that is not implemented yet.
  • Register both sources with CMAKE_CONFIGURE_DEPENDS so 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

  • cmake configure on current main: passes (CONFIG_RC=0) — the documented list matches today's file exactly.
  • Negative test: commenting out one call (TestComputeLdsAllocationIdentity) makes configure fail with defined but never called, not in the list: TestComputeLdsAllocationIdentity, exit 1. Reverted afterwards.
  • Notes on the regex patterns (escaped parens degrading to empty capture groups, one-line requirement for 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]

**@⁠theantipopau** on GitHub · 2026-10-04 03:18 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1038) `theantipopau:dormant-test-guard` → `main` · +107 −0 · 1 files · 3 commits · closed without merging ## Why A test function in `tests/shaderCfgTests.cpp` that is defined but never called from `main()` silently provides no coverage. An audit found that had happened 43 times — including `TestNewShaderRecompilerVop3LaneReadDestinationEncoding`, which sat dormant next to its decoder family until #840 wired it up. ## What Add a configure-time guard to `CMakeLists.txt` right after `shader_cfg_tests` is declared: - Read `shaderCfgTests.cpp` and `ShaderRayTracingTests.inc`, match every `void TestName` definition, and look each name up in the text after `int main(`. - Strip block comments and line comments before the lookup, so a name mentioned only in a comment does not count as a call. Block comments go first: a `//` inside a block would otherwise eat the closing delimiter and hide live calls. - Require the resulting defined-but-never-called set to equal `kyty_shader_cfg_known_dormant` exactly. On drift, `message(FATAL_ERROR)` prints both the newly dormant tests and the resurrected ones, with instructions: call every new test from `main()`, or add it to the list when it asserts behaviour that is not implemented yet. - Register both sources with `CMAKE_CONFIGURE_DEPENDS` so 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 - `cmake` configure on current `main`: passes (`CONFIG_RC=0`) — the documented list matches today's file exactly. - Negative test: commenting out one call (`TestComputeLdsAllocationIdentity`) makes configure fail with `defined but never called, not in the list: TestComputeLdsAllocationIdentity`, exit 1. Reverted afterwards. - Notes on the regex patterns (escaped parens degrading to empty capture groups, one-line requirement for `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]>
A test function that is defined but never called from main() silently
provides no coverage, and that had happened 43 times in this file.
Parse the sources at configure time, strip comments before looking for
calls, and require the defined-but-never-called set to match
kyty_shader_cfg_known_dormant exactly, so the gap cannot grow
unnoticed. Register the sources as configure-time dependencies so
editing them re-runs the check.

🤖 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]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:41:19 +00:00
github-bot closed this pull request 2026-11-26 09:41:19 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-04 03:24 UTC · original · edited 2026-10-06 04:53 UTC

Review in Change Stack →

📝 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() in shaderCfgTests.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: cosmo

Priority: ⬇️ Low

Change: Other

Merge Risk: 🔵 Low · up to 107ac

The 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 107ac

The change affects 1 system.

Changed systems: CMakeLists.txt

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — CMakeLists.txt (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in CMakeLists.txt: Adds the documented kyty_shader_cfg_known_dormant list of shader test functions intentionally not called from main().
  • observed — Modified behavior in CMakeLists.txt: Reads the test source and included test file, registers them as configure dependencies, extracts defined test names, strips comments from the portion of the source starting at main(), and identifies definitions with no matching call.
  • observed — Modified behavior in CMakeLists.txt: Sorts the discovered dormant names and documented list, then fails configuration if they differ, reporting tests that are unaccounted for and listed tests that are now called.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the configure-time guard for dormant shader tests.
Description check ✅ Passed The description explains the guard, its behavior, and the reported verification results. It is directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-04 03:24 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1038#issuecomment-5976141477) · edited 2026-10-06 04:53 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1038?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough CMake checks shader configuration test coverage during configuration. It extracts test definitions from two source files and checks for matching calls after `main()` in `shaderCfgTests.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:** `cosmo` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬇️ Low <!-- change_assessment_commit:"107ac15258186b06101403f74faad16bcd623ca2" --> **Change:** Other <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _🔵 Low_ · up to `107ac` <!-- final_review_risk_coverage:{"sourceCommitId":"107ac15258186b06101403f74faad16bcd623ca2","coveredCommitId":"107ac15258186b06101403f74faad16bcd623ca2","kind":"reviewed"} --> The 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. <!-- final_review_risk_end --> <!-- architecture_review_start --> ### Architecture Summary **Architecture risk:** _🔵 Low_ · up to `107ac` The change affects 1 system. **Changed systems:** `CMakeLists.txt` **Architecture concerns** No architecture-level concerns identified. <details> <summary>Review details</summary> **Systems and components** - _observed_ — CMakeLists.txt (service) was modified; 1 changed file maps to changed impact. **Before / after behavior** - _observed_ — Modified behavior in CMakeLists.txt: Adds the documented `kyty_shader_cfg_known_dormant` list of shader test functions intentionally not called from `main()`. - _observed_ — Modified behavior in CMakeLists.txt: Reads the test source and included test file, registers them as configure dependencies, extracts defined test names, strips comments from the portion of the source starting at `main()`, and identifies definitions with no matching call. - _observed_ — Modified behavior in CMakeLists.txt: Sorts the discovered dormant names and documented list, then fails configuration if they differ, reporting tests that are unaccounted for and listed tests that are now called. </details> <!-- architecture_review_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 5</summary> <details> <summary>✅ Passed checks (5 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly and concisely describes the configure-time guard for dormant shader tests. | | Description check | ✅ Passed | The description explains the guard, its behavior, and the reported verification results. It is directly related to the changeset. | | Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0… | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1038)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -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}")
Author
Owner

@⁠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 records TestExample as a definition. The later comparison then fails configuration even though no test was added. Remove comments from both definition sources before MATCHALL, as the call scan already does for main(). (cmake.org)

**@⁠coderabbitai[bot]** on GitHub · 2026-10-04 03:24 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1038#discussion_r4175977345) _🎯 Functional Correctness_ | _🟡 Minor_ | _⚡ Quick win_ **Remove comments before scanning test definitions.** If either source contains `// void TestExample() { ... }`, this expression records `TestExample` as a definition. The later comparison then fails configuration even though no test was added. Remove comments from both definition sources before `MATCHALL`, as the call scan already does for `main()`. ([cmake.org](https://cmake.org/cmake/help/latest/command/string.html?utm_source=openai)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:37f999ccd8704d8dbdd5076a --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-04 03:24 UTC · original · edited 2026-10-06 04:47 UTC
On CMakeLists.txt line 477 (outdated):

@@ -391,6 +391,113 @@ endfunction()
 
 add_kyty_full_emulator_test(shader_cfg_tests "${KYTY_TESTS_DIR}/shaderCfgTests.cpp")
 
+# A test function that is defined but never called from main() silently provides no coverage, and
+# that had happened 43 times in this file. Work out which definitions have no call after main()
+# and fail the configure step when the result is not exactly the list documented below, so the gap
+# cannot grow unnoticed.
+#
+# These are knowingly dormant: each asserts decoder, translator or SPIR-V emission behaviour that
+# is not implemented yet. Wiring one up means implementing what it asserts rather than weakening
+# the assertion, and its name should be dropped from this list in the same change.
+set(kyty_shader_cfg_known_dormant
+	TestNewShaderRecompilerSopkWaitcntMarkers
+	TestNewShaderRecompilerRdna2ScalarOpcodes
+	TestNewShaderRecompilerScalarVectorAlu
+	TestNewShaderRecompilerMoreAluFamilies
+	TestNewShaderRecompilerExpandedAluBatch
+	TestNewShaderRecompilerVop3pPackedF16
+	TestNewShaderRecompilerStagedShaderOps
+	TestNewShaderRecompilerBootF16UnaryOpcodes
+	TestNewShaderRecompilerBootB16PackedAndSdwaOpcodes
+	TestNewShaderRecompilerScalarB64Alu
+	TestNewShaderRecompilerSignedCompareAlu
+	TestNewShaderRecompilerSignedMinShiftAlu
+	TestNewShaderRecompilerScalarBitfieldAlu
+	TestNewShaderRecompilerMemoryFamilyTranslation
+	TestNewShaderRecompilerImageQueryTranslation
+	TestNewShaderRecompilerCubeSampleCoordinates
+	TestNewShaderRecompilerImageSampleVariants
+	TestNewShaderRecompilerImageSampleA16SamplerCoords
+	TestNewShaderRecompilerImageSampleOpcodeAliases
+	TestNewShaderRecompilerImageSampleA16ExceptionComponents
+	TestNewShaderRecompilerImageLoadA16UintCoords
+	TestNewShaderRecompilerImageViewDimensions
+	TestNewShaderRecompilerStorageImage1DDescriptorVariants
+	TestNewShaderRecompilerNullImageUsesCanonical2DView
+	TestNewShaderRecompilerImageGatherVariants
+	TestNewShaderRecompilerImageLoadVariants
+	TestNewShaderRecompilerImageLoad2DMsaa
+	TestNewShaderRecompilerImageStoreTranslation
+	TestNewShaderRecompilerStorageImage3DDescriptorVariant
+	TestNewShaderRecompilerStorageImage2DDescriptorOverridesMimg3D
+	TestNewShaderRecompilerImageAtomicTranslation
+	TestNewShaderRecompilerVintrpTranslation
+	TestNewShaderRecompilerBufferSignedLoadTranslation
+	TestNewShaderRecompilerBufferSubDwordStoreTranslation
+	TestNewShaderRecompilerFlatOldBackedTranslation
+	TestNewShaderRecompilerFlatSignedLoadTranslation
+	TestNewShaderRecompilerFlatStoreTranslation
+	TestNewShaderRecompilerAtomicTranslation
+	TestNewShaderRecompilerDsSubDwordTranslation
+	TestNewShaderRecompilerDsSwizzleTranslation
+	TestNewShaderRecompilerDsAddtidTranslation
+	TestNewShaderRecompilerDsFloatMinMaxTranslation
+	TestNewShaderRecompilerExpVertexOutputs
+)
+file(READ "${KYTY_TESTS_DIR}/shaderCfgTests.cpp" kyty_shader_cfg_source)
+file(READ "${KYTY_TESTS_DIR}/ShaderRayTracingTests.inc" kyty_shader_cfg_included)
+# file(READ) alone does not make CMake reconfigure when the file is edited, so the guard would
+# only run when something unrelated touched the build. Register the sources as configure-time
+# dependencies to make editing them re-run it.
+set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${KYTY_TESTS_DIR}/shaderCfgTests.cpp" "${KYTY_TESTS_DIR}/ShaderRayTracingTests.inc")
+# Only the "void TestName" prefix is matched, deliberately. CMake strips a backslash before "(" in
+# 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}")
+string(REGEX REPLACE "void[ \t]+" "" kyty_shader_cfg_defined "${kyty_shader_cfg_defined_raw}")
+list(REMOVE_DUPLICATES kyty_shader_cfg_defined)
+# The calls live after main(). Each name is looked up directly instead of matching a call pattern,
+# so the check does not depend on how a call happens to be spelled. Comments are dropped first,
+# because a name mentioned only in a comment is not a call and would otherwise hide a test that is
+# still dormant. Block comments go before line comments: a block containing "//" on the line of
+# its closing delimiter would lose that delimiter to the line pass and then never match, leaving
+# the commented call in the searched text. The residual gap is a "/*" inside a line comment with a
+# later "*/" in main, which can eat live calls and fail the configure loudly rather than silently.
+# The block pattern avoids backslash escapes on purpose: CMake strips a backslash before any
+# punctuation in a quoted argument, so a literal * or ( must travel inside a character class.
+# Kept on one line, because a wrapped string(REGEX ...) silently matches nothing here.
+string(FIND "${kyty_shader_cfg_source}" "int main(" kyty_shader_cfg_main_pos)
+math(EXPR kyty_shader_cfg_main_pos "${kyty_shader_cfg_main_pos} - 1")
+string(SUBSTRING "${kyty_shader_cfg_source}" ${kyty_shader_cfg_main_pos} -1 kyty_shader_cfg_main)
+string(REGEX REPLACE "/[*][^*]*[*]+([^/*][^*]*[*]+)*/" "" kyty_shader_cfg_main "${kyty_shader_cfg_main}")
+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)

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Accept valid spacing in test calls.

If main() calls TestExample ();, C++ accepts the call, but this exact-string search does not find TestExample();. 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:

sed -n '385,510p' CMakeLists.txt
sed -n '14290,14470p' tests/shaderCfgTests.cpp

Repository: KytyPS5/KytyPS5

Length of output: 15515


Do not count calls disabled by the preprocessor.

CMakeLists.txt:477 searches raw source after removing comments, but it does not evaluate preprocessor directives. A TestName(); call inside #if 0 therefore matches the search even though the runner never invokes it. The test is omitted from kyty_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](https://github.com/KytyPS5/KytyPS5/pull/1038#discussion_r4175977349) · edited 2026-10-06 04:47 UTC On `CMakeLists.txt` line 477 (outdated): ```diff @@ -391,6 +391,113 @@ endfunction() add_kyty_full_emulator_test(shader_cfg_tests "${KYTY_TESTS_DIR}/shaderCfgTests.cpp") +# A test function that is defined but never called from main() silently provides no coverage, and +# that had happened 43 times in this file. Work out which definitions have no call after main() +# and fail the configure step when the result is not exactly the list documented below, so the gap +# cannot grow unnoticed. +# +# These are knowingly dormant: each asserts decoder, translator or SPIR-V emission behaviour that +# is not implemented yet. Wiring one up means implementing what it asserts rather than weakening +# the assertion, and its name should be dropped from this list in the same change. +set(kyty_shader_cfg_known_dormant + TestNewShaderRecompilerSopkWaitcntMarkers + TestNewShaderRecompilerRdna2ScalarOpcodes + TestNewShaderRecompilerScalarVectorAlu + TestNewShaderRecompilerMoreAluFamilies + TestNewShaderRecompilerExpandedAluBatch + TestNewShaderRecompilerVop3pPackedF16 + TestNewShaderRecompilerStagedShaderOps + TestNewShaderRecompilerBootF16UnaryOpcodes + TestNewShaderRecompilerBootB16PackedAndSdwaOpcodes + TestNewShaderRecompilerScalarB64Alu + TestNewShaderRecompilerSignedCompareAlu + TestNewShaderRecompilerSignedMinShiftAlu + TestNewShaderRecompilerScalarBitfieldAlu + TestNewShaderRecompilerMemoryFamilyTranslation + TestNewShaderRecompilerImageQueryTranslation + TestNewShaderRecompilerCubeSampleCoordinates + TestNewShaderRecompilerImageSampleVariants + TestNewShaderRecompilerImageSampleA16SamplerCoords + TestNewShaderRecompilerImageSampleOpcodeAliases + TestNewShaderRecompilerImageSampleA16ExceptionComponents + TestNewShaderRecompilerImageLoadA16UintCoords + TestNewShaderRecompilerImageViewDimensions + TestNewShaderRecompilerStorageImage1DDescriptorVariants + TestNewShaderRecompilerNullImageUsesCanonical2DView + TestNewShaderRecompilerImageGatherVariants + TestNewShaderRecompilerImageLoadVariants + TestNewShaderRecompilerImageLoad2DMsaa + TestNewShaderRecompilerImageStoreTranslation + TestNewShaderRecompilerStorageImage3DDescriptorVariant + TestNewShaderRecompilerStorageImage2DDescriptorOverridesMimg3D + TestNewShaderRecompilerImageAtomicTranslation + TestNewShaderRecompilerVintrpTranslation + TestNewShaderRecompilerBufferSignedLoadTranslation + TestNewShaderRecompilerBufferSubDwordStoreTranslation + TestNewShaderRecompilerFlatOldBackedTranslation + TestNewShaderRecompilerFlatSignedLoadTranslation + TestNewShaderRecompilerFlatStoreTranslation + TestNewShaderRecompilerAtomicTranslation + TestNewShaderRecompilerDsSubDwordTranslation + TestNewShaderRecompilerDsSwizzleTranslation + TestNewShaderRecompilerDsAddtidTranslation + TestNewShaderRecompilerDsFloatMinMaxTranslation + TestNewShaderRecompilerExpVertexOutputs +) +file(READ "${KYTY_TESTS_DIR}/shaderCfgTests.cpp" kyty_shader_cfg_source) +file(READ "${KYTY_TESTS_DIR}/ShaderRayTracingTests.inc" kyty_shader_cfg_included) +# file(READ) alone does not make CMake reconfigure when the file is edited, so the guard would +# only run when something unrelated touched the build. Register the sources as configure-time +# dependencies to make editing them re-run it. +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${KYTY_TESTS_DIR}/shaderCfgTests.cpp" "${KYTY_TESTS_DIR}/ShaderRayTracingTests.inc") +# Only the "void TestName" prefix is matched, deliberately. CMake strips a backslash before "(" in +# 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}") +string(REGEX REPLACE "void[ \t]+" "" kyty_shader_cfg_defined "${kyty_shader_cfg_defined_raw}") +list(REMOVE_DUPLICATES kyty_shader_cfg_defined) +# The calls live after main(). Each name is looked up directly instead of matching a call pattern, +# so the check does not depend on how a call happens to be spelled. Comments are dropped first, +# because a name mentioned only in a comment is not a call and would otherwise hide a test that is +# still dormant. Block comments go before line comments: a block containing "//" on the line of +# its closing delimiter would lose that delimiter to the line pass and then never match, leaving +# the commented call in the searched text. The residual gap is a "/*" inside a line comment with a +# later "*/" in main, which can eat live calls and fail the configure loudly rather than silently. +# The block pattern avoids backslash escapes on purpose: CMake strips a backslash before any +# punctuation in a quoted argument, so a literal * or ( must travel inside a character class. +# Kept on one line, because a wrapped string(REGEX ...) silently matches nothing here. +string(FIND "${kyty_shader_cfg_source}" "int main(" kyty_shader_cfg_main_pos) +math(EXPR kyty_shader_cfg_main_pos "${kyty_shader_cfg_main_pos} - 1") +string(SUBSTRING "${kyty_shader_cfg_source}" ${kyty_shader_cfg_main_pos} -1 kyty_shader_cfg_main) +string(REGEX REPLACE "/[*][^*]*[*]+([^/*][^*]*[*]+)*/" "" kyty_shader_cfg_main "${kyty_shader_cfg_main}") +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) ``` _🎯 Functional Correctness_ | _🟡 Minor_ | _⚡ Quick win_ **Accept valid spacing in test calls.** If `main()` calls `TestExample ();`, C++ accepts the call, but this exact-string search does not find `TestExample();`. Configuration then reports a live test as dormant. Match the call tokens with permitted whitespace instead of requiring one spelling. ([cmake.org](https://cmake.org/cmake/help/latest/command/string.html?utm_source=openai)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:082669df2ccb1230c9398934 --> --- _🎯 Functional Correctness_ | _🟡 Minor_ | _⚡ Quick win_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '385,510p' CMakeLists.txt sed -n '14290,14470p' tests/shaderCfgTests.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 15515 --- </details> **Do not count calls disabled by the preprocessor.** `CMakeLists.txt:477` searches raw source after removing comments, but it does not evaluate preprocessor directives. A `TestName();` call inside `#if 0` therefore matches the search even though the runner never invokes it. The test is omitted from `kyty_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. <!-- fingerprinting:phantom:medusa:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:6b6ddf9e182e7fa8ea160698 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 107ac15
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-04 03:24 UTC · original · reviewed

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b5a18df0-fd4a-4309-9518-a9d51e75f104
📥 Commits

Reviewing files that changed from the base of the PR and between db17585277 and c1c15f2fce.

📒 Files selected for processing (1)
  • CMakeLists.txt

Included 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-04 03:24 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1038#pullrequestreview-5404074513) · **reviewed** **Actionable comments posted: 3** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `b5a18df0-fd4a-4309-9518-a9d51e75f104` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between db1758527751125592f57bf02f29616fa0643159 and c1c15f2fcebca4d5f371764789f9f01bc7cc3aa3. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `CMakeLists.txt` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-06 04:53 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 48ecb301-20fc-46d8-917e-0ed7c758c676
📥 Commits

Reviewing files that changed from the base of the PR and between 8ab003fe83 and 107ac15258.

📒 Files selected for processing (1)
  • CMakeLists.txt

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-06 04:53 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1038#pullrequestreview-5423923918) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `48ecb301-20fc-46d8-917e-0ed7c758c676` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 8ab003fe83f3354cd9f547061a3561b979ec28f1 and 107ac15258186b06101403f74faad16bcd623ca2. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `CMakeLists.txt` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=a9805c04-a05f-4835-8c90-132f92b1e810 attempt=75380ff4-83b7-4f1e-a9e3-cee51ca12efd batch=1/1 -->
@ -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
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-06 04:53 UTC · original

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '394,505p' CMakeLists.txt
rg -n 'void Test[a-zA-Z0-9_]*Test|void Test[A-Za-z0-9_]*' tests/shaderCfgTests.cpp tests/ShaderRayTracingTests.inc | head -35

Repository: KytyPS5/KytyPS5

Length of output: 9804


🏁 Script executed:

python3 - <<'PY'
from pathlib import Path
import re

paths = [Path("tests/shaderCfgTests.cpp"), Path("tests/ShaderRayTracingTests.inc")]
text = "".join(p.read_text() for p in paths)
defined = sorted(set(re.findall(r"\bvoid[ \t]+(Test[A-Za-z0-9_]+)", text)))
main_source = Path("tests/shaderCfgTests.cpp").read_text()
pos = main_source.find("int main(")
print(f"main source starts at line {main_source[:pos].count(chr(10)) + 1}")
print("main region:")
lines = main_source[pos:].splitlines()
for i, line in enumerate(lines, main_source[:pos].count("\n") + 1):
    print(f"{i}: {line}")
calls = sorted(set(re.findall(r"(Test[A-Za-z0-9_]+)\s*\(", "\n".join(lines))))
print("\nPotential suffix collisions (short name appears immediately before '(' inside a longer called name):")
for short in defined:
    for long_name in calls:
        if long_name != short and long_name.endswith(short):
            print(f"{short} <- {long_name}")
print("\nDefined names:", len(defined))
print("\nCall names in main region:", len(calls))
PY

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 for TestExample(. A future TestExample definition could remain uncalled without entering the dormant-test list. Match an identifier boundary before the test name.

Suggested fix
-	string(FIND "${kyty_shader_cfg_main}" "${kyty_shader_cfg_name}(" kyty_shader_cfg_at) # guard-needle-v2
-	if(kyty_shader_cfg_at EQUAL -1)
+	string(REGEX MATCH "(^|[^A-Za-z0-9_])${kyty_shader_cfg_name}[(]" kyty_shader_cfg_call "${kyty_shader_cfg_main}")
+	if(NOT kyty_shader_cfg_call)
**@⁠coderabbitai[bot]** on GitHub · 2026-10-06 04:53 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1038#discussion_r4191651067) **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '394,505p' CMakeLists.txt rg -n 'void Test[a-zA-Z0-9_]*Test|void Test[A-Za-z0-9_]*' tests/shaderCfgTests.cpp tests/ShaderRayTracingTests.inc | head -35 ``` Repository: KytyPS5/KytyPS5 Length of output: 9804 --- 🏁 Script executed: ```bash python3 - <<'PY' from pathlib import Path import re paths = [Path("tests/shaderCfgTests.cpp"), Path("tests/ShaderRayTracingTests.inc")] text = "".join(p.read_text() for p in paths) defined = sorted(set(re.findall(r"\bvoid[ \t]+(Test[A-Za-z0-9_]+)", text))) main_source = Path("tests/shaderCfgTests.cpp").read_text() pos = main_source.find("int main(") print(f"main source starts at line {main_source[:pos].count(chr(10)) + 1}") print("main region:") lines = main_source[pos:].splitlines() for i, line in enumerate(lines, main_source[:pos].count("\n") + 1): print(f"{i}: {line}") calls = sorted(set(re.findall(r"(Test[A-Za-z0-9_]+)\s*\(", "\n".join(lines)))) print("\nPotential suffix collisions (short name appears immediately before '(' inside a longer called name):") for short in defined: for long_name in calls: if long_name != short and long_name.endswith(short): print(f"{short} <- {long_name}") print("\nDefined names:", len(defined)) print("\nCall names in main region:", len(calls)) PY ``` Repository: KytyPS5/KytyPS5 Length of output: 9527 --- </details> **Match the complete test name.** `string(FIND)` matches `${kyty_shader_cfg_name}(` as a substring. Therefore, `OtherTestExample()` can satisfy the search for `TestExample(`. A future `TestExample` definition could remain uncalled without entering the dormant-test list. Match an identifier boundary before the test name. <details> <summary>Suggested fix</summary> ```diff - string(FIND "${kyty_shader_cfg_main}" "${kyty_shader_cfg_name}(" kyty_shader_cfg_at) # guard-needle-v2 - if(kyty_shader_cfg_at EQUAL -1) + string(REGEX MATCH "(^|[^A-Za-z0-9_])${kyty_shader_cfg_name}[(]" kyty_shader_cfg_call "${kyty_shader_cfg_main}") + if(NOT kyty_shader_cfg_call) ``` </details> <!-- fingerprinting:phantom:medusa:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:4b230f2151f2531ce317251b --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠Nmzik on GitHub · 2026-10-08 13:36 UTC · original

Prefer explicit test registration

**@⁠Nmzik** on GitHub · 2026-10-08 13:36 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1038#issuecomment-6061082561) Prefer explicit test registration

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.