fix(tests): refresh staged test libraries when a library is rebuilt #17895
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17895"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by adam25136 on 2026-11-09T21:05:12Z.
What
Since #7645, a Windows test executable loads the
.prxfiles staged next to it inbuild/tests/, which its POST_BUILD step copies only when the executable relinks. The libraries undercore/libskeep their import library unchanged unless their exports change (the<TARGET_IMPLIB>.newlink rule incore/libs/CMakeLists.txt), so a change inside a library relinks no test executable and its staged copy keeps the old library. Windows loads a DLL from the executable's folder beforePATH, so a local test of a library change runs the old code, and can pass. Before #7645 the tests loaded the library just built throughPATH.With
BUILD_TESTING,configure_windows_unwindnow also runscmake/RefreshStagedRuntime.cmakefor shared libraries, after its unwind section rename. Whentests/<library>exists and differs from the finished library, it is replaced. If the copy fails (a running test holding the file), the build only warns, and that copy stays old until the library is rebuilt again; this path is read from the code, not tested. The script adds no file totests/, never touchestests/nostage, and skips a library built intotests/itself (job_manager_reference.prx).configure_windows_unwindis called in each library's own directory, which a POST_BUILD command needs, and its step is the last one that writes the library: 406 of the 407 libraries incore/libs/libs/unpatchedhave it, and so do 10 test fixture libraries outside it. The other,libSceAgcVsh, does not call it, and no test stages it.From
build.ninja, not measured: an executable that stages a library links only after that library's build step, which ends with the refresh, so the refresh never overlaps an executable's copy of the same file.The first build after this change relinks every library that has the step (415 relinked here;
job_manager_reference.prxwas not part of that build), because its POST_BUILD command changed, and so replaces copies that are already stale. The same relink without the refresh (its condition set toFALSE) left 207 stale copies.Not addressed: the parallel staging copies into the shared
tests/can fail ("Error copying file"), as JJenkx measured on #8043. One full rebuild with an earlier version of this change, after a branch switch, hit it once in an executable's own copy; rerunning the build completed it.Tested
Windows 10 Pro 22H2 (19045), i9-12900KF, NVIDIA GeForce RTX 5080 (driver 621.14), WinLibs GCC 15.2.0 r7, CMake 4.3.1, Ninja, Release,
BUILD_TESTING=ON, onmain6719b01bf3.agc_driver_indirect_arguments_pending_producer_testsandlibs, replaces any stale staged copy so it starts clean, changes only the text of libSceAgcDriver'sSelected GPUlog line, rebuilds the same two targets, and runs that test withctest -V. Each time, 8 objects compile and the test executable is not relinked.main:tests/libSceAgcDriver.prxdiffers from the library just built, and the test prints the oldSelected GPU name=line and passes.FALSE): the copy differs and the test prints the old line, as onmain.main's full suite (4,852 tests) and this change merged onto it (4,852, the whole suite selected), withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1: both fail onlyagc_driver_quad_pixel_mask(#14237) and time outguest_kernel_sys_paths_symlinkatandguest_kernel_sys_paths_symlinkat_patched, and the same 14 tests skip on both.mainand none with this change. Aftermain's validation build, which relinked one library (libSceJson2), it found one; after this change's validation build, which relinked five, it found none.^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu, withVK_LAYER_KHRONOS_validation: noVUID-line on either side, the same 61 warnings in the same 14 tests, and onlyagc_driver_quad_pixel_maskfailing on both.python tools/check_conventions.py --base origin/mainwith this title and description passes, and so doespython tools/check_test_registration.py build.mainf439f7f3a0before opening (head84ba66c37f,ef38cc1210rebased); none of the 95 commits since6719b01bf3touchesCMakeLists.txt,core/libs/CMakeLists.txtorcmake/, and the script above gives the same result there with this change.tools/pr_overlap.py --branch(in a full clone, 1,939 open pull requests): 50 share a file with this branch, and none of those it compared conflicts. The patches ofcore/libs/CMakeLists.txtof the 15 it could not compare contain no line ofconfigure_windows_unwind's body, not even as context.Not covered: Linux and macOS (the change is inside
if(MINGW)), generators other than Ninja, and a CMake older than 3.21, where the refresh is skipped as the staging is.Related: #7645, #8043 (plokmklo) and JJenkx's comments on it.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code