Skip to content

test(libSceAudioOut): audit Sys port close and regular close bounds in AudioOutSys - #21054

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
slopgobblercobbler:slopgobblercobbler/pr-libsceaudioout-sys-port-bounds
Nov 24, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
slopgobblercobbler:slopgobblercobbler/pr-libsceaudioout-sys-port-bounds

Conversation

@slopgobblercobbler

@slopgobblercobbler slopgobblercobbler commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Folds Sys port close and regular sceAudioOutClose bounds into core/libs/prx/libSceAudioOut/tests/AudioOutSys.cpp per maintainer review:

  1. Rejects Sys close of a standard port (sceAudioOutSysClose(standard) throws std::runtime_error).
  2. Validates regular sceAudioOutClose on a Sys handle (returns 0 on initial close, and returns 0x80260003 / -2144993277 on subsequent close).
  3. Verifies sceAudioOutClose(0) returns 0x80260003 / -2144993277.
  4. Drops redundant standalone test file and CMake target, using printing Require in AudioOutSys.cpp.

Tested

  • python tools/check_conventions.py --base upstream/main --head HEAD: 0 findings.
  • git diff --check: clean (0 whitespace errors).

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

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

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 15a4f866b0:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_audio_out_sys_port_bounds_tests failed to build.
    core/libs/tests/GuestAudioOutSysPortBounds.cpp:71:77: error: unable to deduce ‘std::initializer_list<auto>&&’ from ‘{1, 2, 2147483648, 18446744069414584320}’
    core/libs/tests/GuestAudioOutSysPortBounds.cpp:71:77: note:   deduced conflicting types for parameter ‘auto’ (‘unsigned int’ and ‘long long unsigned int’)
    core/libs/tests/GuestAudioOutSysPortBounds.cpp:77:51: error: unable to deduce ‘std::initializer_list<auto>&&’ from ‘{1, 5, 4096}’
    core/libs/tests/GuestAudioOutSysPortBounds.cpp:77:51: note:   deduced conflicting types for parameter ‘auto’ (‘unsigned int’ and ‘long long unsigned int’)
    

Requesting changes for the points above.

@slopgobblercobbler
slopgobblercobbler force-pushed the slopgobblercobbler/pr-libsceaudioout-sys-port-bounds branch from 15a4f86 to 7f6f7c2 Compare November 17, 2026 17:33

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

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 7f6f7c2804:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_audio_out_sys_port_bounds_tests failed to build.
    core/libs/tests/GuestAudioOutSysPortBounds.cpp:71:77: error: unable to deduce ‘std::initializer_list<auto>&&’ from ‘{1, 2, 2147483648, 18446744069414584320}’
    core/libs/tests/GuestAudioOutSysPortBounds.cpp:71:77: note:   deduced conflicting types for parameter ‘auto’ (‘unsigned int’ and ‘long long unsigned int’)
    core/libs/tests/GuestAudioOutSysPortBounds.cpp:77:51: error: unable to deduce ‘std::initializer_list<auto>&&’ from ‘{1, 5, 4096}’
    core/libs/tests/GuestAudioOutSysPortBounds.cpp:77:51: note:   deduced conflicting types for parameter ‘auto’ (‘unsigned int’ and ‘long long unsigned int’)
    

Requesting changes for the points above.

@maskym

maskym commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Windows result for head 7f6f7c2804, merged alone into main f2d10b6999: guest_audio_out_sys_port_bounds_tests does not compile.

core/libs/tests/GuestAudioOutSysPortBounds.cpp:71:77: error: unable to deduce 'std::initializer_list<auto>&&' from '{1, 2, 2147483648, 18446744069414584320}'
note:   deduced conflicting types for parameter 'auto' ('unsigned int' and 'long long unsigned int')
core/libs/tests/GuestAudioOutSysPortBounds.cpp:77:51: error: unable to deduce 'std::initializer_list<auto>&&' from '{1, 5, 4096}'

The braced lists in the two range-for loops mix 1u/2u/5u (unsigned int) with ULL literals, so the std::initializer_list element type cannot be deduced. This is a standard C++ rule, not a Windows difference, so it should fail on Linux too, and it fails the same way at the PR's own base: no main commit caused it. Using one literal type, e.g. {1ULL, 2ULL, 0x80000000ULL, 0xFFFFFFFF00000000ULL} and {1ULL, 5ULL, 0x1000ULL}, should fix it. The other targets in the build (libc, libkernel) link fine.

The PR's own windows CI job (run 44138372474) fails on the same object, GuestAudioOutSysPortBounds.cpp.obj; linux was skipped.

Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja.
Command: cmake --build <build> --parallel 8 --target guest_audio_out_sys_port_bounds_tests -- -k 0 (ctest -R "^guest_audio_out_sys_port_bounds$" not reached).

Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the output above are from this machine.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

This head does not compile. In GuestAudioOutSysPortBounds.cpp, lines 71 and 77 mix 1u with ULL literals in braced range-for lists, so the initializer_list type cannot be deduced; the Windows job fails on that object, and PrivacyOnion (Linux) and maskym (Windows) report the same error.

Most of the content duplicates main. In AudioOut.cpp, mode 5 is the only accepted Sys mode, and every other mode, type, flag, option or target throws std::runtime_error, so almost all the new asserts are throw pins on the stub. Main already has libSceAudioOut/tests/AudioOutSys.cpp (open modes 0/5/6, configure 1,0,5,1,0 returns 0, other values throw) and AudioOutSysHdmiMonitorInfo.cpp (the full monitor-info code set).

What is new and worth keeping: Sys close of a standard or Ex port, and a regular sceAudioOutClose on a Sys handle (0, then invalid handle).

Please:

  1. Fold only the new non-throw cases into AudioOutSys.cpp, with no new file or CMake target.
  2. Drop the throw pins that are already covered.
  3. Fix the literal types so it compiles.
  4. Use a printing Require or Check.
  5. Show Linux ctest and Windows green on the new head.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 18, 2026

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

Reviewed — looks good

The reviewed change adds a standalone bounds test for Sys audio ports and HDMI monitor info; I found no verified blocking defects.

What I ran

Reviewed head 7f6f7c280451fcdf8ed17fe4afe58fcd9054e98b using repo_read.py reader tools. I did not run the author-reported CTest command.

Results

Check Result Note
Changed-file review passed Both changed files read in full
CTest not run No test execution available

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

The author-reported ctest --test-dir build -R guest_audio_out_sys_port_bounds_tests was not run. The review folder's files.json was unavailable; the manifest lists both changed files as included, and both were read. No changed files were excluded by the manifest.

To get this to a good state

Nothing is required. The author-reported CTest run remains unverified.

@slopgobblercobbler
slopgobblercobbler force-pushed the slopgobblercobbler/pr-libsceaudioout-sys-port-bounds branch from 7f6f7c2 to ca973ea Compare November 20, 2026 21:52
@slopgobblercobbler slopgobblercobbler changed the title test(libSceAudioOut): audit Sys port TrueHD MAT route mode 5, configure parameters, and monitor info test(libSceAudioOut): audit Sys port close and regular close bounds in AudioOutSys Nov 20, 2026
@slopgobblercobbler

Copy link
Copy Markdown
Contributor Author

@oneandonlydean @PrivacyOnion @maskym Rebased cleanly onto latest upstream/main. Addressed all maintainer feedback:

  1. Removed standalone GuestAudioOutSysPortBounds.cpp and separate CMake target.
  2. Folded the new non-throw cases into core/libs/prx/libSceAudioOut/tests/AudioOutSys.cpp (Sys close of standard port, regular sceAudioOutClose on Sys handle returning 0 then invalid handle, and handle 0 invalid handle).
  3. Used existing printing Require.
  4. Verified 0 findings with tools/check_conventions.py and 0 whitespace errors with git diff --check.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 20, 2026

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

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against ca973eafc7:

  • Conventions: tools/check_conventions.py passed.
  • Build: audio_out_sys_tests built cleanly.
  • CTest (audio_out_sys):
    1/1 Test #3634: audio_out_sys ....................   Passed    0.11 sec
    100% tests passed, 0 tests failed out of 1
    
  • Code reading:
    • Verified that core/libs/prx/libSceAudioOut/tests/AudioOutSys.cpp folds only the maintainer-requested test cases (Sys close on standard port throws, sceAudioOutClose on standard port succeeds, sceAudioOutClose(0) returns 0x80260003 / -2144993277, sceAudioOutClose on Sys handle succeeds and subsequent closes fail with invalid handle) without reintroducing redundant test files.
    • Verified that no comments were added to code, adhering to AGENTS.md and conventions.
    • Verified that all integer literals in the test assertions use compatible signedness and exact expected return values matching sceAudioOutClose contract (-2144993277 == 0x80260003).
    • Verified that test cleanup and handle lifecycles are properly tested without leaking resources or causing side effects across tests.
    • Verified that the PR diff strictly addresses maintainer oneandonlydean's feedback by removing GuestAudioOutSysPortBounds.cpp and using existing printing Require assertions.

Looks Good To Me

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

Reviewed — looks good

Nothing in the reviewed changes blocks merging; the added close-boundary assertions agree with the implementations inspected.

What I ran

Reviewed head ca973eafc787560deb5658d1612760b5bf047c3d. No tests or build commands were run; repository context was read with repo_read.py.

Results

Check Result Note
Changed test review passed Assertions agree with inspected close behavior
Tests and build not run No execution performed

Findings

Blocking

None.

Non-blocking

None.

Not verified

Runtime behavior and the author-reported convention and whitespace checks were not independently verified. The only changed file, core/libs/prx/libSceAudioOut/tests/AudioOutSys.cpp, was read in full. description.md, commits.md, manifest.json, and diff.patch were read; files.json was not available in the review folder listing.

To get this to a good state

Nothing is required.

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head ca973eafc7, applied with git apply on main fd4aeed483 together with the other 29 PRs of one batch (#16191, #16207, #17573, #18945, #20978, #22002, #22003, #22042, #22078, #22822, #24354, #24484, #12860, #18915, #19999, #22160, #22890, #22891, #23488, #23751, #24051, #24578, #14506, #19462, #22206, #22291, #22627, #24048, #24424). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
audio_out_sys, audio_out_sys_hdmi_monitor_info (2 tests, matched by name to the test file this PR changes) all pass outside the iGPU subset

Whole batch: the full ctest -j 12 (6526 tests) on the RTX 3080 has 15 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. Traced to other PRs of the batch, each by reverting it and testing again: #12860 (guest_user_service_account_name_limits, guest_user_service_age_level_guest_bounds, guest_user_service_initial_user_bounds, guest_user_service_kratos), #22891 (nkwebkit_securityorigin), #18915 (public_headers); none is in this PR's area. Failing tests I could not trace to a single PR (reverting the likely candidates did not clear them): guest_apr_read_longeof, guest_filesystem, guest_kernel_rename, guest_windows_directory_link_types, tools_patch_advisor_json, tools_suggest_patches. The 2125 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit adf956c into boykopovar:main Nov 24, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants