Tests: wait for the late page list instead of sleeping #2738

Open
github-bot wants to merge 1 commit from github-bot/gh-2738 into main AGit
Owner

@⁠Therecalloftheonion on GitHub · 2026-11-25 19:23 UTC · original
Therecalloftheonion:pr/dstorage-late-list → main · +21 −1 · 1 files · 1 commits · open

What

The late page-list test no longer sleeps 2 ms and hopes the copy has not started.

The copy reports the destination whose page list it found empty and started waiting for; the test fills the list only then. This deterministically covers the retry path instead of racing it.

Why

a_page_list_filled_after_its_request_starts failed intermittently under parallel test load: a 2 ms sleep can arrive after the 8 ms retry window. With the counter the fill happens while the copy is waiting.

Testing

  • cargo test -p victory-hle --lib: passed repeatedly (5 consecutive runs)
  • cargo test -p victory-hle --lib modules::dstorage: passed repeatedly
**@⁠Therecalloftheonion** on GitHub · 2026-11-25 19:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2738) `Therecalloftheonion:pr/dstorage-late-list` → `main` · +21 −1 · 1 files · 1 commits · open ## What The late page-list test no longer sleeps 2 ms and hopes the copy has not started. The copy reports the destination whose page list it found empty and started waiting for; the test fills the list only then. This deterministically covers the retry path instead of racing it. ## Why `a_page_list_filled_after_its_request_starts` failed intermittently under parallel test load: a 2 ms sleep can arrive after the 8 ms retry window. With the counter the fill happens while the copy is waiting. ## Testing - `cargo test -p victory-hle --lib`: passed repeatedly (5 consecutive runs) - `cargo test -p victory-hle --lib modules::dstorage`: passed repeatedly
The test slept 2 ms and raced the 8 ms window in which a copy re-reads a page list the title has not filled yet; under load the fill could arrive after the window. Have the copy report when it found the list empty, then fill it, so the retry path is covered deterministically.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:13:07 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 20:06 UTC · original

Makes the flaky test deterministic: the filler spins on LATE_DESTINATION (set exactly when the copy first finds the empty page list) instead of racing a fixed 2 ms sleep against the 8 ms retry window. 5 s bound with an assert means a broken wait fails loudly rather than timing out silently.

**@⁠kotekompotek** on GitHub · 2026-11-25 20:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2738#issuecomment-7173196941) Makes the flaky test deterministic: the filler spins on LATE_DESTINATION (set exactly when the copy first finds the empty page list) instead of racing a fixed 2 ms sleep against the 8 ms retry window. 5 s bound with an assert means a broken wait fails loudly rather than timing out silently.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 20:14 UTC · original

Reviewed and verified 9caeb474 (merged cleanly onto main 13f91ca) on Windows 11 (rustc 1.98.1 MSVC).

  • Replacing the fixed 2 ms sleep with the LATE_DESTINATION AtomicUsize rendezvous (SeqCst) and a 5 s timeout eliminates the timing flake without deadlock risk (minor nit: resetting LATE_DESTINATION to 0 at the end of the test would keep it spotless if future tests ever share it).
  • cargo test -p victory-hle --lib --locked (3 consecutive full parallel runs): 3/3 passed (146 passed, 0 failed + crash_child 1/1 each run).
  • cargo test -p victory-hle --lib --locked -- modules::dstorage::tests:: (3 consecutive runs): 3/3 passed (16/16 each run).
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings: 0 warnings; cargo xtask policy: 184 files ok.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 20:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2738#issuecomment-7173382495) Reviewed and verified `9caeb474` (merged cleanly onto `main` `13f91ca`) on Windows 11 (`rustc 1.98.1` MSVC). - Replacing the fixed 2 ms sleep with the `LATE_DESTINATION` `AtomicUsize` rendezvous (`SeqCst`) and a 5 s timeout eliminates the timing flake without deadlock risk (minor nit: resetting `LATE_DESTINATION` to `0` at the end of the test would keep it spotless if future tests ever share it). - `cargo test -p victory-hle --lib --locked` (3 consecutive full parallel runs): **3/3 passed** (`146 passed, 0 failed` + `crash_child` `1/1` each run). - `cargo test -p victory-hle --lib --locked -- modules::dstorage::tests::` (3 consecutive runs): **3/3 passed** (`16/16` each run). - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`: **0 warnings**; `cargo xtask policy`: **184 files ok**.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:23 UTC · original

Automated triage for the maintainers.

This makes a_page_list_filled_after_its_request_starts (crates/victory-hle/src/modules/dstorage.rs) deterministic: into_destination records the destination whose page list it found empty in a #[cfg(test)] LATE_DESTINATION, and the test's filler thread writes the page number only once that happens, instead of a fixed 2 ms sleep that can land before the copy starts (so the retry path is never exercised) or after the 8 ms retry window. I checked that the recorded request.destination is the same leaked list address the test waits on, that the hook compiles out of non-test builds, and that the 5 s bound fails loudly rather than hanging. CI (check) passes.

This is a recommendation for a maintainer to look, not an approval.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2738#issuecomment-7177484256) <!-- victory-triage v1 head=9caeb474baebe0804caff01830788aeb058b2e64 verdict=merge-candidate at=2026-11-25T23:22:54Z --> Automated triage for the maintainers. This makes `a_page_list_filled_after_its_request_starts` (`crates/victory-hle/src/modules/dstorage.rs`) deterministic: `into_destination` records the destination whose page list it found empty in a `#[cfg(test)]` `LATE_DESTINATION`, and the test's filler thread writes the page number only once that happens, instead of a fixed 2 ms sleep that can land before the copy starts (so the retry path is never exercised) or after the 8 ms retry window. I checked that the recorded `request.destination` is the same leaked list address the test waits on, that the hook compiles out of non-test builds, and that the 5 s bound fails loudly rather than hanging. CI (`check`) passes. This is a recommendation for a maintainer to look, not an approval. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 12:50 UTC · original

NVIDIA full-suite run, to go with the reports above by fuzeofficlal, since none of them names a GPU run. Tested exact head 9caeb47 (on its base da82e44).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 773 passed, 0 failed, 9 ignored.
  • No new #[test] functions in the diff.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-26 12:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/2738#issuecomment-7192521749) NVIDIA full-suite run, to go with the reports above by fuzeofficlal, since none of them names a GPU run. Tested exact head `9caeb47` (on its base `da82e44`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **773 passed, 0 failed, 9 ignored**. - No new `#[test]` functions in the diff. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 18:09 UTC · original · approved these changes

Reviewed the diff and verified locally on Windows 11 x64:

  • Synchronizing the filler thread on #[cfg(test)] LATE_DESTINATION removes the flaky 2 ms sleep race in a_page_list_filled_after_its_request_starts and guarantees the late-list retry path is exercised.
  • cargo test -p victory-hle --lib modules::dstorage:: -- --test-threads=1: 16 passed, 0 failed.
  • cargo clippy -p victory-hle --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 18:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/2738#pullrequestreview-6078800929) · **approved these changes** Reviewed the diff and verified locally on Windows 11 x64: - Synchronizing the filler thread on `#[cfg(test)] LATE_DESTINATION` removes the flaky 2 ms sleep race in `a_page_list_filled_after_its_request_starts` and guarantees the late-list retry path is exercised. - `cargo test -p victory-hle --lib modules::dstorage:: -- --test-threads=1`: 16 passed, 0 failed. - `cargo clippy -p victory-hle --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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/2738/head:github-bot/gh-2738'
git switch 'github-bot/gh-2738'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2738'
git switch 'github-bot/gh-2738'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2738'
git switch 'github-bot/gh-2738'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2738'
git switch 'main'
git merge --squash 'github-bot/gh-2738'
git switch 'main'
git merge --ff-only 'github-bot/gh-2738'
git switch 'main'
git merge 'github-bot/gh-2738'
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!2738
No description provided.