test(libSceNet): skip IPv6 datagram receive cases without an IPv6 loopback #7847

Merged
MarrasFederico merged 1 commit from upstream-pr/7847 into main 2026-10-19 16:54:19 +00:00
MarrasFederico commented 2026-10-19 10:41:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarrasFederico on 2026-10-19T10:41:12Z.


What

guest_datagram_recv, guest_datagram_recvfrom, guest_datagram_sceNetRecv and guest_datagram_sceNetRecvfrom fail with bind loopback sockets on a Linux host whose kernel has IPv6 but whose loopback has it disabled (net.ipv6.conf.lo.disable_ipv6=1, so ::1 is not assigned). There the IPv6 socket is created and bind to ::1 fails with EADDRNOTAVAIL, which the test treats as a failure.

The test now skips its IPv6 case when socket creation fails with EAFNOSUPPORT (47) or the bind to ::1 fails with EADDRNOTAVAIL (49), through __error or sceNetErrnoLoc depending on the API under test. This is the same rule GuestUdp.cpp and GuestSocketPortZero.cpp already use, and the same host condition #2820 fixed for guest_sce_net. The IPv4 case and the IPv6 case on hosts with a usable ::1 are unchanged.

Tested

Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release, full build with BUILD_TESTING=ON.

  • Host with disable_ipv6=1 on lo: on main the four guest_datagram_* tests fail with bind loopback sockets; with this change they pass. strace shows the IPv4 binds succeed and the IPv6 bind returns EADDRNOTAVAIL, after which the case is skipped.
  • Network namespace with IPv6 on lo (unshare -rn, ::1 assigned): all four pass, and strace shows the IPv6 sockets are bound to ::1 and receive the datagrams, so the IPv6 case still runs where it can.
  • guest_udp, guest_socket_port_zero and guest_sce_net give the same results as on main.
  • Full ctest on main c74aeb2f4 on this host (RTX 5060 Ti, NVIDIA 595.99.02): 1583 of 1589 passed; the four guest_datagram_* tests were the only failures that also failed when run alone.
  • tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py lists #6044, which only moves this file to tests/networking/ without changing its content.

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: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4919674156 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7847). Originally posted by [MarrasFederico](https://github.com/MarrasFederico) on 2026-10-19T10:41:12Z. --- ### What `guest_datagram_recv`, `guest_datagram_recvfrom`, `guest_datagram_sceNetRecv` and `guest_datagram_sceNetRecvfrom` fail with `bind loopback sockets` on a Linux host whose kernel has IPv6 but whose loopback has it disabled (`net.ipv6.conf.lo.disable_ipv6=1`, so `::1` is not assigned). There the IPv6 socket is created and `bind` to `::1` fails with `EADDRNOTAVAIL`, which the test treats as a failure. The test now skips its IPv6 case when socket creation fails with `EAFNOSUPPORT` (47) or the bind to `::1` fails with `EADDRNOTAVAIL` (49), through `__error` or `sceNetErrnoLoc` depending on the API under test. This is the same rule `GuestUdp.cpp` and `GuestSocketPortZero.cpp` already use, and the same host condition #2820 fixed for `guest_sce_net`. The IPv4 case and the IPv6 case on hosts with a usable `::1` are unchanged. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release, full build with `BUILD_TESTING=ON`. - Host with `disable_ipv6=1` on `lo`: on `main` the four `guest_datagram_*` tests fail with `bind loopback sockets`; with this change they pass. `strace` shows the IPv4 binds succeed and the IPv6 bind returns `EADDRNOTAVAIL`, after which the case is skipped. - Network namespace with IPv6 on `lo` (`unshare -rn`, `::1` assigned): all four pass, and `strace` shows the IPv6 sockets are bound to `::1` and receive the datagrams, so the IPv6 case still runs where it can. - `guest_udp`, `guest_socket_port_zero` and `guest_sce_net` give the same results as on `main`. - Full `ctest` on `main` `c74aeb2f4` on this host (RTX 5060 Ti, NVIDIA 595.99.02): 1583 of 1589 passed; the four `guest_datagram_*` tests were the only failures that also failed when run alone. - `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py` lists #6044, which only moves this file to `tests/networking/` without changing its content. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR 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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
github-actions[bot] commented 2026-10-19 10:45:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T10:45:11Z.


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 6044 core/libs/tests/GuestDatagramReceive.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6265401721 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7847#issuecomment-6265401721). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T10:45:11Z. --- <!-- pr-overlap --> 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 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestDatagramReceive.cpp` |
fogydes commented 2026-10-19 12:07:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-10-19T12:07:18Z.

Review: APPROVED


Built and verified locally on Windows 11 with WinLibs MinGW-w64 GCC 15.2.0, Release (-DBUILD_TESTING=ON):

  • Target guest_datagram_receive_tests builds cleanly with Ninja.
  • ctest --test-dir build-libs -R "guest_datagram_" --output-on-failure:
    • guest_datagram_recv: Passed (0.11s)
    • guest_datagram_recvfrom: Passed (0.02s)
    • guest_datagram_sceNetRecv: Passed (0.03s)
    • guest_datagram_sceNetRecvfrom: Passed (0.02s)
      All 4/4 tests passed in 0.23s.
  • tools/check_conventions.py --base origin/main passes with zero findings.
  • Zero comments added in code.
  • Overlap with #6044 is purely the file path relocation to tests/networking/.

The skip conditions align with GuestSceNet.cpp (EAFNOSUPPORT 47 and EADDRNOTAVAIL 49). Clean micro-PR.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5571289527 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7847#pullrequestreview-5571289527). Originally posted by [fogydes](https://github.com/fogydes) on 2026-10-19T12:07:18Z. **Review:** APPROVED --- Built and verified locally on Windows 11 with WinLibs MinGW-w64 GCC 15.2.0, Release (`-DBUILD_TESTING=ON`): - Target `guest_datagram_receive_tests` builds cleanly with Ninja. - `ctest --test-dir build-libs -R "guest_datagram_" --output-on-failure`: - `guest_datagram_recv`: Passed (0.11s) - `guest_datagram_recvfrom`: Passed (0.02s) - `guest_datagram_sceNetRecv`: Passed (0.03s) - `guest_datagram_sceNetRecvfrom`: Passed (0.02s) All 4/4 tests passed in 0.23s. - `tools/check_conventions.py --base origin/main` passes with zero findings. - Zero comments added in code. - Overlap with #6044 is purely the file path relocation to `tests/networking/`. The skip conditions align with `GuestSceNet.cpp` (`EAFNOSUPPORT` 47 and `EADDRNOTAVAIL` 49). Clean micro-PR. AI-assisted: yes
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!7847
No description provided.