fix(tests): build the frame limit failure messages only when a check fails #14995

Merged
xXPBSXx merged 1 commit from upstream-pr/14995 into main 2026-11-03 05:12:51 +00:00
xXPBSXx commented 2026-11-02 08:55:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-11-02T08:55:26Z.


What

agc_frame_limit timed out in the nightly Sanitizers run on 2026-11-02 (run 41384606155, main 926f7dd492): ***Timeout 30.06 sec, and the run's summary lists no sanitizer report for it. The same test passed in 1.07 s on Linux in the normal build of 4569fe654a (run 41395467000).

The test spends its time building failure messages that are never shown. require(condition, reason) takes the message as a std::string, so every call builds it before the check, including the calls inside the loops: 8 limits × 1,000,000 frames in the deadline test, 100,000 frames in the overshoot test and 3 × 10,000 in the slow-game test, each message made of several std::to_string calls and concatenations. Under AddressSanitizer each of those allocations is instrumented.

This adds a require overload that takes a callable and builds the message only when the check fails, and uses it for the three checks inside those loops. The checks themselves, the messages and the TIMEOUT 30 are unchanged.

Changed: core/libs/prx/libSceAgcDriver/tests/FrameLimit.cpp only. No product code, no CMake change.

Rechecked on 2026-11-02 at 08:54 UTC: this head merges with main 88e804b0a7 without a conflict, and none of the 11 pull requests opened since 07:30 UTC (#14979 to #14993) changes FrameLimit.cpp.

Tested

The test executable built on its own with the flags the Sanitizers workflow gives it (g++ 13.3.0, -O3 -DNDEBUG -std=c++20 -g1 -fsanitize=undefined -fno-sanitize=vptr -fsanitize=address -fno-omit-frame-pointer -DANYPS5_ENABLE_ASAN=1) and run with the workflow's ASAN_OPTIONS, UBSAN_OPTIONS and APS5_SKIP_TIMING_TESTS, three runs each, on 2026-11-02 between 07:26 UTC and 07:31 UTC:

Build Before (main 4569fe654a) After
ASan and UBSan 17.63, 12.45, 15.24 s; again 12.22, 15.07, 12.05 s 0.20, 0.08, 0.08 s
No sanitizer 0.94, 0.95 s 0.03 s

All runs print frame limit tests passed. These local runs stay under the nightly's 30 s, so they do not reproduce the timeout; the CI runner, which runs four tests at once (ctest --parallel 4), was not measured. What they show is that building the messages is where the time goes: the change makes the sanitizer run 60 to 220 times faster (12.05 s / 0.20 s to 17.63 s / 0.08 s).

The test still fails when the pacer is wrong. With the extra nanosecond that FramePacer::step() adds for the carried remainder removed (++length), it fails both before and after this change with the same message, frame 3 at limit 30000 is presented at 99999999 instead of 100000000, now built by the lazy overload. With next set from the current time plus the wait instead of from the schedule, it fails both before and after in the late-frame test. Both mutations were made on copies; FrameLimit.hpp is unchanged.

tools/check_conventions.py --base upstream/main passes.

Overlap

All 1914 open PRs were checked on 2026-11-02 at 07:32 UTC against main 4569fe654a for FrameLimit.cpp, FrameLimit.hpp and agc_frame_limit_tests.cmake. Four list these files (#10351, #9588, #8630, #7694), each only through a merge of main: none of them changes the files against main, and none conflicts with this change. No open PR changes the test; #11566, which comes up in a search for agc_frame_limit, changes only tests/Graphics.cpp and tests/cmake/agc_driver_graphics_tests.cmake. It merges cleanly into main 88e804b0a7 (2026-11-02 08:07 UTC), which does not change these files or the Sanitizers workflow.

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

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5117589230 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14995). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-11-02T08:55:26Z. --- ### What `agc_frame_limit` timed out in the nightly Sanitizers run on 2026-11-02 (run 41384606155, `main` `926f7dd492`): `***Timeout 30.06 sec`, and the run's summary lists no sanitizer report for it. The same test passed in 1.07 s on Linux in the normal build of `4569fe654a` (run 41395467000). The test spends its time building failure messages that are never shown. `require(condition, reason)` takes the message as a `std::string`, so every call builds it before the check, including the calls inside the loops: 8 limits × 1,000,000 frames in the deadline test, 100,000 frames in the overshoot test and 3 × 10,000 in the slow-game test, each message made of several `std::to_string` calls and concatenations. Under AddressSanitizer each of those allocations is instrumented. This adds a `require` overload that takes a callable and builds the message only when the check fails, and uses it for the three checks inside those loops. The checks themselves, the messages and the `TIMEOUT 30` are unchanged. Changed: `core/libs/prx/libSceAgcDriver/tests/FrameLimit.cpp` only. No product code, no CMake change. Rechecked on 2026-11-02 at 08:54 UTC: this head merges with `main` `88e804b0a7` without a conflict, and none of the 11 pull requests opened since 07:30 UTC (#14979 to #14993) changes `FrameLimit.cpp`. ### Tested The test executable built on its own with the flags the Sanitizers workflow gives it (`g++ 13.3.0`, `-O3 -DNDEBUG -std=c++20 -g1 -fsanitize=undefined -fno-sanitize=vptr -fsanitize=address -fno-omit-frame-pointer -DANYPS5_ENABLE_ASAN=1`) and run with the workflow's `ASAN_OPTIONS`, `UBSAN_OPTIONS` and `APS5_SKIP_TIMING_TESTS`, three runs each, on 2026-11-02 between 07:26 UTC and 07:31 UTC: | Build | Before (`main` `4569fe654a`) | After | |---|---|---| | ASan and UBSan | 17.63, 12.45, 15.24 s; again 12.22, 15.07, 12.05 s | 0.20, 0.08, 0.08 s | | No sanitizer | 0.94, 0.95 s | 0.03 s | All runs print `frame limit tests passed`. These local runs stay under the nightly's 30 s, so they do not reproduce the timeout; the CI runner, which runs four tests at once (`ctest --parallel 4`), was not measured. What they show is that building the messages is where the time goes: the change makes the sanitizer run 60 to 220 times faster (12.05 s / 0.20 s to 17.63 s / 0.08 s). The test still fails when the pacer is wrong. With the extra nanosecond that `FramePacer::step()` adds for the carried remainder removed (`++length`), it fails both before and after this change with the same message, `frame 3 at limit 30000 is presented at 99999999 instead of 100000000`, now built by the lazy overload. With `next` set from the current time plus the wait instead of from the schedule, it fails both before and after in the late-frame test. Both mutations were made on copies; `FrameLimit.hpp` is unchanged. `tools/check_conventions.py --base upstream/main` passes. ### Overlap All 1914 open PRs were checked on 2026-11-02 at 07:32 UTC against `main` `4569fe654a` for `FrameLimit.cpp`, `FrameLimit.hpp` and `agc_frame_limit_tests.cmake`. Four list these files (#10351, #9588, #8630, #7694), each only through a merge of `main`: none of them changes the files against `main`, and none conflicts with this change. No open PR changes the test; #11566, which comes up in a search for `agc_frame_limit`, changes only `tests/Graphics.cpp` and `tests/cmake/agc_driver_graphics_tests.cmake`. It merges cleanly into `main` `88e804b0a7` (2026-11-02 08:07 UTC), which does not change these files or the Sanitizers workflow. ### Checklist - [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 AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
BunnyFl commented 2026-11-02 11:05:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T11:05:09Z.

Review: APPROVED


Looks right to me. The std::invocable overload only matches the three lambdas. The existing calls pass a std::string or a literal, which isn't invocable, so they still pick the original overload, and the messages and conditions are unchanged. pacer.Admit(now) in the slow-game loop is still evaluated once, in the condition.

Tested on Windows 11, WinLibs GCC 15.2.0, Release (no sanitizer), with head bf74e82641 merged onto main: agc_frame_limit passes in 0.15 s, against 1.46 s with main's FrameLimit.cpp. Even without ASan the eager message building dominates, which supports your Sanitizers timeout analysis. I didn't run the ASan/UBSan build itself.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5735595266 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14995#pullrequestreview-5735595266). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-02T11:05:09Z. **Review:** APPROVED --- Looks right to me. The `std::invocable` overload only matches the three lambdas. The existing calls pass a `std::string` or a literal, which isn't invocable, so they still pick the original overload, and the messages and conditions are unchanged. `pacer.Admit(now)` in the slow-game loop is still evaluated once, in the condition. Tested on Windows 11, WinLibs GCC 15.2.0, Release (no sanitizer), with head `bf74e82641` merged onto `main`: `agc_frame_limit` passes in 0.15 s, against 1.46 s with `main`'s `FrameLimit.cpp`. Even without ASan the eager message building dominates, which supports your Sanitizers timeout analysis. I didn't run the ASan/UBSan build itself.
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!14995
No description provided.