test(libScePad): audit vibration motor intensity clamping and handle validation #17420

Merged
slopgobblercobbler merged 1 commit from upstream-pr/17420 into main 2026-11-20 04:34:30 +00:00
slopgobblercobbler commented 2026-11-08 19:20:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by slopgobblercobbler on 2026-11-08T19:20:53Z.


What

Standalone guest unit test verifying libScePad vibration parameter handling, motor intensity boundaries, handle validity, and vibration state resets.

Tested

Windows 11, tools/check_conventions.py, tools/pr_overlap.py.

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:5214340547 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17420). Originally posted by [slopgobblercobbler](https://github.com/slopgobblercobbler) on 2026-11-08T19:20:53Z. --- ### What Standalone guest unit test verifying libScePad vibration parameter handling, motor intensity boundaries, handle validity, and vibration state resets. ### Tested Windows 11, tools/check_conventions.py, tools/pr_overlap.py. ### 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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
gabichuuuuu commented 2026-11-08 19:38:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T19:38:34Z.

Review: COMMENTED


Windows run of head a816b130a3, merged onto main 095ff72367. To save builds, this ran in one tree together with 24 other open PRs that touch different code; all 25 merged cleanly. Setup: Windows 11, WinLibs GCC 15.2 (x86_64-ucrt-posix-seh), Release, BUILD_TESTING=ON.

  • guest_pad_vibration with --repeat until-fail:5: 5 / 5 pass.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5819362949 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17420#pullrequestreview-5819362949). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T19:38:34Z. **Review:** COMMENTED --- Windows run of head `a816b130a3`, merged onto `main` `095ff72367`. To save builds, this ran in one tree together with 24 other open PRs that touch different code; all 25 merged cleanly. Setup: Windows 11, WinLibs GCC 15.2 (`x86_64-ucrt-posix-seh`), Release, `BUILD_TESTING=ON`. - `guest_pad_vibration` with `--repeat until-fail:5`: 5 / 5 pass.
PrivacyOnion commented 2026-11-16 19:54:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T19:54:44Z.

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_pad_vibration_tests built cleanly.
  • CTest (guest_pad_vibration_mode, guest_pad_vibration):
    1/2 Test #3609: guest_pad_vibration_mode .........   Passed    0.03 sec
    2/2 Test #3610: guest_pad_vibration ..............   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 2
    
  • Code reading:
    • Verified in core/libs/tests/GuestPadVibration.cpp:17-29 that scePadSetVibration correctly returns PAD_ERROR_INVALID_HANDLE for negative and out-of-range handle values (-9999, -100, -1, 0, 5, 12345) both prior to and following scePadInit_nid_postfix(), and that null pointer arguments with invalid handles prioritize PAD_ERROR_INVALID_HANDLE over PAD_ERROR_INVALID_ARG.
    • Verified in core/libs/tests/GuestPadVibration.cpp:35 that scePadSetVibration with a valid handle (handle0) and nullptr parameter correctly validates input pointers and returns PAD_ERROR_INVALID_ARG.
    • Verified in core/libs/tests/GuestPadVibration.cpp:40-77 that motor boundary and intermediate intensity values (0, 1, 64, 128, 180, 254, 255) are correctly propagated to PadOutputState via PadFetchOutputForPort_nid_postfix, and that subsequent identical vibration updates (pReset) are properly deduplicated without spurious sequence increments.
    • Verified in core/libs/tests/GuestPadVibration.cpp:79-110 that multiple standard pad instances on distinct ports (user0 / port 0 and user1 / port 1) maintain isolated vibration states without cross-talk across ports.
    • Verified in core/libs/tests/GuestPadVibration.cpp:112-117 that special port handles (PAD_PORT_TYPE_SPECIAL) accept vibration commands, correctly return PAD_OK, and reject operations with PAD_ERROR_INVALID_HANDLE once closed via scePadClose_nid_postfix.
    • Verified in core/libs/tests/GuestPadVibration.cpp and core/libs/prx/libScePad/CMakeLists.txt that zero comments exist, adhering strictly to AGENTS.md conventions, and that test target properties match existing guest test definitions.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5926538758 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17420#pullrequestreview-5926538758). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-16T19:54:44Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `a816b130a3`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_pad_vibration_tests` built cleanly. - **CTest** (`guest_pad_vibration_mode`, `guest_pad_vibration`): ``` 1/2 Test #3609: guest_pad_vibration_mode ......... Passed 0.03 sec 2/2 Test #3610: guest_pad_vibration .............. Passed 0.02 sec 100% tests passed, 0 tests failed out of 2 ``` - **Code reading**: - Verified in core/libs/tests/GuestPadVibration.cpp:17-29 that scePadSetVibration correctly returns PAD_ERROR_INVALID_HANDLE for negative and out-of-range handle values (-9999, -100, -1, 0, 5, 12345) both prior to and following scePadInit_nid_postfix(), and that null pointer arguments with invalid handles prioritize PAD_ERROR_INVALID_HANDLE over PAD_ERROR_INVALID_ARG. - Verified in core/libs/tests/GuestPadVibration.cpp:35 that scePadSetVibration with a valid handle (handle0) and nullptr parameter correctly validates input pointers and returns PAD_ERROR_INVALID_ARG. - Verified in core/libs/tests/GuestPadVibration.cpp:40-77 that motor boundary and intermediate intensity values (0, 1, 64, 128, 180, 254, 255) are correctly propagated to PadOutputState via PadFetchOutputForPort_nid_postfix, and that subsequent identical vibration updates (pReset) are properly deduplicated without spurious sequence increments. - Verified in core/libs/tests/GuestPadVibration.cpp:79-110 that multiple standard pad instances on distinct ports (user0 / port 0 and user1 / port 1) maintain isolated vibration states without cross-talk across ports. - Verified in core/libs/tests/GuestPadVibration.cpp:112-117 that special port handles (PAD_PORT_TYPE_SPECIAL) accept vibration commands, correctly return PAD_OK, and reject operations with PAD_ERROR_INVALID_HANDLE once closed via scePadClose_nid_postfix. - Verified in core/libs/tests/GuestPadVibration.cpp and core/libs/prx/libScePad/CMakeLists.txt that zero comments exist, adhering strictly to AGENTS.md conventions, and that test target properties match existing guest test definitions. Looks Good To Me
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!17420
No description provided.