test(libSceAjm.native): cover the statistics job sceAjmBatchJobGetStatistics appends #12231

Merged
milescoviello merged 1 commit from upstream-pr/12231 into main 2026-11-02 13:35:48 +00:00
milescoviello commented 2026-10-28 04:06:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-28T04:06:10Z.


What

GuestAjm.cpp gets TestGetStatistics. It builds one batch with a sceAjmBatchJobGetStatistics job (interval 1.0) followed by a sceAjmBatchJobGetInfo of an instance that was never initialized, then starts and waits for it:

  • the batch completes (sceAjmBatchStart and sceAjmBatchWait return 0);
  • the statistics job writes the 24 bytes of its result (the size sceAjmBatchJobGetStatistics gives the job) as zeros, and the bytes after them keep their fill;
  • the format query after it still runs and reports result 1 with the channel count untouched, as TestGetInfo expects for an uninitialized instance.

The zeros are what this library reports for the statistics; the test pins that and that the job doesn't stop the batch. Valid inputs only.

Crimson Desert (PPSA25286) has one call site of sceAjmBatchJobGetStatistics in its relinked eboot.bin (callsites.py), and no test called it until now.

Changed: core/libs/tests/GuestAjm.cpp. Test only, no change to the library.

Tested

Linux (Ubuntu 26.04, GCC 15.2), Release: cmake --build build --target guest_ajm_tests, then ctest -R '^guest_ajm$' passes 3 of 3 runs on this branch (current main 82d5f01f28 plus the test, rebased from 061cdb66b0). As a red control, a statistics job that writes nothing fails guest_ajm. tools/check_conventions.py --base upstream/main passes. tools/pr_overlap.py finds no overlap. It could not compare #3205, which also edits GuestAjm.cpp, because #3205 already conflicts with main in that file; its hunks sit elsewhere in the file (the declarations at the top, a new case after the ATRAC9 tests, and main).

Windows 11 VM (GT 1030, WinLibs GCC 15.2.0): guest_ajm passes 3 of 3 on main 82d5f01f28 and 3 of 3 on this branch 42146e8180.

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5045043110 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12231). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-28T04:06:10Z. --- ### What `GuestAjm.cpp` gets `TestGetStatistics`. It builds one batch with a `sceAjmBatchJobGetStatistics` job (interval 1.0) followed by a `sceAjmBatchJobGetInfo` of an instance that was never initialized, then starts and waits for it: - the batch completes (`sceAjmBatchStart` and `sceAjmBatchWait` return 0); - the statistics job writes the 24 bytes of its result (the size `sceAjmBatchJobGetStatistics` gives the job) as zeros, and the bytes after them keep their fill; - the format query after it still runs and reports result 1 with the channel count untouched, as `TestGetInfo` expects for an uninitialized instance. The zeros are what this library reports for the statistics; the test pins that and that the job doesn't stop the batch. Valid inputs only. Crimson Desert (PPSA25286) has one call site of `sceAjmBatchJobGetStatistics` in its relinked `eboot.bin` (`callsites.py`), and no test called it until now. Changed: `core/libs/tests/GuestAjm.cpp`. Test only, no change to the library. ### Tested Linux (Ubuntu 26.04, GCC 15.2), Release: `cmake --build build --target guest_ajm_tests`, then `ctest -R '^guest_ajm$'` passes 3 of 3 runs on this branch (current `main` `82d5f01f28` plus the test, rebased from `061cdb66b0`). As a red control, a statistics job that writes nothing fails `guest_ajm`. `tools/check_conventions.py --base upstream/main` passes. `tools/pr_overlap.py` finds no overlap. It could not compare #3205, which also edits `GuestAjm.cpp`, because #3205 already conflicts with `main` in that file; its hunks sit elsewhere in the file (the declarations at the top, a new case after the ATRAC9 tests, and `main`). Windows 11 VM (GT 1030, WinLibs GCC 15.2.0): `guest_ajm` passes 3 of 3 on `main` `82d5f01f28` and 3 of 3 on this branch `42146e8180`. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-28 04:07:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T04:07:13Z.

Review: CHANGES_REQUESTED


The test setup is coherent: the statistics job is queued before GetInfo, its 24-byte output is checked while the eight-byte tail must remain at the fill value, and the subsequent uninitialized-instance format query verifies that the batch continues. The reported red control (no statistics output) is useful. I independently reviewed the exact diff; git diff --check passes and the current-main merge preview is clean. Hosted conventions, intake, labels, and eligibility pass; Windows is running and the other build jobs are skipped. The author reports three successful focused runs on Linux and Windows.

Please update the branch to current main and rerun affected checks before approval, per CONTRIBUTING. It is seven commits behind 7fe69e276fc4e000ccb2a360ea8faeb3d7fcc137; those commits do not touch GuestAjm.cpp, and the merge preview is clean. I found no functional issue in the test as reviewed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5677672883 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12231#pullrequestreview-5677672883). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T04:07:13Z. **Review:** CHANGES_REQUESTED --- The test setup is coherent: the statistics job is queued before `GetInfo`, its 24-byte output is checked while the eight-byte tail must remain at the fill value, and the subsequent uninitialized-instance format query verifies that the batch continues. The reported red control (no statistics output) is useful. I independently reviewed the exact diff; `git diff --check` passes and the current-main merge preview is clean. Hosted conventions, intake, labels, and eligibility pass; Windows is running and the other build jobs are skipped. The author reports three successful focused runs on Linux and Windows. Please update the branch to current `main` and rerun affected checks before approval, per CONTRIBUTING. It is seven commits behind `7fe69e276fc4e000ccb2a360ea8faeb3d7fcc137`; those commits do not touch `GuestAjm.cpp`, and the merge preview is clean. I found no functional issue in the test as reviewed.
MarcZX10 commented 2026-10-28 09:19:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T09:19:11Z.

Review: APPROVED


Rechecked the rebased head 42146e81801ac93adac64ecc73fa69ce45f87617. The test queues GetStatistics before a GetInfo job whose instance is intentionally uninitialized, verifies exactly the documented 24-byte statistics region and untouched tail, then confirms the later job still completes. The added test is the only code change. The author reports Linux and Windows focused passes on the current head with a red control; conventions and Windows CI pass. No remaining blocker found.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5680313454 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12231#pullrequestreview-5680313454). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T09:19:11Z. **Review:** APPROVED --- Rechecked the rebased head `42146e81801ac93adac64ecc73fa69ce45f87617`. The test queues `GetStatistics` before a `GetInfo` job whose instance is intentionally uninitialized, verifies exactly the documented 24-byte statistics region and untouched tail, then confirms the later job still completes. The added test is the only code change. The author reports Linux and Windows focused passes on the current head with a red control; conventions and Windows CI pass. No remaining blocker found.
THEMANnt commented 2026-10-29 07:00:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-29T07:00:38Z.

Review: APPROVED


Reviewed 42146e81801ac93adac64ecc73fa69ce45f87617 against 82d5f01f28b3d63dd811f4424b3d5e4de5845eca. The AJM fixture submits a statistics job followed by a format-info job and checks exactly the 24-byte statistics write, the untouched trailing guard bytes and the following job result. Instance cleanup remains after completion. No actionable finding in this scoped test review.

Windows/GCC 15.3 Release: configured and built the registered target from pinned sources; focused CTest: 1 passed, 0 skipped. Checked that the fixture assertions remain active in Release. Production source is unchanged from the author base; baseline was source-compared, not rebuilt/rerun here. Matching cached dependency source pins and the existing matching FFmpeg package are used. No game, physical-console or GPU validation is claimed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693978716 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12231#pullrequestreview-5693978716). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-29T07:00:38Z. **Review:** APPROVED --- Reviewed `42146e81801ac93adac64ecc73fa69ce45f87617` against `82d5f01f28b3d63dd811f4424b3d5e4de5845eca`. The AJM fixture submits a statistics job followed by a format-info job and checks exactly the 24-byte statistics write, the untouched trailing guard bytes and the following job result. Instance cleanup remains after completion. No actionable finding in this scoped test review. Windows/GCC 15.3 Release: configured and built the registered target from pinned sources; focused CTest: 1 passed, 0 skipped. Checked that the fixture assertions remain active in Release. Production source is unchanged from the author base; baseline was source-compared, not rebuilt/rerun here. Matching cached dependency source pins and the existing matching FFmpeg package are used. No game, physical-console or GPU validation is claimed.
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!12231
No description provided.