Tests: allow the frame clock to skip ticks after a late frame #2265

Open
github-bot wants to merge 3 commits from github-bot/gh-2265 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 09:22 UTC · original
andrewpozdnakov7-jpg:test/frame-pacing-skipped-ticks → main · +61 −31 · 1 files · 3 commits · open

The frame-pacing fixture failed during parallel Windows tests when a thread was scheduled more than 50 ms late or a flip missed a tick. The frame clock reserves a distinct tick for each successful flip. It can skip one when the caller arrives late.

The fixture now keeps the consecutive frame-token assertion and checks that every flip takes a later tick. A delay of three intervals before one flip exercises a missed tick on every run.

On 940d32f with the same delay and the old assertions, all 10 runs failed, for example with flip ticks [4, 5, 9, 10]. With the new assertions, both frame tests passed in all 50 runs. Full victory-gpu on WARP: 146 passed, 0 failed, 2 ignored. Strict Clippy with and without diagnostics and the staged policy check passed.

303be14 also covers the origin poll from the #2729 CI failure. The test now controls elapsed time on its own thread while calling the normal frame API. With the same delayed poll on 013f797 (98578ea combined with main 13f91ca), the old TIMEOUT assertion received S_OK in all 10 attempts. The revised test checks that the late poll consumes the elapsed tick, the next poll times out without changing its token, and the flag still starts an early frame. The flip cases use the same controlled time.

Both frame tests passed in 50 parallel repetitions. The full GPU suite on WARP passed 198 tests with one ignored under each debug setting. Strict Clippy in both feature configurations and asset policy passed.

Please preserve the Git author when reapplying the test. If you fold it into your own commit, please add:

Co-authored-by: andrewpozdnakov7-jpg [email protected]

AI-assisted. Synthetic tests only.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 09:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2265) `andrewpozdnakov7-jpg:test/frame-pacing-skipped-ticks` → `main` · +61 −31 · 1 files · 3 commits · open The frame-pacing fixture failed during parallel Windows tests when a thread was scheduled more than 50 ms late or a flip missed a tick. The frame clock reserves a distinct tick for each successful flip. It can skip one when the caller arrives late. The fixture now keeps the consecutive frame-token assertion and checks that every flip takes a later tick. A delay of three intervals before one flip exercises a missed tick on every run. On 940d32f with the same delay and the old assertions, all 10 runs failed, for example with flip ticks [4, 5, 9, 10]. With the new assertions, both frame tests passed in all 50 runs. Full victory-gpu on WARP: 146 passed, 0 failed, 2 ignored. Strict Clippy with and without diagnostics and the staged policy check passed. [303be14](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/303be14ec53ab5ca1ce2ea9a0e246a7aa0b785e7) also covers the origin poll from the [#2729 CI failure](https://github.com/Marvisak/VIctory/actions/runs/45684843740/job/139454597062). The test now controls elapsed time on its own thread while calling the normal frame API. With the same delayed poll on 013f797 (98578ea combined with main 13f91ca), the old TIMEOUT assertion received S_OK in all 10 attempts. The revised test checks that the late poll consumes the elapsed tick, the next poll times out without changing its token, and the flag still starts an early frame. The flip cases use the same controlled time. Both frame tests passed in 50 parallel repetitions. The full GPU suite on WARP passed 198 tests with one ignored under each debug setting. Strict Clippy in both feature configurations and asset policy passed. Please preserve the Git author when reapplying the test. If you fold it into your own commit, please add: Co-authored-by: andrewpozdnakov7-jpg <[email protected]> AI-assisted. Synthetic tests only.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:00:20 +00:00
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-25 10:29 UTC · original

Independent local verification (Windows, Rust 1.100.0/MSVC, head 98578ea, no game data): cargo test -p victory-gpu --lib frame::tests --locked -> 2 tests passed (waits_begun_together_take_different_ticks, waits_end_on_ticks_and_count_frames), exit 0. Only two fetch_update deprecation warnings, unrelated to this change. I did not run the flaky assertion in a loop or on a loaded machine, so the anti-flake claim is not independently stress-tested here. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only unit tests). No game data, assets or extracted content used.

**@⁠cloph-dsp** on GitHub · 2026-11-25 10:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2265#issuecomment-7159762383) Independent local verification (Windows, Rust 1.100.0/MSVC, head 98578ea, no game data): `cargo test -p victory-gpu --lib frame::tests --locked` -> 2 tests passed (`waits_begun_together_take_different_ticks`, `waits_end_on_ticks_and_count_frames`), exit 0. Only two `fetch_update` deprecation warnings, unrelated to this change. I did not run the flaky assertion in a loop or on a loaded machine, so the anti-flake claim is not independently stress-tested here. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only unit tests). No game data, assets or extracted content used.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 13:31 UTC · original · edited 2026-11-25 20:21 UTC

Automated triage for the maintainers.

Merge candidate (test-only). The head moved to 303be14 (main merged in, plus a new test commit). The frame tests in crates/victory-gpu/src/frame.rs no longer depend on scheduling: next_tick gets a #[cfg(test)] hook (tests::elapsed) that lets a test set the elapsed time on its own thread, and both frame tests take a shared CLOCK_TEST lock. I traced the new exact assertions against next_tick on main: the late origin poll at 6 ms takes the passed tick, the next zero-timeout poll times out without a token, the flips at 5/10/20/25 ms land on ticks +0/+1/+3/+4, and the late flip at 40 ms takes the latest passed tick, with the next one 5 ms out. These are the behaviours the doc comment on next_tick describes, so the tests check the intended contract, not just the current output. The release build is unaffected. CI check passes on this head and the branch merges cleanly.

Reply to the author: the controlled-time version is an improvement over the earlier sleep-based one, and it covers the origin-poll failure from the linked CI run. The verdict stays merge-candidate.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 13:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/2265#issuecomment-7163905210) · edited 2026-11-25 20:21 UTC <!-- victory-triage v1 head=303be14ec53ab5ca1ce2ea9a0e246a7aa0b785e7 verdict=merge-candidate at=2026-11-25T20:18:54Z --> Automated triage for the maintainers. **Merge candidate (test-only).** The head moved to `303be14` (main merged in, plus a new test commit). The frame tests in `crates/victory-gpu/src/frame.rs` no longer depend on scheduling: `next_tick` gets a `#[cfg(test)]` hook (`tests::elapsed`) that lets a test set the elapsed time on its own thread, and both frame tests take a shared `CLOCK_TEST` lock. I traced the new exact assertions against `next_tick` on `main`: the late origin poll at 6 ms takes the passed tick, the next zero-timeout poll times out without a token, the flips at 5/10/20/25 ms land on ticks +0/+1/+3/+4, and the late flip at 40 ms takes the latest passed tick, with the next one 5 ms out. These are the behaviours the doc comment on `next_tick` describes, so the tests check the intended contract, not just the current output. The release build is unaffected. CI `check` passes on this head and the branch merges cleanly. Reply to the author: the controlled-time version is an improvement over the earlier sleep-based one, and it covers the origin-poll failure from the linked CI run. The verdict stays merge-candidate. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 19:37 UTC · original

303be14 also covers the origin poll from the #2729 CI failure. The test now controls elapsed time on its own thread while calling the normal frame API. With the same delayed poll on 013f797 (98578ea combined with main 13f91ca), the old TIMEOUT assertion received S_OK in all 10 attempts. The revised test checks that the late poll consumes the elapsed tick, the next poll times out without changing its token, and the flag still starts an early frame. The flip cases use the same controlled time.

Both frame tests passed in 50 parallel repetitions. The full GPU suite on WARP passed 198 tests with one ignored under each debug setting. Strict Clippy in both feature configurations and asset policy passed.

Please retain the Git author if you reapply the test. If you fold it into another commit, please add Co-authored-by: andrewpozdnakov7-jpg [email protected].

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 19:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2265#issuecomment-7172550467) [303be14](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/303be14ec53ab5ca1ce2ea9a0e246a7aa0b785e7) also covers the origin poll from the [#2729 CI failure](https://github.com/Marvisak/VIctory/actions/runs/45684843740/job/139454597062). The test now controls elapsed time on its own thread while calling the normal frame API. With the same delayed poll on 013f797 (98578ea combined with main 13f91ca), the old TIMEOUT assertion received S_OK in all 10 attempts. The revised test checks that the late poll consumes the elapsed tick, the next poll times out without changing its token, and the flag still starts an early frame. The flip cases use the same controlled time. Both frame tests passed in 50 parallel repetitions. The full GPU suite on WARP passed 198 tests with one ignored under each debug setting. Strict Clippy in both feature configurations and asset policy passed. Please retain the Git author if you reapply the test. If you fold it into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2265/head:github-bot/gh-2265'
git switch 'github-bot/gh-2265'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2265'
git switch 'github-bot/gh-2265'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2265'
git switch 'github-bot/gh-2265'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2265'
git switch 'main'
git merge --squash 'github-bot/gh-2265'
git switch 'main'
git merge --ff-only 'github-bot/gh-2265'
git switch 'main'
git merge 'github-bot/gh-2265'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2265
No description provided.