test(net): make resolver failures deterministic #9636
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9636"
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 MarcZX10 on 2026-10-22T05:37:18Z.
What
Adds a scoped resolver lookup override for
guest_sce_nettests and uses it for the four negative forward-resolution cases. Those checks no longer depend on external DNS latency. The production resolver continues to usegetaddrinfounless 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
c++ -std=c++20 -fsyntax-only -I core/libsafter the review correction.libSceNet/Export.cppas 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 HEADpassed after rebasing on currentmain.python3 tools/pr_overlap.py --branch codex/test-net-deterministic-resolver-failurefound no shared exports or behavior. It reported an uncomparableExport.cpphunk 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.guest_sce_netCTest was not run locally: CMake configuration stops because SDL2Config.cmake is unavailable. An independent Linux reviewer reportedguest_sce_netpassing 3/3 on the prior head. No Windows run.Checklist
main; no other open pull request 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)Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T07:09:21Z.
Review: COMMENTED
Full
guest_sce_netrun 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. Head548aecf03merged--no-commitontomaind6eafa54d(clean).guest_sce_netpasses, 3 of 3 runs, in about 1.2 s.LD_PRELOADshim that delays hostgetaddrinfoby 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.invalidonce). A direct run takes 34 s, and under CTest it is***Timeout 20.02 sec.sceNetResolverStartNtoa6(resolver, "127.0.0.1", ...)case now also runs underFailResolverLookup. That lookup is an IPv4 literal for an IPv6 query, and onmainit never reaches DNS. Logging every hostgetaddrinfocall during the run,127.0.0.1withAF_INET6returnsEAI_ADDRFAMILYin 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.