fix(tests): stage linked .prx runtime files next to test executables on Windows #7645

Merged
akkadbakkad89 merged 4 commits from upstream-pr/7645 into main 2026-11-09 13:16:37 +00:00
akkadbakkad89 commented 2026-10-18 19:21:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-18T19:21:09Z.


What

add_test_executable gains a POST_BUILD step that copies $<TARGET_RUNTIME_DLLS> next to the test exe on Windows. The step is gated on CMAKE_VERSION >= 3.21 (the generator expression's floor) so the declared cmake_minimum_required(VERSION 3.20) keeps configuring; on <3.21 the step is absent and the existing per-test ENVIRONMENT_MODIFICATION PATH prepends apply unchanged (note the prepend property itself is a 3.22 feature that ctest silently ignores on 3.20-3.21, so this widens rather than narrows the working range; the loader trap below 3.22 predates this PR). The executable directory outranks PATH in the DLL search order, so a test whose registration forgot the ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>" boilerplate still resolves libc.prx/libkernel.prx/libSceAgcDriver.prx at load - instead of spawning a modal "entry point not found" (0xC0000139) dialog that blocks until ctest reports a timeout.

The prepend is manual per-test boilerplate repeated across ~95 CMakeLists files; new registrations keep missing it (live instance fixed in #7627's agc_driver_depth_bounds_state). With staging, no registration needs it, future omissions stop mattering, and hand-running a test exe works with no environment setup. Existing ENVIRONMENT_MODIFICATION lines stay harmless for every exe that does not opt out.

Twenty-one test executables opt out with the new NO_RUNTIME_DLL_STAGING argument, in two classes. Class one (guest_dinkumware_fetch_tests, guest_freetype_outline_border_tests, guest_freetype_pfr_tests, guest_freetype_module_properties_tests, guest_freetype_postscript_info_tests, guest_freetype_memory_record_tests, guest_freetype_stream_tests, guest_jxr_lookup_tests, guest_libressl_protocol_tests, guest_floating_prefix_tests, guest_libressl_cmac_patched_tests, guest_libressl_bio_patched_tests) loads patched-vs-unpatched library variants selected by a ${PATCHED_DIR}/UNPATCHED_DIR PATH prepend and by explicit library paths, and asserts the loaded module's on-disk path (std::filesystem::equivalent on the module handle, startup == library). Any fixed copy staged next to the exe would shadow exactly one of the two variants - an unpatched stage breaks the patched variants' asserts and keeps the patched library's NID-shaped imports from resolving against the already-loaded unpatched siblings.

Class two (guest_update_env_tests, guest_raise_except_tests, guest_floating_point_tests, guest_gets_tests, guest_index_tests, guest_fwide_tests, guest_set_env_tests, guest_timed_join_tests, guest_termios_speed_tests) both links the .prx import library and receives the same module as a $<TARGET_FILE:...> argv path. With staging, the exe's import table binds tests\libc.prx/libkernel.prx at startup while LoadLibraryA(unpatched/...) maps a second copy of the same module at a different base - the loader dedups full-path loads by path, not by basename, so the process ends up with two module instances and split per-module state (errno, stdio FILE tables, registered unwind info). guest_gets failed on the stdio split (gets: byte read pointer - the GetProcAddress'd gets ran in the second instance's stdio state), and the fenv tests failed because the second instance's _Unwind_RaiseException never registered the host exe's .ehfram, so a std::invalid_argument thrown across the prx boundary unwound off the top instead of reaching the exe's catch. Opting out restores the single-instance layout their PATH prepends already provided. Every other exe keeps the staging.

Tested

Windows 11, MinGW (WinLibs GCC 15.2.0), Release, RTX 3070 (driver 617.42).

  • Breakage reproduced on the staging-only head (0f5d53553d, before the opt-out): ctest -R guest_dinkumware_fetch 18/18 failed (startup == library / equivalent asserts - the staged tests\libc.prx is neither unpatched/libc.prx nor libs/libc.prx); guest_freetype_outline_border 8/8 failed including the raw variants; guest_freetype_pfr_*_patched 3/3 failed; guest_freetype_module_properties_nid fastfailed (0xc0000409); guest_jxr_lookup_*_patched 3/3 failed at LoadLibraryA - the patched module's NID imports cannot resolve against the staged unpatched libc.prx/libkernel.prx.
  • After the opt-out (a3ea1b93b7, clean tests/ dir - all staged .prx removed first): guest_dinkumware_fetch_* 18/18, guest_freetype_outline_border_* 8/8, guest_freetype_pfr_* 6/6, guest_freetype_module_properties* 2/2, guest_jxr_lookup_* 6/6, guest_libressl_protocol* 2/2 - 42/42 pass. These tests assert the loaded module's path themselves (equivalent, GetModuleHandleW("libc.prx") vs requested/libc.prx, startup == library), so a pass is direct proof the patched libraries are the ones loaded.
  • Staging still functions for non-opt-out exes: guest_posix_scalar_io_tests re-staged libc.prx + libkernel.prx and passed with PATH scrubbed to C:\Windows\System32;C:\Windows.
  • CMake 3.20.5 (real binary, minimal fixture): the un-gated $<TARGET_RUNTIME_DLLS> form fails generation (Expression did not evaluate to a known generator expression); the gated form configures, generates and builds clean.
  • Class-two breakage reproduced on ebecf4e71677 (CI run 41276557688 windows job: 6 fail-fast aborts) and locally: guest_update_env/guest_raise_except/guest_floating_point abort on the guest std::invalid_argument that the exe must catch (unhandled exception 'St16invalid_argument' -> terminate -> 0xc0000409); guest_gets aborts on gets: byte read pointer; guest_timed_join_normal/_coarse abort the same way. A probe exe linking the libc implib then LoadLibraryA(unpatched/libc.prx) reports two distinct module bases (tests\libc.prx + unpatched\libc.prx) - the dual-instance mechanism, confirmed directly.
  • After the class-two opt-out: ctest -R guest_update_env|guest_raise_except|guest_floating_point$|guest_gets$|guest_timed_join|guest_index$|guest_set_env|guest_termios_speed - 42/42 pass on Windows 11 (excludes the three latent exes' own unchanged assertions which now also run single-instance); guest_timed_join_import_libkernel_sys/_web pass from tests/nostage/ (the per-test $<TARGET_FILE_DIR:...> copies/PATH prepends follow the exe automatically).
  • python3 tools/check_conventions.py --base origin/main: clean; git diff --check: clean.

Parallel copies: every staging POST_BUILD copies from the same unpatched/ source file into the shared tests/ dir, so concurrent copies write identical bytes. cmake -E copy_if_different compares first and is a no-op once the destination matches; when two builders race on a first write the destination file is opened non-shared, so the loser gets a sharing violation and the POST_BUILD fails loudly at build time - a transient retryable error, never a torn DLL, and nothing maps the file during the build (tests only run under ctest afterwards).

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: #7637
  • Unblocks: none
  • GPUs tested: n/a (test-infrastructure change; graphics suite run on RTX 3070 / 617.42 / Windows 11 only as a staging check)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4912079243 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-18T19:21:09Z. --- ### What `add_test_executable` gains a POST_BUILD step that copies `$<TARGET_RUNTIME_DLLS>` next to the test exe on Windows. The step is gated on `CMAKE_VERSION >= 3.21` (the generator expression's floor) so the declared `cmake_minimum_required(VERSION 3.20)` keeps configuring; on <3.21 the step is absent and the existing per-test `ENVIRONMENT_MODIFICATION` PATH prepends apply unchanged (note the prepend property itself is a 3.22 feature that ctest silently ignores on 3.20-3.21, so this widens rather than narrows the working range; the loader trap below 3.22 predates this PR). The executable directory outranks PATH in the DLL search order, so a test whose registration forgot the `ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>"` boilerplate still resolves `libc.prx`/`libkernel.prx`/`libSceAgcDriver.prx` at load - instead of spawning a modal "entry point not found" (0xC0000139) dialog that blocks until ctest reports a timeout. The prepend is manual per-test boilerplate repeated across ~95 CMakeLists files; new registrations keep missing it (live instance fixed in #7627's `agc_driver_depth_bounds_state`). With staging, no registration needs it, future omissions stop mattering, and hand-running a test exe works with no environment setup. Existing `ENVIRONMENT_MODIFICATION` lines stay harmless for every exe that does not opt out. Twenty-one test executables opt out with the new `NO_RUNTIME_DLL_STAGING` argument, in two classes. Class one (`guest_dinkumware_fetch_tests`, `guest_freetype_outline_border_tests`, `guest_freetype_pfr_tests`, `guest_freetype_module_properties_tests`, `guest_freetype_postscript_info_tests`, `guest_freetype_memory_record_tests`, `guest_freetype_stream_tests`, `guest_jxr_lookup_tests`, `guest_libressl_protocol_tests`, `guest_floating_prefix_tests`, `guest_libressl_cmac_patched_tests`, `guest_libressl_bio_patched_tests`) loads patched-vs-unpatched library variants selected by a `${PATCHED_DIR}`/`UNPATCHED_DIR` PATH prepend and by explicit library paths, and asserts the loaded module's on-disk path (`std::filesystem::equivalent` on the module handle, `startup == library`). Any fixed copy staged next to the exe would shadow exactly one of the two variants - an unpatched stage breaks the patched variants' asserts and keeps the patched library's NID-shaped imports from resolving against the already-loaded unpatched siblings. Class two (`guest_update_env_tests`, `guest_raise_except_tests`, `guest_floating_point_tests`, `guest_gets_tests`, `guest_index_tests`, `guest_fwide_tests`, `guest_set_env_tests`, `guest_timed_join_tests`, `guest_termios_speed_tests`) both links the `.prx` import library and receives the same module as a `$<TARGET_FILE:...>` argv path. With staging, the exe's import table binds `tests\libc.prx`/`libkernel.prx` at startup while `LoadLibraryA(unpatched/...)` maps a second copy of the same module at a different base - the loader dedups full-path loads by path, not by basename, so the process ends up with two module instances and split per-module state (errno, stdio FILE tables, registered unwind info). `guest_gets` failed on the stdio split (`gets: byte read pointer` - the GetProcAddress'd `gets` ran in the second instance's stdio state), and the fenv tests failed because the second instance's `_Unwind_RaiseException` never registered the host exe's `.ehfram`, so a `std::invalid_argument` thrown across the prx boundary unwound off the top instead of reaching the exe's `catch`. Opting out restores the single-instance layout their PATH prepends already provided. Every other exe keeps the staging. ### Tested Windows 11, MinGW (WinLibs GCC 15.2.0), Release, RTX 3070 (driver 617.42). - Breakage reproduced on the staging-only head (`0f5d53553d`, before the opt-out): `ctest -R guest_dinkumware_fetch` 18/18 failed (`startup == library` / `equivalent` asserts - the staged `tests\libc.prx` is neither `unpatched/libc.prx` nor `libs/libc.prx`); `guest_freetype_outline_border` 8/8 failed including the raw variants; `guest_freetype_pfr_*_patched` 3/3 failed; `guest_freetype_module_properties_nid` fastfailed (0xc0000409); `guest_jxr_lookup_*_patched` 3/3 failed at `LoadLibraryA` - the patched module's NID imports cannot resolve against the staged unpatched `libc.prx`/`libkernel.prx`. - After the opt-out (`a3ea1b93b7`, clean `tests/` dir - all staged `.prx` removed first): `guest_dinkumware_fetch_*` 18/18, `guest_freetype_outline_border_*` 8/8, `guest_freetype_pfr_*` 6/6, `guest_freetype_module_properties*` 2/2, `guest_jxr_lookup_*` 6/6, `guest_libressl_protocol*` 2/2 - **42/42 pass**. These tests assert the loaded module's path themselves (`equivalent`, `GetModuleHandleW("libc.prx")` vs `requested/libc.prx`, `startup == library`), so a pass is direct proof the patched libraries are the ones loaded. - Staging still functions for non-opt-out exes: `guest_posix_scalar_io_tests` re-staged `libc.prx` + `libkernel.prx` and passed with `PATH` scrubbed to `C:\Windows\System32;C:\Windows`. - CMake 3.20.5 (real binary, minimal fixture): the un-gated `$<TARGET_RUNTIME_DLLS>` form fails generation (`Expression did not evaluate to a known generator expression`); the gated form configures, generates and builds clean. - Class-two breakage reproduced on `ebecf4e71677` (CI run 41276557688 `windows` job: 6 fail-fast aborts) and locally: `guest_update_env`/`guest_raise_except`/`guest_floating_point` abort on the guest `std::invalid_argument` that the exe must catch (`unhandled exception 'St16invalid_argument'` -> terminate -> 0xc0000409); `guest_gets` aborts on `gets: byte read pointer`; `guest_timed_join_normal`/`_coarse` abort the same way. A probe exe linking the `libc` implib then `LoadLibraryA(unpatched/libc.prx)` reports two distinct module bases (`tests\libc.prx` + `unpatched\libc.prx`) - the dual-instance mechanism, confirmed directly. - After the class-two opt-out: `ctest -R guest_update_env|guest_raise_except|guest_floating_point$|guest_gets$|guest_timed_join|guest_index$|guest_set_env|guest_termios_speed` - **42/42 pass** on Windows 11 (excludes the three latent exes' own unchanged assertions which now also run single-instance); `guest_timed_join_import_libkernel_sys`/`_web` pass from `tests/nostage/` (the per-test `$<TARGET_FILE_DIR:...>` copies/PATH prepends follow the exe automatically). - `python3 tools/check_conventions.py --base origin/main`: clean; `git diff --check`: clean. Parallel copies: every staging POST_BUILD copies from the same `unpatched/` source file into the shared `tests/` dir, so concurrent copies write identical bytes. `cmake -E copy_if_different` compares first and is a no-op once the destination matches; when two builders race on a first write the destination file is opened non-shared, so the loser gets a sharing violation and the POST_BUILD fails loudly at build time - a transient retryable error, never a torn DLL, and nothing maps the file during the build (tests only run under ctest afterwards). ### 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: #7637 - [x] Unblocks: none - [x] GPUs tested: n/a (test-infrastructure change; graphics suite run on RTX 3070 / 617.42 / Windows 11 only as a staging check) - [x] AI-assisted: yes
MarcZX10 commented 2026-10-18 19:22:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T19:22:49Z.


I rechecked the submitted diff against the cross-target reproduction from #7637. The PR currently still uses cmake -E copy -t "$<TARGET_FILE_DIR:${target}>" $<TARGET_RUNTIME_DLLS:${target}>. With COMMAND_EXPAND_LISTS, CMake 3.25.1 expands this to copy -t <exe-dir> file1.prx file2.prx file3.prx, which fails: Target (for copy command) ".../file3.prx" is not a directory. I reproduced it with one and three MinGW Windows runtime targets. The tested working form is cmake -E copy_if_different $<TARGET_RUNTIME_DLLS:${target}> "$<TARGET_FILE_DIR:${target}>/" (also with COMMAND_EXPAND_LISTS); it generated the expected copy command and staged all three files next to the exe in the cross-target fixture. Please update the post-build command; the current Windows run in the PR description may have used a different command than the submitted one.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254104465 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#issuecomment-6254104465). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T19:22:49Z. --- I rechecked the submitted diff against the cross-target reproduction from #7637. The PR currently still uses `cmake -E copy -t "$<TARGET_FILE_DIR:${target}>" $<TARGET_RUNTIME_DLLS:${target}>`. With `COMMAND_EXPAND_LISTS`, CMake 3.25.1 expands this to `copy -t <exe-dir> file1.prx file2.prx file3.prx`, which fails: `Target (for copy command) ".../file3.prx" is not a directory`. I reproduced it with one and three MinGW Windows runtime targets. The tested working form is `cmake -E copy_if_different $<TARGET_RUNTIME_DLLS:${target}> "$<TARGET_FILE_DIR:${target}>/"` (also with `COMMAND_EXPAND_LISTS`); it generated the expected copy command and staged all three files next to the exe in the cross-target fixture. Please update the post-build command; the current Windows run in the PR description may have used a different command than the submitted one.
MarcZX10 commented 2026-10-18 19:23:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T19:23:01Z.


One more edge case from the same cross-target: a test target with no linked runtime DLLs also fails in the submitted form. TARGET_RUNTIME_DLLS expands empty, leaving cmake -E copy -t <exe-dir>; CMake 3.25.1 exits with Error copying file "-t" to ".../build-win". Please guard the post-build command when the list is empty, or use a helper that conditionally stages only nonempty lists. The copy_if_different correction above handles the multi-file case when the list is nonempty; it also needs the empty-list guard.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254106691 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#issuecomment-6254106691). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T19:23:01Z. --- One more edge case from the same cross-target: a test target with no linked runtime DLLs also fails in the submitted form. `TARGET_RUNTIME_DLLS` expands empty, leaving `cmake -E copy -t <exe-dir>`; CMake 3.25.1 exits with `Error copying file "-t" to ".../build-win"`. Please guard the post-build command when the list is empty, or use a helper that conditionally stages only nonempty lists. The `copy_if_different` correction above handles the multi-file case when the list is nonempty; it also needs the empty-list guard.
MarcZX10 commented 2026-10-18 19:25:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T19:25:32Z.


I tested the updated copy_if_different form from the current head d2fbfd9 in the same MinGW Windows cross-target fixture. With three linked .prx targets, the generated command now copies all three alongside the executable and succeeds. A no-runtime-DLL test also builds successfully; including $<TARGET_FILE:${target}> keeps the command nonempty, and CMake handles copying that file to its existing output directory. This closes both failures I reported in the submitted command. The hosted windows app-build lane is still skipped, so this is focused cross-target validation, not a full project Windows build.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254132312 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#issuecomment-6254132312). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T19:25:32Z. --- I tested the updated `copy_if_different` form from the current head `d2fbfd9` in the same MinGW Windows cross-target fixture. With three linked `.prx` targets, the generated command now copies all three alongside the executable and succeeds. A no-runtime-DLL test also builds successfully; including `$<TARGET_FILE:${target}>` keeps the command nonempty, and CMake handles copying that file to its existing output directory. This closes both failures I reported in the submitted command. The hosted `windows` app-build lane is still skipped, so this is focused cross-target validation, not a full project Windows build.
akkadbakkad89 commented 2026-10-18 19:27:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-18T19:27:07Z.


Thanks for the fast re-verification on the 3.25.1 cross-target - good that the copy_if_different form plus the $<TARGET_FILE> guard closes both the multi-file and empty-list cases. Confirmed locally on cmake 4.4.4 as well: full graphics suite passes with PATH scrubbed, 14/14 on the ctest sweep including nid_buffer_validation (the no-DLL case). Current head d2fbfd925 carries exactly the command you validated.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254148243 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#issuecomment-6254148243). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-18T19:27:07Z. --- Thanks for the fast re-verification on the 3.25.1 cross-target - good that the `copy_if_different` form plus the `$<TARGET_FILE>` guard closes both the multi-file and empty-list cases. Confirmed locally on cmake 4.4.4 as well: full graphics suite passes with PATH scrubbed, 14/14 on the ctest sweep including `nid_buffer_validation` (the no-DLL case). Current head `d2fbfd925` carries exactly the command you validated.
MarcZX10 commented 2026-10-18 19:51:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T19:51:20Z.

Review: COMMENTED


One compatibility issue to resolve before merging: the root CMakeLists.txt declares cmake_minimum_required(VERSION 3.20), but $<TARGET_RUNTIME_DLLS:...> was added in CMake 3.21 (CMake 3.21 release notes). On Windows with CMake 3.20 this generator expression is evaluated during generation and is unknown, so the newly added if(WIN32) command can make configuration fail for a version the project currently claims to support. Could you either preserve 3.20 compatibility (for example, gate an alternate staging path by CMake version) or raise the project minimum to 3.21 and update the documented/tooling requirement? The current CMake 4.4.4 validation does not cover the declared minimum.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5564674432 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#pullrequestreview-5564674432). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T19:51:20Z. **Review:** COMMENTED --- One compatibility issue to resolve before merging: the root `CMakeLists.txt` declares `cmake_minimum_required(VERSION 3.20)`, but `$<TARGET_RUNTIME_DLLS:...>` was added in CMake 3.21 ([CMake 3.21 release notes](https://cmake.org/cmake/help/latest/release/3.21.html)). On Windows with CMake 3.20 this generator expression is evaluated during generation and is unknown, so the newly added `if(WIN32)` command can make configuration fail for a version the project currently claims to support. Could you either preserve 3.20 compatibility (for example, gate an alternate staging path by CMake version) or raise the project minimum to 3.21 and update the documented/tooling requirement? The current CMake 4.4.4 validation does not cover the declared minimum.
akkadbakkad89 commented 2026-10-18 19:56:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-18T19:56:15Z.


Overlap bot report checked: all 13 shared-file PRs touch CMakeLists.txt regions unrelated to add_test_executable (lines 11-25). Closest: #7642 edits request_serializer_tests includes at ~line 92, #7039 adjusts a TIMEOUT at ~line 173, #3998 calls add_test_executable for a new test (benefits from the staging automatically). No real overlap.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254435913 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#issuecomment-6254435913). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-18T19:56:15Z. --- Overlap bot report checked: all 13 shared-file PRs touch `CMakeLists.txt` regions unrelated to `add_test_executable` (lines 11-25). Closest: #7642 edits `request_serializer_tests` includes at ~line 92, #7039 adjusts a `TIMEOUT` at ~line 173, #3998 calls `add_test_executable` for a new test (benefits from the staging automatically). No real overlap.
MarcZX10 commented 2026-10-18 20:09:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T20:09:13Z.

Review: COMMENTED


Thanks for checking the real CMake 3.20.5 behavior; the version gate correctly avoids the unknown-generator-expression failure. One remaining scope point: on 3.20 the staging command is disabled, so a test registration without the manual PATH prepend can still hit the same loader dialog, and direct-running the exe still lacks the new guarantee. Could you either add a 3.20-compatible staging fallback, or state that this general protection applies only with CMake >=3.21 (and retain the per-test PATH setup as required below that)? The current reported CMake 3.20 validation proves configuration/build, not the no-PATH runtime behavior.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5564734398 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#pullrequestreview-5564734398). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T20:09:13Z. **Review:** COMMENTED --- Thanks for checking the real CMake 3.20.5 behavior; the version gate correctly avoids the unknown-generator-expression failure. One remaining scope point: on 3.20 the staging command is disabled, so a test registration without the manual PATH prepend can still hit the same loader dialog, and direct-running the exe still lacks the new guarantee. Could you either add a 3.20-compatible staging fallback, or state that this general protection applies only with CMake >=3.21 (and retain the per-test PATH setup as required below that)? The current reported CMake 3.20 validation proves configuration/build, not the no-PATH runtime behavior.
akkadbakkad89 commented 2026-10-18 20:09:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-18T20:09:15Z.


Good catch — fixed in ee69ac6d0 by gating the staging step on the generator expression's floor:

if(WIN32 AND NOT CMAKE_VERSION VERSION_LESS 3.21)
    add_custom_command(TARGET ${target} POST_BUILD ...)
endif()

Chose the gate over bumping the minimum so this fix stays scoped. On <3.21 the command is never created, so the unknown genex can't fail generation — and the per-test ENVIRONMENT_MODIFICATION PATH prepends still apply, so behavior there is exactly today's.

Verified against a real CMake 3.20.5 binary (PyPI wheel) with a minimal fixture replicating the pattern:

  • Un-gated form: generation fails with $<TARGET_RUNTIME_DLLS:...> — Expression did not evaluate to a known generator expression (reproduces the failure you predicted on the declared floor).
  • Gated form: configures, generates and builds clean on 3.20.5.
  • Regression-checked on CMake 4.4.4 + MinGW: reconfigured, relinked agc_driver_graphics_tests, all three .prx files staged into tests/, and the suite still passes with PATH scrubbed to System32.

Side note for context, not pushback: the repo already relies on ENVIRONMENT_MODIFICATION (3.22) in ~92 registrations, so the de-facto floor for working tests is higher than 3.20 — but those fail silently at runtime rather than breaking generation, so the gate is still the right call here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254568142 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#issuecomment-6254568142). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-18T20:09:15Z. --- Good catch — fixed in `ee69ac6d0` by gating the staging step on the generator expression's floor: ```cmake if(WIN32 AND NOT CMAKE_VERSION VERSION_LESS 3.21) add_custom_command(TARGET ${target} POST_BUILD ...) endif() ``` Chose the gate over bumping the minimum so this fix stays scoped. On <3.21 the command is never created, so the unknown genex can't fail generation — and the per-test `ENVIRONMENT_MODIFICATION` PATH prepends still apply, so behavior there is exactly today's. Verified against a real CMake 3.20.5 binary (PyPI wheel) with a minimal fixture replicating the pattern: - Un-gated form: generation fails with `$<TARGET_RUNTIME_DLLS:...>` — `Expression did not evaluate to a known generator expression` (reproduces the failure you predicted on the declared floor). - Gated form: configures, generates and builds clean on 3.20.5. - Regression-checked on CMake 4.4.4 + MinGW: reconfigured, relinked `agc_driver_graphics_tests`, all three `.prx` files staged into `tests/`, and the suite still passes with `PATH` scrubbed to System32. Side note for context, not pushback: the repo already relies on `ENVIRONMENT_MODIFICATION` (3.22) in ~92 registrations, so the de-facto floor for working tests is higher than 3.20 — but those fail silently at runtime rather than breaking generation, so the gate is still the right call here.
MarcZX10 commented 2026-10-18 20:14:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T20:14:45Z.

Review: APPROVED


The current head addresses the CMake 3.20 generator-expression failure by gating the staging command at 3.21, and the updated body clearly records that the existing per-test PATH setup remains in effect below that version. The reported MinGW staging checks cover linked and no-runtime-DLL targets, and the current conventions, relinker platform, and ASan checks pass. I approve this focused test-infrastructure change.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5564752623 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#pullrequestreview-5564752623). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T20:14:45Z. **Review:** APPROVED --- The current head addresses the CMake 3.20 generator-expression failure by gating the staging command at 3.21, and the updated body clearly records that the existing per-test PATH setup remains in effect below that version. The reported MinGW staging checks cover linked and no-runtime-DLL targets, and the current conventions, relinker platform, and ASan checks pass. I approve this focused test-infrastructure change.
akkadbakkad89 commented 2026-10-18 20:15:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-18T20:15:26Z.


Fair point — taken the second option and scoped the claim in the PR body: staging applies on CMAKE_VERSION >= 3.21; below that, behavior is byte-for-byte today's.

One nuance worth noting on the fallback side: ENVIRONMENT_MODIFICATION is itself a CMake 3.22 feature, so on 3.20–3.21 ctest accepts the per-test PATH=path_list_prepend:... lines but silently ignores them — meaning .prx-importing tests already hit this loader trap on those versions today, prepend or no prepend. The gate therefore can't regress anything: 3.20 keeps exactly its current (already-broken-for-ctest) behavior, while 3.21 actually gains protection the prepend could never deliver there.

A true 3.20 fallback would need copy_directory of the whole unpatched dir per exe — a second code path staging ~all prx rather than the linked set — to benefit a toolchain where ctest can't honor the existing registrations anyway. Happy to add it if you'd rather have that, but the scoped claim seemed the honest fit given the prepend is a no-op below 3.22 regardless.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254629866 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#issuecomment-6254629866). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-18T20:15:26Z. --- Fair point — taken the second option and scoped the claim in the PR body: staging applies on `CMAKE_VERSION >= 3.21`; below that, behavior is byte-for-byte today's. One nuance worth noting on the fallback side: `ENVIRONMENT_MODIFICATION` is itself a CMake **3.22** feature, so on 3.20–3.21 ctest accepts the per-test `PATH=path_list_prepend:...` lines but silently ignores them — meaning `.prx`-importing tests already hit this loader trap on those versions *today*, prepend or no prepend. The gate therefore can't regress anything: 3.20 keeps exactly its current (already-broken-for-ctest) behavior, while 3.21 actually *gains* protection the prepend could never deliver there. A true 3.20 fallback would need `copy_directory` of the whole unpatched dir per exe — a second code path staging ~all prx rather than the linked set — to benefit a toolchain where ctest can't honor the existing registrations anyway. Happy to add it if you'd rather have that, but the scoped claim seemed the honest fit given the prepend is a no-op below 3.22 regardless.
Neithennn commented 2026-10-19 10:35:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Neithennn on 2026-10-19T10:35:28Z.


Full-suite Windows run, to cover every test executable now that each one gets the staging step (the description lists a 14-test sweep).

Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), WinLibs GCC 15.2.0 r7, CMake from WinLibs, Ninja, Release, bundled dependencies, BUILD_TESTING=ON, ANYPS5_NO_SHADER_CACHE=1. Head ee69ac6d0 merged onto main 36f60df9e; the full build succeeds and stages 108 .prx files in build/tests/.

  • Full ctest -j 8 --timeout 120: 1629/1631. The two failures are shader_cache_runtime_sources and hardware_oracle_compare, both hitting my 120 s limit under parallel load; alone on this tree they pass 3/3 each (55 to 58 s and 11 s). On unchanged main the same run gave 1631/1631, with shader_cache_runtime_sources at 79 s, so that one is close to the limit either way.
  • Targeted, with ANYPS5_REQUIRE_VULKAN=1: agc_driver_graphics, agc_write_tracking, agc_import_watch, agc_import_watch_other_family, guest_kernel_sys, nid_buffer_validation: pass.

I did not repeat the scrubbed-PATH direct run.

AI-assisted: yes (runs done with Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6265237743 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#issuecomment-6265237743). Originally posted by [Neithennn](https://github.com/Neithennn) on 2026-10-19T10:35:28Z. --- Full-suite Windows run, to cover every test executable now that each one gets the staging step (the description lists a 14-test sweep). Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), WinLibs GCC 15.2.0 r7, CMake from WinLibs, Ninja, Release, bundled dependencies, `BUILD_TESTING=ON`, `ANYPS5_NO_SHADER_CACHE=1`. Head `ee69ac6d0` merged onto main `36f60df9e`; the full build succeeds and stages 108 `.prx` files in `build/tests/`. - Full `ctest -j 8 --timeout 120`: 1629/1631. The two failures are `shader_cache_runtime_sources` and `hardware_oracle_compare`, both hitting my 120 s limit under parallel load; alone on this tree they pass 3/3 each (55 to 58 s and 11 s). On unchanged main the same run gave 1631/1631, with `shader_cache_runtime_sources` at 79 s, so that one is close to the limit either way. - Targeted, with `ANYPS5_REQUIRE_VULKAN=1`: `agc_driver_graphics`, `agc_write_tracking`, `agc_import_watch`, `agc_import_watch_other_family`, `guest_kernel_sys`, `nid_buffer_validation`: pass. I did not repeat the scrubbed-`PATH` direct run. AI-assisted: yes (runs done with Claude Code).
THEMANnt commented 2026-10-25 04:04:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-25T04:04:55Z.

Review: APPROVED


Reviewed ee69ac6d0e6f1fb9a08c9a6d9790b12d35da6985 against 8d17389a73852ee0e462c640589b47d49c68e8d6. No actionable findings in this focused review.

Source review: Inspected the complete helper change and its existing runtime output/wrapped-main setup. Windows CMake 3.21+ stages linked runtime dependencies beside the test. COMMAND_EXPAND_LISTS preserves the DLL list, VERBATIM handles paths, and including the executable itself keeps copy_if_different valid when the dependency list is empty. Older CMake and non-Windows behavior are unchanged.

Validation: Windows, CMake 4.3.1 / MinGW GCC 15.2: a disposable project using the exact head helper and WindowsTestExit source built a shared .prx plus linked and standalone tests in directories containing spaces. Both head executables ran with exit 0; the linked .prx was staged. The same baseline fixture built but did not stage that file. Conventions and whitespace passed. This older script-registration CLI rejects --scripts; no registration pass is claimed. Effective hosted relinker matrix and ASan succeeded; full-product jobs were skipped.

Scope: Actual bounded CMake/build/runtime fixture; full AnyPS5 libraries and all test targets were not rebuilt locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5641427399 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7645#pullrequestreview-5641427399). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-25T04:04:55Z. **Review:** APPROVED --- Reviewed `ee69ac6d0e6f1fb9a08c9a6d9790b12d35da6985` against `8d17389a73852ee0e462c640589b47d49c68e8d6`. No actionable findings in this focused review. **Source review:** Inspected the complete helper change and its existing runtime output/wrapped-main setup. Windows CMake 3.21+ stages linked runtime dependencies beside the test. COMMAND_EXPAND_LISTS preserves the DLL list, VERBATIM handles paths, and including the executable itself keeps copy_if_different valid when the dependency list is empty. Older CMake and non-Windows behavior are unchanged. **Validation:** Windows, CMake 4.3.1 / MinGW GCC 15.2: a disposable project using the exact head helper and WindowsTestExit source built a shared .prx plus linked and standalone tests in directories containing spaces. Both head executables ran with exit 0; the linked .prx was staged. The same baseline fixture built but did not stage that file. Conventions and whitespace passed. This older script-registration CLI rejects --scripts; no registration pass is claimed. Effective hosted relinker matrix and ASan succeeded; full-product jobs were skipped. **Scope:** Actual bounded CMake/build/runtime fixture; full AnyPS5 libraries and all test targets were not rebuilt locally.
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!7645
No description provided.