Repository navigation
test(libSceHmd2): check the named calls' measured answers before initialization - #14112
Conversation
…ialization The debt file records what the console answers before sceHmd2Initialize for each named export, but 22 of those named calls had no test. Call each of them before initialization with null or zero arguments, as the measurement did, and check the recorded answer: 0, -1, 0x8a720004, 0x8a720008, 0x8a72000b or 0x8a72002c. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…event calls Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The 21 new pre-initialization assertions match the recorded answers for their named exports, and the exact-head Windows test job passes.
What I ran
Reviewed head 04e7368707b801d75ed995a29d2a7d3a465aa5ae against base 76d08bc10b302d54345963a3befe31a1b8be6040; GitHub reports the PR mergeable. Environment: Linux 6.1.0-54-amd64, Python 3.11.2, GCC 12.2.0.
git diff --check 76d08bc10b302d54345963a3befe31a1b8be6040...04e7368707b801d75ed995a29d2a7d3a465aa5ae
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14112
gh run view 41233735805 -R boykopovar/AnyPS5 --job 124633706007 --logResults
| Check | Result |
|---|---|
| Diff check | Passed. |
| Conventions, eligibility, intake, and library portability | Passed on the PR head. |
| Windows hosted test job | Passed; its log lists guest_hmd2_tests under the changed guest core/libs tests. |
| Dependency/mergeability precheck | Passed. |
| Test-quality helper | Could not run in the isolated PR worktree because the local-only helper script is absent there; this is a tooling limitation. |
| Labels | Pending when checked. |
| Linux product, relinker, sanitizer, and console behavior | Not run or not applicable to this test-only path. |
Unedited relevant output
All conventions checks passed.
windows Build and run changed guest core/libs tests [2/4] Building CXX object core/libs/prx/libSceHmd2/CMakeFiles/guest_hmd2_tests.dir/__/__/tests/GuestHmd2.cpp.obj
windows Build and run changed guest core/libs tests [3/4] Linking CXX executable tests\guest_hmd2_tests.exe
windows Build and run changed guest core/libs tests Guest core/libs tests:
windows Build and run changed guest core/libs tests guest_hmd2_tests
/usr/bin/python3: can't open file '/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14112-04e7368707b8/head-04e7368707b8-fb7673b8/tools/pr_test_quality.py': [Errno 2] No such file or directory
Negative control
| Assertion | Mutation | Outcome |
|---|---|---|
sceHmd2GazeObjectSelectionTerminate returns the recorded pre-initialization result. |
The author reports changing the expected value to 0x8a720004. |
The author reports guest_hmd2 failed with that call's message; I did not independently rerun this mutation. |
Sources
Not verified
I did not build or run the test locally. macOS, Linux product behavior, and PS5 console behavior were not tested. The Windows hosted job passed for the exact head.
slopgobblercobbler
left a comment
There was a problem hiding this comment.
The additions in core/libs/tests/GuestHmd2.cpp provide clean, comprehensive test coverage for the 22 named libSceHmd2 exports called prior to initialization.
Key Observations
-
Contract Consistency with Hardware Measurements:
- The asserted return values strictly align with the console probe measurements documented in
docs/dev/debt/libSceHmd2.mdand their declarations inExport.cpp:- Returns
0:sceHmd2SetIpdOffset,sceHmd2InternalTrackingOpen,sceHmd2InternalTrackingClose,sceHmd2InternalLedDetectorOpen,sceHmd2InternalLedDetectorClose. - Returns
-1:sceHmd2InternalTrackingStart,sceHmd2InternalTrackingStop,sceHmd2InternalLedDetectorStart,sceHmd2InternalLedDetectorStop. - Returns
Hmd2::Error0004(0x8a720004):sceHmd2GazeStartUserCalibration,sceHmd2GazeStopUserCalibration,sceHmd2GazeSetUserCalibrationPoint,sceHmd2GazeSetEnabledEye. - Returns
Hmd2::ParameterNull(0x8a720008):sceHmd2GazeGetCalibrationData,sceHmd2GazeSetUserCalibrationData,sceHmd2GazeObjectSelectionInitialize. - Returns
Hmd2::ReprojectionNotInitialized(0x8a72000b):sceHmd2ReprojectionSetUserEventStart,sceHmd2ReprojectionSetUserEventEnd,sceHmd2ReprojectionClearUserEventStart,sceHmd2ReprojectionClearUserEventEnd. - Returns
Hmd2::Error002C(0x8a72002c):sceHmd2GazeObjectSelectionTerminate.
- Returns
- The asserted return values strictly align with the console probe measurements documented in
-
Test Structure & State Isolation:
- Isolating these calls within
TestNamedCallsBeforeInitialize()and executing them directly afterTestBeforeInitialize()(and before headset/session setup inTestWithoutHeadset()) ensures that device state remains clean and uncontaminated by subsequent routines. - Using standard
Require()assertions with descriptive error contexts keeps failures immediate and easy to pinpoint if pre-init contracts regress.
- Isolating these calls within
-
Conventions:
- No unnecessary comments added to test source.
- Clean C++20 conventions maintained throughout.
Looks good and solid to merge.
|
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.
|
What
docs/dev/debt/libSceHmd2.mdrecords what the console answers beforesceHmd2Initialize, measured with every argument null and with every argument pointing at zeroed memory. 22 of the named exports in those groups had no test.GuestHmd2.cppnow calls each of them before initialization with null or zero arguments and checks the recorded answer:sceHmd2SetIpdOffset,sceHmd2InternalTrackingOpen/Close,sceHmd2InternalLedDetectorOpen/ClosesceHmd2InternalTrackingStart/Stop,sceHmd2InternalLedDetectorStart/Stop0x8a720004sceHmd2GazeStartUserCalibration,StopUserCalibration,SetUserCalibrationPoint,SetEnabledEye0x8a720008sceHmd2GazeGetCalibrationData,SetUserCalibrationData,ObjectSelectionInitialize0x8a72000bsceHmd2ReprojectionSetUserEventStart/End,ClearUserEventStart/End0x8a72002csceHmd2GazeObjectSelectionTerminateFor every call, the value in
Export.cppmatches the one the debt file gives for its group. Test only; no behaviour change.Tested
guest_hmd2andguest_hmd2_gazepassed.sceHmd2GazeObjectSelectionTerminateanswer to0x8a720004madeguest_hmd2fail with that call's message.tools/check_conventions.py --base origin/mainpassed.tools/pr_overlap.pycould not compare feat(libs): the Hmd2 reprojection session #7658 and feat(libSceHmd2): answer four reprojection calls without a session as the console does #8645, which conflict withmainand also editGuestHmd2.cpp. Neither of them calls these functions in its test changes.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)