Skip to content

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

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
xXPBSXx:test/netctl-callbacks-plain
Oct 19, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
xXPBSXx:test/netctl-callbacks-plain

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

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

@xXPBSXx

xXPBSXx commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

@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

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

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

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 oneandonlydean self-assigned this Oct 17, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@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.

…e_net

sceNetCtlRegisterCallback and sceNetCtlUnregisterCallback share the
callback table logic with the V6 pair, which guest_sce_net checks, but
the plain pair is not called by any test. The new block mirrors the V6
one (null function, null output, eight slots, the ninth refused, invalid
ids, slot reuse) with the guest-ABI IgnoreNetCtlEvent callback, and checks
that the two tables are separate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@xXPBSXx
xXPBSXx force-pushed the test/netctl-callbacks-plain branch from 09112b4 to ba9dbc2 Compare October 19, 2026 04:03
@xXPBSXx

xXPBSXx commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

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).

@oneandonlydean
oneandonlydean merged commit b2a3cd8 into boykopovar:main Oct 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants