test(libSceNetCtl): cover the plain callback registration in guest_sce_net #6690

Merged
xXPBSXx merged 1 commit from upstream-pr/6690 into main 2026-10-19 04:52:05 +00:00
xXPBSXx commented 2026-10-16 05:02:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-16T05:02:58Z.


What

sceNetCtlRegisterCallback and sceNetCtlUnregisterCallback use the same table logic as the V6 pair (Export.cpp RegisterCallback and UnregisterCallback), and guest_sce_net checks only the V6 pair. No test calls the plain pair.

The new block in core/libs/tests/GuestSceNet.cpp mirrors the V6 block: a null function and a null output are refused with 0x80412107, eight registrations return the ids 0 to 7, the ninth fails with 0x80412103, ids -1 and 8 fail with 0x80412105, a freed slot is reused, and a V6 registration made while the plain table is full succeeds (the tables are separate). No behavior changes.

Tested

Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, on main 5d9dcc42d + this commit: ctest -R ^guest_sce_net$ passes (3.9 s). python tools/check_conventions.py --base upstream/main passes. Not tested: Linux, macOS.

Overlap: #6138 also edits core/libs/tests/GuestSceNet.cpp and GuestNetCtl.cpp (callback argument, sceNetCtlCheckCallback); if it lands first this block needs a rebase.

Checklist

  • Based on current main; no other open PR implements the same tests
  • 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); no stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none (test coverage only)
  • GPUs tested: n/a
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4883733041 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6690). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-16T05:02:58Z. --- ### What `sceNetCtlRegisterCallback` and `sceNetCtlUnregisterCallback` use the same table logic as the V6 pair (`Export.cpp` `RegisterCallback` and `UnregisterCallback`), and `guest_sce_net` checks only the V6 pair. No test calls the plain pair. The new block in `core/libs/tests/GuestSceNet.cpp` mirrors the V6 block: a null function and a null output are refused with `0x80412107`, eight registrations return the ids 0 to 7, the ninth fails with `0x80412103`, ids -1 and 8 fail with `0x80412105`, a freed slot is reused, and a V6 registration made while the plain table is full succeeds (the tables are separate). No behavior changes. ### Tested Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, on `main` `5d9dcc42d` + this commit: `ctest -R ^guest_sce_net$` passes (3.9 s). `python tools/check_conventions.py --base upstream/main` passes. Not tested: Linux, macOS. Overlap: #6138 also edits `core/libs/tests/GuestSceNet.cpp` and `GuestNetCtl.cpp` (callback argument, `sceNetCtlCheckCallback`); if it lands first this block needs a rebase. ### Checklist - [x] Based on current `main`; no other open PR implements the same tests - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); no stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none (test coverage only) - [x] GPUs tested: n/a - [x] AI-assisted: yes AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
xXPBSXx commented 2026-10-16 05:04:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-16T05:04:43Z.


@adriadam10 a short request for review of this test-only PR (guest_sce_net gains the plain sceNetCtlRegisterCallback / sceNetCtlUnregisterCallback pair, mirroring the existing V6 block; +24/-0, no behavior change). Head 09112b47d is MERGEABLE / CLEAN, the Conventions, Eligibility and Intake checks are green, ctest -R ^guest_sce_net$ passes. #6138 also edits GuestSceNet.cpp; whichever lands second needs a rebase.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6208497767 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6690#issuecomment-6208497767). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-16T05:04:43Z. --- @adriadam10 a short request for review of this test-only PR (`guest_sce_net` gains the plain `sceNetCtlRegisterCallback` / `sceNetCtlUnregisterCallback` pair, mirroring the existing V6 block; +24/-0, no behavior change). Head `09112b47d` is `MERGEABLE` / `CLEAN`, the Conventions, Eligibility and Intake checks are green, `ctest -R ^guest_sce_net$` passes. #6138 also edits `GuestSceNet.cpp`; whichever lands second needs a rebase. AI-assisted (Claude Code).
github-actions[bot] commented 2026-10-16 05:32:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T05:32:23Z.


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 5836 core/libs/tests/GuestSceNet.cpp
PR 6044 core/libs/tests/GuestSceNet.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6208826072 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6690#issuecomment-6208826072). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T05:32:23Z. --- <!-- 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 5836](https://www.github.com/boykopovar/AnyPS5/pull/5836) | `core/libs/tests/GuestSceNet.cpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestSceNet.cpp` |
jotitadev commented 2026-10-16 05:41:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T05:41:12Z.

Review: COMMENTED


Ran this on Linux, since the description lists Linux as not tested.

  • Machine: Ubuntu 26.04, x86_64 (i7-8700), GCC 15.2.0, CMake 4.2.3 + Ninja, Release, BUILD_TESTING=ON, full tree.
  • Head: 09112b47d, on top of main 5d9dcc42d (fast-forward).

Results:

  • Full build: clean, no warnings.
  • ctest -R "^guest_sce_net$": passes (20/20 with --repeat until-fail:20).
  • Non-GPU suite (ctest -E "^agc|gpu|vulkan|video_out" -j10): same failures as main 5d9dcc42d (file_writer_binary and file_writer_text, which fail on this machine's coreutils and are unrelated).
  • tools/check_conventions.py --base origin/main: passes.
  • Check that the new lines run on Linux: with sceNetCtlUnregisterCallback(8) expected to return 0 instead of 0x80412105 the test aborts; reverted, it passes.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5543523273 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6690#pullrequestreview-5543523273). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-16T05:41:12Z. **Review:** COMMENTED --- Ran this on Linux, since the description lists Linux as not tested. - Machine: Ubuntu 26.04, x86_64 (i7-8700), GCC 15.2.0, CMake 4.2.3 + Ninja, Release, `BUILD_TESTING=ON`, full tree. - Head: `09112b47d`, on top of `main` `5d9dcc42d` (fast-forward). Results: - Full build: clean, no warnings. - `ctest -R "^guest_sce_net$"`: passes (20/20 with `--repeat until-fail:20`). - Non-GPU suite (`ctest -E "^agc|gpu|vulkan|video_out" -j10`): same failures as `main` `5d9dcc42d` (`file_writer_binary` and `file_writer_text`, which fail on this machine's coreutils and are unrelated). - `tools/check_conventions.py --base origin/main`: passes. - Check that the new lines run on Linux: with `sceNetCtlUnregisterCallback(8)` expected to return 0 instead of `0x80412105` the test aborts; reverted, it passes. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
oneandonlydean commented 2026-10-19 03:52:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-19T03:52:52Z.


@xXPBSXx the new test doesn't compile on Windows (full CI run 39193737210, MinGW GCC 15):

core/libs/tests/GuestSceNet.cpp:1527:43: error: invalid user-defined conversion from 'const main()::<lambda(int, void*)>' to 'NetCtlCallback' {aka 'void (__attribute__((sysv_abi)) *)(int, ...

NetCtlCallback is a sysv_abi function pointer, and a lambda only converts to a pointer with the default calling convention, which differs on Windows. A named function with the guest ABI works on both hosts, for example void APS5_VABI DummyNetCtlCallback(int, void*) {} at file scope, passed in place of dummyCallback. Linux builds and runs it fine, so that's the only change needed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6259270404 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6690#issuecomment-6259270404). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-19T03:52:52Z. --- @xXPBSXx the new test doesn't compile on Windows (full CI run 39193737210, MinGW GCC 15): ``` core/libs/tests/GuestSceNet.cpp:1527:43: error: invalid user-defined conversion from 'const main()::<lambda(int, void*)>' to 'NetCtlCallback' {aka 'void (__attribute__((sysv_abi)) *)(int, ... ``` `NetCtlCallback` is a `sysv_abi` function pointer, and a lambda only converts to a pointer with the default calling convention, which differs on Windows. A named function with the guest ABI works on both hosts, for example `void APS5_VABI DummyNetCtlCallback(int, void*) {}` at file scope, passed in place of `dummyCallback`. Linux builds and runs it fine, so that's the only change needed.
xXPBSXx commented 2026-10-19 04:04:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-19T04:04:44Z.


Thanks, you are right. NetCtlCallback is a sysv_abi pointer since #6138, so the lambda in my block no longer converts on the Windows host. I rebased onto main 3ddbc4acc and the block now passes the guest-ABI IgnoreNetCtlEvent that the V6 block uses.

Tested on Windows 10 (MinGW-w64 GCC 15.2.0, Release) on main 3ddbc4acc + the new head ba9dbc208: ctest -R ^guest_sce_net$ passes (1.7 s). python tools/check_conventions.py --base upstream/main passes. Not tested: Linux, macOS.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6259395638 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6690#issuecomment-6259395638). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-19T04:04:44Z. --- Thanks, you are right. `NetCtlCallback` is a `sysv_abi` pointer since #6138, so the lambda in my block no longer converts on the Windows host. I rebased onto `main` `3ddbc4acc` and the block now passes the guest-ABI `IgnoreNetCtlEvent` that the V6 block uses. Tested on Windows 10 (MinGW-w64 GCC 15.2.0, Release) on `main` `3ddbc4acc` + the new head `ba9dbc208`: `ctest -R ^guest_sce_net$` passes (1.7 s). `python tools/check_conventions.py --base upstream/main` passes. Not tested: Linux, macOS. AI-assisted (Claude Code).
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!6690
No description provided.