Tests: wait for the late page list instead of sleeping #2736
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2738"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Therecalloftheonion on 2026-11-25T19:23:49Z.
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_startsfailed 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 repeatedlyImported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T20:06:19Z.
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.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T20:14:31Z.
Reviewed and verified
9caeb474(merged cleanly ontomain13f91ca) on Windows 11 (rustc 1.98.1MSVC).LATE_DESTINATIONAtomicUsizerendezvous (SeqCst) and a 5 s timeout eliminates the timing flake without deadlock risk (minor nit: resettingLATE_DESTINATIONto0at 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_child1/1each run).cargo test -p victory-hle --lib --locked -- modules::dstorage::tests::(3 consecutive runs): 3/3 passed (16/16each run).cargo clippy -p victory-hle --all-targets --locked -- -D warnings: 0 warnings;cargo xtask policy: 184 files ok.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T23:23:01Z.
Automated triage for the maintainers.
This makes
a_page_list_filled_after_its_request_starts(crates/victory-hle/src/modules/dstorage.rs) deterministic:into_destinationrecords 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 recordedrequest.destinationis 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
Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T12:50:05Z.
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 baseda82e44).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo 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.#[test]functions in the diff.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#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_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T18:09:38Z.
Review: APPROVED
Reviewed the diff and verified locally on Windows 11 x64:
#[cfg(test)] LATE_DESTINATIONremoves the flaky 2 ms sleep race ina_page_list_filled_after_its_request_startsand 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).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T01:46:34Z.
Review: APPROVED
Reviewed
9caeb474baebe0804caff01830788aeb058b2e64.LGTM — signaling
LATE_DESTINATIONunder#[cfg(test)]right asinto_destinationenters thepages.contains(&0)retry loop removes the blind2mssleep race ina_page_list_filled_after_its_request_startscleanly, and leaking the per-test[0usize; 1]page list gives each run a distinct pointer address.Verified locally:
cargo xtask policy(191 files ok) andcargo clippy -p victory-hle --all-targets/--all-features(-D warnings) pass cleanly.cargo test -p victory-hle --lib modules::dstorage::passed 5/5 default runs and 10/10 parallel stress runs (-- --test-threads=8, 16 passed per run).Non-blocking notes:
rustfmt --edition 2024 --checkflags import ordering atcrates/victory-hle/src/modules/dstorage.rs:25-27(#[cfg(test)] use std::sync::atomic::AtomicUsize;sorts ahead of the groupedstd::sync::atomic::{...}import).write_volatilein the test thread paired with the non-atomic slice re-read in the worker still has no happens-before edge in Rust's memory model, and callingfiller.join()before assertingwait(array, 0) == S_OKwould avoid detaching the helper thread on failure.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.