build(agc): register each AGC test executable in its own CMake fragment #12862

Merged
janzezno merged 3 commits from upstream-pr/12862 into main 2026-10-31 19:33:03 +00:00
janzezno commented 2026-10-29 13:03:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by janzezno on 2026-10-29T13:03:32Z.


What

Moves the AGC test registrations out of core/libs/prx/libSceAgcDriver/CMakeLists.txt into one fragment per test executable, tests/cmake/<executable>.cmake, as agreed in #12521. CMakeLists.txt includes the fragments in sorted order after the execution tests are created. A new test, a new mode of an existing test or a property of one then changes one fragment instead of shared lines.

Three commits:

  1. tools/agc_test_split.py and its tests. refactor and split produce the next two commits; resolve moves the registrations of a change made before the split, like debt_split.py resolve.
  2. python3 tools/agc_test_split.py refactor: the three loops that register tests for a list of executables become functions, agc_add_default_test, agc_add_draw_pipeline_test and agc_add_spirv_mode_tests. The execution tests get their default test right after they are created; every other executable calls the function in its own registration. This also removes the long foreach(agcTest IN ITEMS ...) and set(agcDrawPipelineTests ...) lines that pull requests append to.
  3. python3 tools/agc_test_split.py split: 279 fragments; CMakeLists.txt goes from 4506 to 909 lines. A statement moves with the executable whose targets or tests it changes; statements that write the same variable move together; a loop over several executables and anything that reads every registered test stays in CMakeLists.txt. A test name built from a variable (set_tests_properties(agc_pad_status_overlay_${padStatusName} ...)) moves with the one executable whose tests share its literal prefix; when the prefix matches tests of several executables, split stops with an error instead of leaving the statement before the fragments. Fragments that share a statement are merged into the fragment of the larger executable: 3 fragments hold 8 executables, from statements like one set_target_properties over four overlay executables. Comment lines are not carried into fragments; one two-line comment, before agc_driver_vertex_clip_cull_draw_no_key, is dropped. The commit also adds the resolve rule to CONTRIBUTING.md.

The fragment commit is generated, so it can be regenerated from the main it lands on: git checkout main -- core/libs/prx/libSceAgcDriver/CMakeLists.txt, delete tests/cmake, run refactor and split again.

After the split, a pull request whose CMakeLists.txt change conflicts runs python3 tools/agc_test_split.py resolve during the stopped rebase; the rule is in CONTRIBUTING.md, after "Keep the branch up to date".

Regenerated on main ca073ec3ad. Since 73f4f7e06e the file only gained #9696's agc_driver_target_address_window block, which is now its own fragment. The resolve results under Tested are from 73f4f7e06e, where 191 other open pull requests changed the file.

Merge order with #11566 (agreed with B-Howell): #11566 is still open, so this goes first and #11566 moves its registration with resolve, which gives exactly the split of the merge (below).

Merge order with #14084 (agreed with Amoenus): this goes first and #14084 moves its agc_driver_native_depth_initial_owner registration with resolve. Checked on ca073ec3ad with #14084 at b582949003: resolve puts it in agc_driver_native_multisample_depth_tests.cmake with no conflict, and every file is identical to the split of the merge.

Tested

Arch Linux, CMake 4.4.5, Ninja 1.13.2, GCC 16.2.1.

Registration: configured main 0f302813ce and this branch regenerated on it with the same options (the branch's diff is byte-identical on ca073ec3ad, which only adds #13671 in libSceNpWebApi) and compared every test's command and properties (ctest --show-only=json-v1, source and build directory paths normalized) and the targets in build.ninja (ninja -t targets all). In each configuration below the only differences are the new agc_test_split test and the 279 fragment files build.ninja lists as configure inputs. In the first configuration the build commands (ninja -t commands all, 6634) are identical too.

Configuration Tests on main
BUILD_TESTING=ON 3062
BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON 3074
BUILD_TESTING=ON, AGC_BUILD_VISUAL_TEST=ON 3062
BUILD_TESTING=ON, ANYPS5_ENABLE_ASAN=ON 3061
BUILD_TESTING=ON, APS5_ENABLE_TRACY=ON 3062
BUILD_TESTING=ON, ANYPS5_AGC_EXECUTION_TESTS=PooledBufferRange 3062
BUILD_TESTING=ON, ANYPS5_AGC_EXECUTION_TESTS=PooledBufferRange;CommittedReadMapping 3062
BUILD_TESTING=ON, ANYPS5_RELINKER_CLI=OFF 2853
BUILD_TESTING=ON, ANYPS5_RUN_QUARANTINED_FRAME_REPLAY=ON 3062
BUILD_TESTING=ON, CMAKE_CXX_COMPILER_LAUNCHER=ccache 3062
BUILD_TESTING=OFF 0 (targets only)
set(WIN32 ON) at the top of the AGC CMakeLists.txt 3112
set(WIN32 ON) and set(MINGW ON), with a stand-in anyps5_windows_test_exit 3112

The WIN32/MINGW rows only run the Windows branches of this directory on Linux. A Windows (MSYS2) comparison is still open; I can't run one, so a run on Windows (ctest -N and ctest --show-only=json-v1 on main and this branch) would close it.

Rebase script, resolve:

  • The last 150 commits on main 73f4f7e06e that changed the file: applying each one's change to the split of its parent gives exactly the split of the commit, with no conflicts, 150 of 150.
  • The 191 other open pull requests that changed the file on main 73f4f7e06e, before this regeneration: all 153 that merge cleanly today give exactly the split of that merge, #11566 among them; 5 that conflict today apply without a conflict; 17 conflict both ways, 16 of them in one fragment each (10 in the recorder tests, 4 in the native multisample depth tests, 1 each in the shader memory and graphics tests) and #5925 in CMakeLists.txt and three fragments; 16 leave the file unchanged.

python3 -m unittest tools/tests/test_agc_test_split.py: 15 tests pass. python3 tools/check_test_registration.py on the configured branch: 1632 test executables, none built and not run, as on main; --scripts: 231 test scripts, each run (230 on main, plus test_agc_test_split.py).

Not built or run beyond configuration: no source file changes, and the registrations are identical.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (no driver code changes; test registrations only, identical to main)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5068508332 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12862). Originally posted by [janzezno](https://github.com/janzezno) on 2026-10-29T13:03:32Z. --- ### What Moves the AGC test registrations out of `core/libs/prx/libSceAgcDriver/CMakeLists.txt` into one fragment per test executable, `tests/cmake/<executable>.cmake`, as agreed in #12521. `CMakeLists.txt` includes the fragments in sorted order after the execution tests are created. A new test, a new mode of an existing test or a property of one then changes one fragment instead of shared lines. Three commits: 1. `tools/agc_test_split.py` and its tests. `refactor` and `split` produce the next two commits; `resolve` moves the registrations of a change made before the split, like `debt_split.py resolve`. 2. `python3 tools/agc_test_split.py refactor`: the three loops that register tests for a list of executables become functions, `agc_add_default_test`, `agc_add_draw_pipeline_test` and `agc_add_spirv_mode_tests`. The execution tests get their default test right after they are created; every other executable calls the function in its own registration. This also removes the long `foreach(agcTest IN ITEMS ...)` and `set(agcDrawPipelineTests ...)` lines that pull requests append to. 3. `python3 tools/agc_test_split.py split`: 279 fragments; `CMakeLists.txt` goes from 4506 to 909 lines. A statement moves with the executable whose targets or tests it changes; statements that write the same variable move together; a loop over several executables and anything that reads every registered test stays in `CMakeLists.txt`. A test name built from a variable (`set_tests_properties(agc_pad_status_overlay_${padStatusName} ...)`) moves with the one executable whose tests share its literal prefix; when the prefix matches tests of several executables, `split` stops with an error instead of leaving the statement before the fragments. Fragments that share a statement are merged into the fragment of the larger executable: 3 fragments hold 8 executables, from statements like one `set_target_properties` over four overlay executables. Comment lines are not carried into fragments; one two-line comment, before `agc_driver_vertex_clip_cull_draw_no_key`, is dropped. The commit also adds the `resolve` rule to CONTRIBUTING.md. The fragment commit is generated, so it can be regenerated from the `main` it lands on: `git checkout main -- core/libs/prx/libSceAgcDriver/CMakeLists.txt`, delete `tests/cmake`, run `refactor` and `split` again. After the split, a pull request whose `CMakeLists.txt` change conflicts runs `python3 tools/agc_test_split.py resolve` during the stopped rebase; the rule is in CONTRIBUTING.md, after "Keep the branch up to date". Regenerated on `main` ca073ec3ad. Since 73f4f7e06e the file only gained #9696's `agc_driver_target_address_window` block, which is now its own fragment. The `resolve` results under Tested are from 73f4f7e06e, where 191 other open pull requests changed the file. Merge order with #11566 (agreed with B-Howell): #11566 is still open, so this goes first and #11566 moves its registration with `resolve`, which gives exactly the split of the merge (below). Merge order with #14084 (agreed with Amoenus): this goes first and #14084 moves its `agc_driver_native_depth_initial_owner` registration with `resolve`. Checked on ca073ec3ad with #14084 at b582949003: `resolve` puts it in `agc_driver_native_multisample_depth_tests.cmake` with no conflict, and every file is identical to the split of the merge. ### Tested Arch Linux, CMake 4.4.5, Ninja 1.13.2, GCC 16.2.1. Registration: configured `main` 0f302813ce and this branch regenerated on it with the same options (the branch's diff is byte-identical on ca073ec3ad, which only adds #13671 in `libSceNpWebApi`) and compared every test's command and properties (`ctest --show-only=json-v1`, source and build directory paths normalized) and the targets in `build.ninja` (`ninja -t targets all`). In each configuration below the only differences are the new `agc_test_split` test and the 279 fragment files `build.ninja` lists as configure inputs. In the first configuration the build commands (`ninja -t commands all`, 6634) are identical too. | Configuration | Tests on `main` | |---|---| | `BUILD_TESTING=ON` | 3062 | | `BUILD_TESTING=ON`, `ANYPS5_ENABLE_SPIRV_TOOLS=ON` | 3074 | | `BUILD_TESTING=ON`, `AGC_BUILD_VISUAL_TEST=ON` | 3062 | | `BUILD_TESTING=ON`, `ANYPS5_ENABLE_ASAN=ON` | 3061 | | `BUILD_TESTING=ON`, `APS5_ENABLE_TRACY=ON` | 3062 | | `BUILD_TESTING=ON`, `ANYPS5_AGC_EXECUTION_TESTS=PooledBufferRange` | 3062 | | `BUILD_TESTING=ON`, `ANYPS5_AGC_EXECUTION_TESTS=PooledBufferRange;CommittedReadMapping` | 3062 | | `BUILD_TESTING=ON`, `ANYPS5_RELINKER_CLI=OFF` | 2853 | | `BUILD_TESTING=ON`, `ANYPS5_RUN_QUARANTINED_FRAME_REPLAY=ON` | 3062 | | `BUILD_TESTING=ON`, `CMAKE_CXX_COMPILER_LAUNCHER=ccache` | 3062 | | `BUILD_TESTING=OFF` | 0 (targets only) | | `set(WIN32 ON)` at the top of the AGC `CMakeLists.txt` | 3112 | | `set(WIN32 ON)` and `set(MINGW ON)`, with a stand-in `anyps5_windows_test_exit` | 3112 | The `WIN32`/`MINGW` rows only run the Windows branches of this directory on Linux. A Windows (MSYS2) comparison is still open; I can't run one, so a run on Windows (`ctest -N` and `ctest --show-only=json-v1` on `main` and this branch) would close it. Rebase script, `resolve`: - The last 150 commits on `main` 73f4f7e06e that changed the file: applying each one's change to the split of its parent gives exactly the split of the commit, with no conflicts, 150 of 150. - The 191 other open pull requests that changed the file on `main` 73f4f7e06e, before this regeneration: all 153 that merge cleanly today give exactly the split of that merge, #11566 among them; 5 that conflict today apply without a conflict; 17 conflict both ways, 16 of them in one fragment each (10 in the recorder tests, 4 in the native multisample depth tests, 1 each in the shader memory and graphics tests) and #5925 in `CMakeLists.txt` and three fragments; 16 leave the file unchanged. `python3 -m unittest tools/tests/test_agc_test_split.py`: 15 tests pass. `python3 tools/check_test_registration.py` on the configured branch: 1632 test executables, none built and not run, as on `main`; `--scripts`: 231 test scripts, each run (230 on `main`, plus `test_agc_test_split.py`). Not built or run beyond configuration: no source file changes, and the registrations are identical. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (no driver code changes; test registrations only, identical to `main`) - [x] AI-assisted: yes
adriadam10 commented 2026-10-31 17:24:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-31T17:24:27Z.

Review: CHANGES_REQUESTED


  • The branch conflicts with main: core/libs/prx/libSceAgcDriver/CMakeLists.txt changed 5 times after 73f4f7e06e. The last two commits are generated, so please regenerate them from current main (git checkout main -- core/libs/prx/libSceAgcDriver/CMakeLists.txt, delete tests/cmake, refactor, split) and re-run the ctest --show-only=json-v1 comparison on the new base.
  • The body says CONTRIBUTING has the rule for python3 tools/agc_test_split.py resolve during a stopped rebase, but the PR does not touch CONTRIBUTING.md (the debt_split.py resolve rule at line 78 is the model). Add it there, otherwise authors of the other open PRs have no way to learn it.
  • Still open from the PR: the Windows (MSYS2) registration comparison; a run on Windows would close it.

The tooling itself looks fine; with these addressed it can go to the merge queue.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724043584 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12862#pullrequestreview-5724043584). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-31T17:24:27Z. **Review:** CHANGES_REQUESTED --- - The branch conflicts with `main`: `core/libs/prx/libSceAgcDriver/CMakeLists.txt` changed 5 times after `73f4f7e06e`. The last two commits are generated, so please regenerate them from current `main` (`git checkout main -- core/libs/prx/libSceAgcDriver/CMakeLists.txt`, delete `tests/cmake`, `refactor`, `split`) and re-run the `ctest --show-only=json-v1` comparison on the new base. - The body says CONTRIBUTING has the rule for `python3 tools/agc_test_split.py resolve` during a stopped rebase, but the PR does not touch `CONTRIBUTING.md` (the `debt_split.py resolve` rule at line 78 is the model). Add it there, otherwise authors of the other open PRs have no way to learn it. - Still open from the PR: the Windows (MSYS2) registration comparison; a run on Windows would close it. The tooling itself looks fine; with these addressed it can go to the merge queue.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!12862
No description provided.