Skip to content

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

Merged
oneandonlydean merged 4 commits into
boykopovar:mainfrom
akkadbakkad89:fix/test-prx-dll-staging
Nov 9, 2026
Merged

oneandonlydean merged 4 commits into
boykopovar:mainfrom
akkadbakkad89:fix/test-prx-dll-staging

Conversation

@akkadbakkad89

@akkadbakkad89 akkadbakkad89 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

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: Windows: tests whose exe imports a .prx hang under ctest when the registration lacks the unpatched-dir PATH prepend #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

@MarcZX10

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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.

@akkadbakkad89
akkadbakkad89 force-pushed the fix/test-prx-dll-staging branch from 8ee1664 to d2fbfd9 Compare October 18, 2026 19:24
@MarcZX10

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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.

@github-actions github-actions Bot added the build label Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 17014 core/libs/prx/libSceAvPlayer/CMakeLists.txt L73
PR 17452 core/libs/CMakeLists.txt L1437-1438
PR 17471 core/libs/CMakeLists.txt L1437-1438
PR 17494 core/libs/CMakeLists.txt L1437-1438
PR 17516 core/libs/CMakeLists.txt L1437-1438

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1835 CMakeLists.txt
PR 4563 core/libs/prx/libkernel/CMakeLists.txt
PR 5021 CMakeLists.txt
core/libs/CMakeLists.txt
core/libs/prx/libc/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
PR 6149 core/libs/prx/libkernel/CMakeLists.txt
PR 6936 core/libs/prx/libkernel/CMakeLists.txt
PR 7275 core/libs/CMakeLists.txt
PR 7447 core/libs/prx/libc/CMakeLists.txt
PR 7642 CMakeLists.txt
PR 7715 core/libs/prx/libc/CMakeLists.txt
PR 8150 core/libs/prx/libc/CMakeLists.txt
PR 8650 core/libs/CMakeLists.txt
PR 8965 core/libs/prx/libc/CMakeLists.txt
PR 9156 core/libs/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
PR 9162 core/libs/CMakeLists.txt
PR 9293 core/libs/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
PR 9297 core/libs/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
PR 9302 core/libs/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
PR 9383 core/libs/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
PR 9389 core/libs/prx/libkernel/CMakeLists.txt
PR 9466 core/libs/prx/libc/CMakeLists.txt
PR 9557 core/libs/prx/libkernel/CMakeLists.txt
PR 9566 core/libs/prx/libkernel/CMakeLists.txt
PR 9938 core/libs/prx/libkernel/CMakeLists.txt
PR 10193 CMakeLists.txt
PR 10897 CMakeLists.txt
PR 11896 core/libs/prx/libkernel/CMakeLists.txt
PR 12315 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 12544 core/libs/prx/libkernel/CMakeLists.txt
PR 12642 core/libs/CMakeLists.txt
PR 12682 core/libs/prx/libc/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
PR 12688 core/libs/prx/libc/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
PR 12700 core/libs/prx/libc/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
PR 12717 core/libs/prx/libc/CMakeLists.txt
PR 12849 core/libs/prx/libc/CMakeLists.txt
PR 12965 core/libs/prx/libc/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
PR 13449 core/libs/prx/libc/CMakeLists.txt
PR 13578 CMakeLists.txt
PR 13928 CMakeLists.txt
PR 13929 CMakeLists.txt
PR 14212 CMakeLists.txt
PR 14298 core/libs/prx/libc/CMakeLists.txt
PR 14465 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 14890 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15052 core/libs/prx/libSceFreeTypeOt/CMakeLists.txt
PR 15095 core/libs/prx/libc/CMakeLists.txt
core/libs/prx/libkernel/CMakeLists.txt
PR 15111 core/libs/CMakeLists.txt
PR 15514 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15544 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15591 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15616 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15618 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15620 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15622 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15623 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15625 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15627 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15628 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15629 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 15645 core/libs/prx/libSceJxr/CMakeLists.txt
PR 15646 core/libs/prx/libSceJxr/CMakeLists.txt
PR 15772 core/libs/prx/libSceJxr/CMakeLists.txt
PR 15774 core/libs/prx/libSceJxr/CMakeLists.txt
PR 15807 CMakeLists.txt
core/libs/CMakeLists.txt
core/libs/prx/libc/CMakeLists.txt
PR 15831 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 16121 core/libs/prx/libSceFreeTypeOt/CMakeLists.txt
PR 16122 core/libs/prx/libSceFreeTypeOt/CMakeLists.txt
PR 16372 core/libs/prx/libkernel/CMakeLists.txt
PR 16441 core/libs/prx/libkernel/CMakeLists.txt
PR 16507 CMakeLists.txt
PR 16529 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 16535 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 16538 CMakeLists.txt
PR 16689 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 16708 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 16819 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 16918 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 16971 CMakeLists.txt
PR 16978 core/libs/prx/libSceFreeTypeOt/CMakeLists.txt
PR 17124 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17235 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17236 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17237 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17238 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17240 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17241 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17242 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17243 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17246 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17249 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17250 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17528 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17544 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17557 core/libs/prx/libc/CMakeLists.txt
PR 17558 CMakeLists.txt
core/libs/prx/libc/CMakeLists.txt
PR 17572 core/libs/prx/libSceFreeTypeOt/CMakeLists.txt
PR 17580 core/libs/prx/libSceFreeTypeOt/CMakeLists.txt
PR 17621 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17622 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17626 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
PR 17715 core/libs/prx/libSceFreeTypeOt/CMakeLists.txt

@github-actions github-actions Bot added the fix error Closes an issue (Fixes #N) label Oct 18, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@akkadbakkad89

akkadbakkad89 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

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.

@akkadbakkad89
akkadbakkad89 force-pushed the fix/test-prx-dll-staging branch from d2fbfd9 to ee69ac6 Compare October 18, 2026 20:08

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

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.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor

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 THEMANnt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@akkadbakkad89 thanks for this. One concern before it can go in: the exe directory is searched before PATH, and the files this stages are the unpatched build outputs. Several tests deliberately put ${PATCHED_DIR} on PATH (core/libs/CMakeLists.txt:322, libSceFreeType, libSceFreeTypeOl, libSceJxr, libSceLibreSsl), so with this change they could load the unpatched DLLs instead. Could you run those on Windows with this change (full ctest on a clean build) and show they still load the patched libraries? Also, how are parallel copies of the same DLL into the shared test directory kept safe when tests build in parallel?

@akkadbakkad89
akkadbakkad89 force-pushed the fix/test-prx-dll-staging branch from ee69ac6 to a3ea1b9 Compare October 28, 2026 05:27
@akkadbakkad89

Copy link
Copy Markdown
Contributor Author

@oneandonlydean Confirmed the concern on the previous head, then fixed it - a3ea1b93b7 rebases onto current main and adds a NO_RUNTIME_DLL_STAGING opt-out to add_test_executable, applied to the six dual-variant test executables: guest_dinkumware_fetch_tests, guest_freetype_outline_border_tests, guest_freetype_pfr_tests, guest_freetype_module_properties_tests, guest_jxr_lookup_tests, guest_libressl_protocol_tests.

Before the fix, on the staging-only head: guest_dinkumware_fetch 18/18 failed (the harness asserts startup == library and filesystem::equivalent on the loaded module path - the staged tests\libc.prx is neither variant's expected path), guest_freetype_outline_border 8/8 failed even in the raw variants, guest_freetype_pfr_*_patched 3/3, guest_freetype_module_properties_nid fastfailed, guest_jxr_lookup_*_patched 3/3 failed inside LoadLibraryA - the patched module's NID-shaped imports cannot resolve against the already-loaded unpatched libc.prx/libkernel.prx. So both failure modes you described are real: the exe-dir stage shadows ${PATCHED_DIR} on PATH, and it also poisons dependency binding for patched modules.

After the opt-out, with tests/ cleaned of every staged .prx first: 42/42 affected tests pass - and since these tests assert the loaded module's on-disk path themselves, a pass is direct proof the patched libraries are the ones loaded. Opt-out is the right shape rather than staging the patched twin, because these exes run both variants and no single static copy can satisfy both; their PATH boilerplate is load-bearing, not vestigial. Non-variant exes keep the staging (verified guest_posix_scalar_io_tests re-stages libc.prx/libkernel.prx and runs with PATH scrubbed).

Parallel copies: every POST_BUILD copies the same unpatched/ source into the shared dir, so racing copies carry identical bytes. copy_if_different compares first and becomes a no-op once the destination matches; on a first-write race the destination opens non-shared, so the loser fails the POST_BUILD loudly at build time - transient and retryable, never a torn file - and no test process maps the directory contents while the build is running.

@akkadbakkad89

Copy link
Copy Markdown
Contributor Author

You called it — the shadowing was real, and NO_RUNTIME_DLL_STAGING alone did not fix it. Verified on a clean Windows/MinGW build of the previous head:

  • guest_jxr_lookup_patched failed with JXR lookup: load requested library (same for the FreeType outline-border/PFR patched variants).
  • tests/libc.prx is byte-identical to core/libs/libs/unpatched/libc.prx — $<TARGET_RUNTIME_DLLS> yields the link-time (unpatched) outputs, and the loader searches the executable directory ahead of PATH, so patched-variant tests resolved unpatched dependencies even though they themselves opted out. The staged copies arrive from other targets into the shared tests/ dir, so per-target opt-out could not keep the dir clean.

Fix in b54f34da: NO_RUNTIME_DLL_STAGING executables now build into tests/nostage instead, so their executable directory contains nothing but the exe and PATH resolution keeps its intended precedence (${PATCHED_DIR} prepend wins). Staged targets are unaffected — their .prx/runtime DLLs still land in tests/.

Tested on native Windows 11 + MinGW after a full -j8 build (3,423 steps):

  • guest_jxr_lookup* — 7/7 (incl. all 3 _patched variants)
  • guest_freetype_outline_border* — 9/9, guest_freetype_pfr* — 8/8
  • guest_dinkumware* — 20/20
  • Sweep over the touched patterns (jxr/freetype/dinkumware/libressl/entitlements/json/kernel_sys/nid/pe_import/acm/posix/rudp/np_): 168/168 pass

On parallel copies into the shared dir: the full -j8 build ran the staging POST_BUILD for ~150 targets concurrently with no copy failures. copy_if_different makes every same-name copy a no-op for all writers after the first, and the staged DLLs are identical per name, so the only residual hazard is a first-build collision while one copy is still in flight — that would surface as a build error, not a corrupt file. If you'd like belt-and-braces I can switch the staging to a single dedicated target that test exes depend on instead of per-target POST_BUILDs.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@akkadbakkad89 thanks for chasing that down; building the opted-out tests into tests/nostage fixes the shadowing for the six targets you listed (reviewed at b54f34daf7). A few more tests put ${PATCHED_DIR} on PATH and still build into the shared tests/ directory, so their patched variants would pick up the staged unpatched libc.prx too:

  • guest_floating_prefix_tests (core/libs/tests/floating_prefix/CMakeLists.txt, the _patched tests), on this head;
  • guest_freetype_postscript_info_tests (libSceFreeType/PostScriptInfo.cmake) and guest_freetype_stream_tests (libSceFreeTypeOt/Stream.cmake), which landed on main after your base.

Could you merge main, add NO_RUNTIME_DLL_STAGING to those three, and rerun the patched variants on Windows? Since every new patched test will need the flag, a configure-time check would help: fail if a test that prepends ${PATCHED_DIR} to PATH runs an executable that is staged. Or use the single staging target you offered, if it keeps tests/ free of staged copies for those tests.

@akkadbakkad89

Copy link
Copy Markdown
Contributor Author

Rebased onto b11c7bf84f5d — upstream's own test-timeout hardening landed in libSceAvPlayer/CMakeLists.txt and conflicted with this PR's bumps. Resolution keeps the larger values where they overlapped (avplayer_http_transport 30 vs upstream's 20, since the observed ~11s runtime on a loaded runner can still exceed 20s) and preserves upstream's new TIMEOUT/RUN_SERIAL test registrations untouched. mergeable is clean again and CI is re-running.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 4, 2026
@akkadbakkad89

Copy link
Copy Markdown
Contributor Author

The Windows failure on bada3085 was a real gap in this PR, now fixed at 74190fc5.

guest_libressl_cmac_patched and guest_libressl_bio_patched aborted with 0xc0000409 during "Build and run changed guest core/libs tests". Both are newer upstream registrations I missed in the opt-out sweep - their patched exes (guest_libressl_cmac_patched_tests, guest_libressl_bio_patched_tests) sit in tests/ where the staging step drops unpatched libc.prx/libkernel.prx, so the executable-directory copies shadowed the PATH=path_list_prepend:${PATCHED_DIR} override and the patched .prx never loaded. NO_RUNTIME_DLL_STAGING moves them to tests/nostage/, same treatment as the other nine patched-variant exes.

Re-audited every PATH=path_list_prepend:${PATCHED_DIR} site on current main against the opt-out list - all seven registrations are now covered (Cmac, MemoryBio, ProtocolSelection, MemoryRecord, ModuleProperties, PostScriptInfo, Stream), and the nine dual-instance class-two exes stay as before.

The Windows relinker job also timed out on check_main_sync at ~30s. That test does not load staged libraries - it exercises the relinker CLI end-to-end - so the staging change cannot cause it; the job hit the test's timeout ceiling under runner load. Happy to bump that test's timeout separately if it recurs on the retriggered run.

@akkadbakkad89

akkadbakkad89 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Verified locally on 74190fc5 (Windows 11, WinLibs GCC 15.2.0, Release): guest_libressl_cmac_patched_tests.exe / guest_libressl_bio_patched_tests.exe now link into tests/nostage/ and all four tests pass - guest_libressl_cmac + guest_libressl_cmac_patched, guest_libressl_bio + guest_libressl_bio_patched, plus guest_libressl_protocol / _nid still green on the earlier opt-out.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 74190fc merged onto main 4639eff · tested 2026-11-05 06:30 UTC · 24 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 3,874 passed · 18 failed (0 new, 11 also fail on main, 7 unstable on main) · 70 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Vulkan validation ✅ no new validation IDs vs main (1414 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 121.9 s, ⚠️ agc_driver_graphics 120.2 s, ⚠️ agc_driver_graphics_maps_fallback 120.1 s, ⚠️ public_headers 70.1 s, ⚠️ agc_driver_bda_device 55.6 s
Unstable on main (7, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_alpha_to_coverage_sample_mask_export: failed in 6 of the last 10 main runs
agc_driver_array_layer_target_cpu: failed in 2 of the last 10 main runs
agc_driver_graphics: failed in 3 of the last 10 main runs
agc_driver_graphics_maps_fallback: failed in 2 of the last 10 main runs
agc_driver_job_manager_compute_capacity: failed in 8 of the last 10 main runs
agc_driver_pipeline_journal: failed in 9 of the last 10 main runs
agc_driver_two_sample_alpha_to_coverage_sample_mask_export: failed in 4 of the last 10 main runs
Failing on main too (11, not counted against this PR)
agc_driver_guest_memory_lifetime_direct
agc_driver_image_table
agc_driver_native_depth_bda_clear
agc_driver_native_depth_buffer_clear
agc_driver_native_depth_clears
agc_driver_native_multisample_depth
agc_driver_submit_progress
agc_submit_progress
agc_submit_progress_no_timeline
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (4 IDs in 812 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (812 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_draw_space_reuse, agc_driver_address_draw_space_reuse_held, agc_driver_address_draw_space_reuse_off, agc_driver_address_draw_space_reuse_transitions, agc_driver_address_draw_space_reuse_verify, agc_driver_address_passes, and 804 more
VUID-vkCmdCopyImage-srcImage-01548 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store_image_copy, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_partially_unmapped_plane, agc_driver_depth_plane_unmapped_plane, and 3 more
VUID-vkCmdCopyImage-srcImage-01551 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store_image_copy, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_partially_unmapped_plane, agc_driver_depth_plane_unmapped_plane, and 3 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
Skipped (70)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_copied_writer_label_order_drain: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_float16_unused_nan_payloads: skipped, the device has no native f16 conversions with RTE rounding and kept f16 denormals
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_image_table_vouched_lookups: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a watched imported table cannot be vouched for
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
agc_driver_ngg_vertex_wave_reduction: skipped, s3 describes a 32-lane wave only on 32-lane subgroups, and the device has 64 lanes
agc_driver_recorded_draw_staging: skipped, the device does not keep host imports write-watched, so the target is never resident
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_driver_unit_shadow_budget: skipped, the device does not import watched host memory for unit shadows
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_idle_publish_wait: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a forced watch of the import reads its submissions as CPU stores
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_shadowed_key_stores: skipped, the device imports no watched host memory under a unit shadow
agc_small_tiled_shadow_label: skipped, host imports are unavailable: the test block is not imported and watched
agc_storage_clear_hand_over: skipped, the device imports no watched host memory for the clear-key hand-over
agc_storage_pending_key_refresh: skipped, refreshes over a pending key store are not testable here
agc_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_net_ctl_disconnected: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_disabled: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_four_k: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECO
Reproduce
git fetch origin 74190fc579d045c984f8ab1fd77a8f2106bb77e0 4639eff7f4c23325a916875a0e37f1e312fa18f4
git checkout 4639eff7f4c23325a916875a0e37f1e312fa18f4 && git merge --no-ff 74190fc579d045c984f8ab1fd77a8f2106bb77e0
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@JJenkx

JJenkx commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

A real-world check of this change on Windows (WinLibs GCC 15.2 UCRT, Release). The newly opened #17627 adds audio_out_output_device, which links libc without the usual if(WIN32) PATH=path_list_prepend:$<TARGET_FILE_DIR:libc> property:

So this removes the need for that per-test property, which new PRs keep missing: in the last day #17261, #17259 and #17555 to #17558 hit the same 0xc0000135. #8043 covers the same ground and gives the same result in the same check.

AI-assisted: yes.

@JJenkx

JJenkx commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Correction and caveat to my comment above: with this PR there's also a regression on Windows. It stages the unpatched libc.prx into build/tests/, next to the test executables. Windows searches the executable's folder before PATH, so tests that load the patched modules from core/libs/libs then pick up the unpatched libc.prx instead. Example: guest_legacy_freetype_metadata_nid runs guest_legacy_freetype_metadata_tests.exe <libs>/libfreetype.prx <libs>/libSceFreeType.prx patched, and the patched libfreetype.prx imports NID names such as QuRm8bUpMP0 from libc.prx, which the unpatched copy doesn't export:

  • main d03beaf110: guest_legacy_freetype_metadata and _nid pass in 3 of 3 runs.
  • main + this PR (dc99182f7e): _nid fails with LoadLibraryW failed: 127, and the staged tests/libc.prx is present.

So staging needs to leave out the modules that these patched-path tests load from libs/, or those tests need the patched directory searched first (for example LoadLibraryExW with LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS instead of the test's plain LoadLibraryW). I only checked this one test. A full Windows run with this PR would show any others that load patched modules.

AI-assisted: yes.

akkadbakkad89 and others added 4 commits November 9, 2026 18:09
…on Windows

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…mits

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ntime staging

guest_legacy_freetype_metadata_tests, guest_freetype_postscript_private_tests, guest_freetype_stroker_outputs_tests, guest_freetype_ot_tests, guest_freetype_ot_outline_tests, guest_libressl3_ecdsa_sig_tests, guest_libressl3_rsa_getters_tests, guest_kernel_process_exports_tests and guest_kernel_resident_fmem_export_tests each register a patched variant that prepends PATCHED_DIR on PATH, so their staged unpatched libc.prx shadows dependency resolution for the patched modules they load.
@akkadbakkad89
akkadbakkad89 force-pushed the fix/test-prx-dll-staging branch from 8f82309 to 02c30d7 Compare November 9, 2026 12:39
@akkadbakkad89

Copy link
Copy Markdown
Contributor Author

@JJenkx Confirmed and fixed — your report was right. Windows resolves an imported .prx from the executable's directory before consulting PATH, so the staged unpatched libc.prx next to tests/ executables shadowed ${PATCHED_DIR}'s patched module for every test that registers a PATH=path_list_prepend:${PATCHED_DIR} variant, producing the LoadLibraryW failed: 127 you saw on guest_legacy_freetype_metadata_nid.

The branch is rebased onto current main (af8088a1d3) and I swept all 22 path_list_prepend:${PATCHED_DIR} registrations: nine more executables needed NO_RUNTIME_DLL_STAGING beyond the earlier set — guest_legacy_freetype_metadata_tests, guest_freetype_postscript_private_tests, guest_freetype_stroker_outputs_tests, guest_freetype_ot_tests, guest_freetype_ot_outline_tests, guest_libressl3_ecdsa_sig_tests, guest_libressl3_rsa_getters_tests, guest_kernel_process_exports_tests, guest_kernel_resident_fmem_export_tests. They now build into tests/nostage/ with only the compiler runtimes copied beside them, so nothing unpatched can shadow the staged PATH dirs.

Verified on this machine (Windows, MinGW GCC 15.2.0): guest_legacy_freetype_metadata_nid passes again, and 20/24 of the affected tests pass under ctest. The 4 remaining failures (guest_kernel_process_exports{,_patched}, guest_kernel_resident_fmem_export{,_patched}) are pre-existing on a staging-free tree — the statically linked exes load libkernel.prx via LOAD_WITH_ALTERED_SEARCH_PATH, which never searches tests/, so MinGW runtimes are unreachable without the toolchain on PATH; additionally the unpatched libkernel.prx genuinely lacks sceKernelGetResidentFmemCount. Both are unrelated to this change.

Head 02c30d70e506.

@oneandonlydean
oneandonlydean merged commit 9d3b86b into boykopovar:main Nov 9, 2026
21 checks passed
@adam25136

Copy link
Copy Markdown
Contributor

A staged copy goes stale after a change inside a library: the POST_BUILD copy runs only when the test executable relinks, and the libraries under core/libs keep their import library unchanged unless their exports change (the <TARGET_IMPLIB>.new link rule in core/libs/CMakeLists.txt), so such a change relinks no test executable. The test then loads the old copy from tests/, so a local test of a library change can run, and pass, on the old library.

Measured on main 6719b01bf3 (Windows 10 22H2, WinLibs GCC 15.2.0 r7, CMake 4.3.1, Ninja, Release, BUILD_TESTING=ON; test run with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1). Before the change, tests/libSceAgcDriver.prx matched the built library; a script first replaced 7 copies that were already stale in this reused build tree. After changing only the text of libSceAgcDriver's Selected GPU log line, rebuilding agc_driver_indirect_arguments_pending_producer_tests and libs relinked four libraries, libSceAgcDriver.prx among them, and no test executable. tests/libSceAgcDriver.prx then differed from the library just built, and the test printed the old Selected GPU name= line and passed.

To reproduce (the test needs a Vulkan GPU):

cmake --build build --target agc_driver_indirect_arguments_pending_producer_tests libs
# change only the "Selected GPU name=" text in core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
cmake --build build --target agc_driver_indirect_arguments_pending_producer_tests libs
ctest --test-dir build -R "^agc_driver_indirect_arguments_pending_producer$" -V
# expected: the old "Selected GPU name=" line, and "differ" from this:
cmake -E compare_files build/tests/libSceAgcDriver.prx build/core/libs/libs/unpatched/libSceAgcDriver.prx || echo differ

#17895 adds a step to the POST_BUILD of each library that calls configure_windows_unwind: when tests/<library> exists and differs from the library just built, it is replaced. It adds no file to tests/ and does not touch tests/nostage. With it, the same steps leave the staged copy identical to the built library, and the test prints the new line.

Not covered here: Linux and macOS, which this staging does not apply to, and generators other than Ninja.

AI-assisted: yes. Claude Code ran the builds and the test and drafted this comment; a separate review agent checked it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: tests whose exe imports a .prx hang under ctest when the registration lacks the unpatched-dir PATH prepend

9 participants