test(agc): keep sampled cache fixture registrations separate #4159

Merged
MarcZX10 merged 1 commit from upstream-pr/4159 into main 2026-10-12 02:47:19 +00:00
MarcZX10 commented 2026-10-12 00:13:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T00:13:05Z.


What

Fixes #4141. The sampled-cache eviction test allocates two 3 MiB blocks independently and registers both. If the allocations are adjacent, guest registration coalescing makes the supposed snapshot a view of the imported storage image; its sampled-cache byte charge is zero and the test divides by zero.

Reserve an extra unregistered 64 KiB after each block so separately registered regions cannot coalesce, and assert the snapshot has a nonzero charge before using it as a divisor.

Tested

Linux, GCC 12.2, Release:

  • cmake --build /tmp/AnyPS5-sampled-fixture-4141-build --target agc_driver_sampled_cache_budget_tests -j4 passed.
  • ctest --test-dir /tmp/AnyPS5-sampled-fixture-4141-build -R agc_driver_sampled_cache_budget --output-on-failure passed (2/2).
  • python3 tools/check_conventions.py --base upstream/main passed.

Checklist

  • Based on current main; no other open PR implemented this when #4159 was opened. A later PR, #4161, carries a substantially identical change; the authors have been asked to coordinate.
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw or are listed in TechnicalDebt
  • No notes, investigation files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes; investigation, implementation and testing, reviewed by MarcZX100
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4823430154 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4159). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T00:13:05Z. --- ### What Fixes #4141. The sampled-cache eviction test allocates two 3 MiB blocks independently and registers both. If the allocations are adjacent, guest registration coalescing makes the supposed snapshot a view of the imported storage image; its sampled-cache byte charge is zero and the test divides by zero. Reserve an extra unregistered 64 KiB after each block so separately registered regions cannot coalesce, and assert the snapshot has a nonzero charge before using it as a divisor. ### Tested Linux, GCC 12.2, Release: - `cmake --build /tmp/AnyPS5-sampled-fixture-4141-build --target agc_driver_sampled_cache_budget_tests -j4` passed. - `ctest --test-dir /tmp/AnyPS5-sampled-fixture-4141-build -R agc_driver_sampled_cache_budget --output-on-failure` passed (2/2). - `python3 tools/check_conventions.py --base upstream/main` passed. ### Checklist - [x] Based on current `main`; no other open PR implemented this when #4159 was opened. A later PR, #4161, carries a substantially identical change; the authors have been asked to coordinate. - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw or are listed in TechnicalDebt - [x] No notes, investigation files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes; investigation, implementation and testing, reviewed by MarcZX100
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!4159
No description provided.