Skip to content

test(libs): load every patched library with its imports bound - #1828

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
LeandroLP23:test/patched-libraries-load
Oct 9, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
LeandroLP23:test/patched-libraries-load

Conversation

@LeandroLP23

Copy link
Copy Markdown
Contributor

What

Closes #1827. patched_libraries loads each .prx in build/core/libs/libs, with LoadLibraryEx(LOAD_WITH_ALTERED_SEARCH_PATH) on Windows and dlopen(RTLD_NOW | RTLD_LOCAL) on Linux. It prints each library that fails to load and fails the test if any does.

  • The test depends on the libs target, so the patched files are current even when only the default target is built. CI already builds libs before ctest.
  • It doesn't link libc. With MinGW it is linked statically and built with -fasynchronous-unwind-tables, as nid_patcher and savedata_memory_metadata_tests are, so the unpatched libc.prx isn't already in the process under the same name when the patched libraries bind to theirs.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, Release:

  • main 4b6ab6b: passes, 122 patched libraries loaded, 0 failed, 0.25 s.
  • main + feat(posix): implement mkstemp and isatty #1613: fails with libScePosixForWebKit.prx: LoadLibraryEx failed with error 127, 121 patched libraries loaded, 1 failed.
  • tools/check_test_registration.py and tools/check_conventions.py pass.

Linux: fork CI run https://github.com/LeandroLP23/AnyPS5/actions/runs/37838975025: all jobs pass, patched_libraries included (the failing case was checked on Windows only).

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 in TechnicalDebt
  • 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
  • AI-assisted: yes (Claude Code)

@MarcZX10

MarcZX10 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Current-main check: head 942433e is based on merge base 4b6ab6b and diverges from upstream main aa277b3 (1 commit ahead, 2 behind). CONTRIBUTING requires PRs to be based on current main; please rebase now so the queued Linux/Windows checks validate the final head.

@LeandroLP23

Copy link
Copy Markdown
Contributor Author

Rebased onto main aa277b3; the only new commits there are the CI change from #1821.

@MarcZX10

MarcZX10 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

The full current-head Build and Conventions checks are green. One current-main follow-up: this head is 11 commits behind main (94b1eecb; merge base aa277b38). CONTRIBUTING asks branches to stay up to date; please rebase and rerun checks on the final head. The CMake overlap with #1627/#1686 remains visible in the overlap report, so resolve any actual conflict without duplicating their scope.

@LeandroLP23
LeandroLP23 force-pushed the test/patched-libraries-load branch from 2db5c0b to 89a8080 Compare October 8, 2026 21:56
@LeandroLP23

Copy link
Copy Markdown
Contributor Author

Rebased onto main 94b1eec; no conflicts.

@LeandroLP23

Copy link
Copy Markdown
Contributor Author

The Windows failure is guest_font_writing_line (reserve the guest arena range: Attempt to access invalid address, 0xc0000409), which this PR doesn't touch; patched_libraries passed. It doesn't reproduce here in 30 serial and 10 parallel runs on main ae91d97, so it looks like an intermittent arena reservation failure on the runner. Could someone re-run the job?

@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

I checked whether I can rerun the failed Windows job. My repository permissions are pull-only, so GitHub does not let me rerun Actions on this upstream PR. The failure report is specific to guest_font_writing_line arena reservation (0xc0000409); the PR-specific patched_libraries test passed, per the author. Could an authorized maintainer rerun the failed Windows job so we can confirm whether it was transient?

@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

I reviewed the full two-file diff and current checks. The Linux job is green, and your report says patched_libraries passed on Windows; the current Windows failure is guest_font_writing_line, outside this change, and I previously asked for a maintainer rerun. Since that rebase, upstream main has moved to f1451396; the current PR head is 17 commits behind and 1 ahead. CONTRIBUTING asks branches to stay current, so please rebase onto current main and rerun both platform jobs before merge. I have not approved this head while it is stale and its Windows check is red.

ctest loads the libraries from libs/unpatched, so an import that nid_patcher
renames out of another library's exports only shows when a title loads the
patched prx. patched_libraries loads each patched .prx with LoadLibraryEx on
Windows and dlopen(RTLD_NOW) on Linux, and depends on the libs target so the
patched files are current.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

ctest loads the unpatched libraries, so an import that nid_patcher renames only fails when a title loads the patched prx

3 participants