test(net): make resolver failures deterministic #9636

Merged
MarcZX10 merged 1 commit from upstream-pr/9636 into main 2026-10-22 19:36:46 +00:00
MarcZX10 commented 2026-10-22 05:37:18 +00:00 (Migrated from github.com)

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


What

Adds a scoped resolver lookup override for guest_sce_net tests and uses it for the four negative forward-resolution cases. Those checks no longer depend on external DNS latency. The production resolver continues to use getaddrinfo unless the in-process test explicitly installs the override. The failure cases assert that output buffers remain unchanged and that resolver errors are recorded; the existing abort-state checks remain in place.

Tested

  • Linux: both changed C++ translation units passed c++ -std=c++20 -fsyntax-only -I core/libs after the review correction.
  • Built libSceNet/Export.cpp as a temporary shared library and ran a focused harness for all four negative lookup entry points, output-sentinel preservation, resolver error state, and abort-state behavior; passed. The harness supplied stubs for unrelated host-service symbols.
  • python3 tools/check_conventions.py --base upstream/main --head HEAD passed after rebasing on current main.
  • python3 tools/pr_overlap.py --branch codex/test-net-deterministic-resolver-failure found no shared exports or behavior. It reported an uncomparable Export.cpp hunk with #8254; manual inspection confirms its added thread include and this PR’s resolver hook are independent. I asked #8254’s author to confirm merge ordering. Several older conflicted PR branches also could not be compared automatically.
  • Full guest_sce_net CTest was not run locally: CMake configuration stops because SDL2Config.cmake is unavailable. An independent Linux reviewer reported guest_sce_net passing 3/3 on the prior head. No Windows run.

Checklist

  • Based on current main; no other open pull request 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: #9609
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4962662500 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9636). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T05:37:18Z. --- ### What Adds a scoped resolver lookup override for `guest_sce_net` tests and uses it for the four negative forward-resolution cases. Those checks no longer depend on external DNS latency. The production resolver continues to use `getaddrinfo` unless the in-process test explicitly installs the override. The failure cases assert that output buffers remain unchanged and that resolver errors are recorded; the existing abort-state checks remain in place. ### Tested - Linux: both changed C++ translation units passed `c++ -std=c++20 -fsyntax-only -I core/libs` after the review correction. - Built `libSceNet/Export.cpp` as a temporary shared library and ran a focused harness for all four negative lookup entry points, output-sentinel preservation, resolver error state, and abort-state behavior; passed. The harness supplied stubs for unrelated host-service symbols. - `python3 tools/check_conventions.py --base upstream/main --head HEAD` passed after rebasing on current `main`. - `python3 tools/pr_overlap.py --branch codex/test-net-deterministic-resolver-failure` found no shared exports or behavior. It reported an uncomparable `Export.cpp` hunk with #8254; manual inspection confirms its added thread include and this PR’s resolver hook are independent. I asked #8254’s author to confirm merge ordering. Several older conflicted PR branches also could not be compared automatically. - Full `guest_sce_net` CTest was not run locally: CMake configuration stops because SDL2Config.cmake is unavailable. An independent Linux reviewer reported `guest_sce_net` passing 3/3 on the prior head. No Windows run. ### Checklist - [x] Based on current `main`; no other open pull request 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: #9609 - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
jotitadev commented 2026-10-22 07:09:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T07:09:21Z.

Review: COMMENTED


Full guest_sce_net run on Linux, since the description says CTest could not be configured. I also checked that the slow-DNS timeout from #9609 goes away.

Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release, BUILD_TESTING=ON, full build. Head 548aecf03 merged --no-commit onto main d6eafa54d (clean).

  • With the PR: guest_sce_net passes, 3 of 3 runs, in about 1.2 s.
  • I reproduced #9609 on Linux with an LD_PRELOAD shim that delays host getaddrinfo by 11 s for names containing .invalid (the Winsock latency from the issue):
    • main: the shim fires three times (guest-sce-net.invalid. twice, guest-sce-net.invalid once). A direct run takes 34 s, and under CTest it is ***Timeout 20.02 sec.
    • PR: the shim never fires, and the run takes 1 s, exit 0.
  • One coverage note: the sceNetResolverStartNtoa6(resolver, "127.0.0.1", ...) case now also runs under FailResolverLookup. That lookup is an IPv4 literal for an IPv6 query, and on main it never reaches DNS. Logging every host getaddrinfo call during the run, 127.0.0.1 with AF_INET6 returns EAI_ADDRFAMILY in 0.002 ms on glibc. So it never depended on DNS latency, at least on Linux. Wrapping it means the test no longer checks that the real lookup path rejects a family mismatch. It might be worth leaving that one on the real path.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5610450556 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9636#pullrequestreview-5610450556). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-22T07:09:21Z. **Review:** COMMENTED --- Full `guest_sce_net` run on Linux, since the description says CTest could not be configured. I also checked that the slow-DNS timeout from #9609 goes away. Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release, `BUILD_TESTING=ON`, full build. Head `548aecf03` merged `--no-commit` onto `main` `d6eafa54d` (clean). - With the PR: `guest_sce_net` passes, 3 of 3 runs, in about 1.2 s. - I reproduced #9609 on Linux with an `LD_PRELOAD` shim that delays host `getaddrinfo` by 11 s for names containing `.invalid` (the Winsock latency from the issue): - `main`: the shim fires three times (`guest-sce-net.invalid.` twice, `guest-sce-net.invalid` once). A direct run takes 34 s, and under CTest it is `***Timeout 20.02 sec`. - PR: the shim never fires, and the run takes 1 s, exit 0. - One coverage note: the `sceNetResolverStartNtoa6(resolver, "127.0.0.1", ...)` case now also runs under `FailResolverLookup`. That lookup is an IPv4 literal for an IPv6 query, and on `main` it never reaches DNS. Logging every host `getaddrinfo` call during the run, `127.0.0.1` with `AF_INET6` returns `EAI_ADDRFAMILY` in 0.002 ms on glibc. So it never depended on DNS latency, at least on Linux. Wrapping it means the test no longer checks that the real lookup path rejects a family mismatch. It might be worth leaving that one on the real path. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
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!9636
No description provided.