Repository navigation
Tests: UI tests that render with wgpu take turns, so the Windows test run no longer crashes - #1292
Conversation
… run no longer crashes Harness::render creates a wgpu device on its first call, and egui_kittest prefers a CPU adapter. When cargo test runs several of these tests on parallel threads, the deckcraft-ui-egui test binary can exit with 0xc0000005 (STATUS_ACCESS_VIOLATION), so cargo xtask ci stops at its test step on Windows without cargo-nextest. The 16 tests that call render now hold one mutex for their whole run (crate::gpu_lock::gpu_lock, as in photocraft's testkit), so only one of them runs at a time.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Shared GPU lock crates/ui-egui/src/gpu_lock.rs, crates/ui-egui/src/lib.rs |
Adds a crate-visible mutex guard function with poison recovery. Tests check recovery after a panic and verify that concurrent holders do not overlap. |
Lock acquisition in rendering tests crates/ui-egui/src/*_tests.rs, crates/ui-egui/src/lib.rs |
Selected UI and screenshot tests acquire the shared lock before creating sessions or harnesses and rendering. |
Priority:
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix
Possibly related issues
- A PDF export that hangs on one core (fixed), and a 1.3–2.4× speed-up from swapping dependencies #1242 — Reports a parallel-test
STATUS_ACCESS_VIOLATIONcrash indeckcraft-ui-egui; this change serializes rendering tests that trigger the crash.
Suggested reviewers: nikitkara
Merge Risk: 
Minimal · up to 44d5a
-
The rendering tests are serialized as intended, and no issue requiring a fix before merge was found.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed -
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
On Windows without cargo-nextest,
cargo test -p deckcraft-ui-egui --liboften exits with 0xc0000005 (STATUS_ACCESS_VIOLATION), socargo xtask cistops at its test step. The tests that render pass with--test-threads=1. Several open pull requests name this crash as pre-existing (#806, #825, #940, #945).Harness::rendercreates a wgpu device on its first call, and egui_kittest prefers a CPU adapter. Whencargo testruns several of these tests on parallel threads, the test binary can exit with0xc0000005. Onmainat7be391a, on Windows 11 (x86-64):render, run in parallel, crashed in 7 of 8 runs;--test-threads=1passed in 5 of 5 runs;What changes:
crate::gpu_lock::gpu_lock()(test-only), a mutex that the tests that render hold for their whole run, so only one of them runs at a time, copied from photocraft'scrates/testkit/src/gpu.rs.render(three of them ignored screenshot writers) take it on their first line.Tests:
gpu_lock::tests::holders_take_turnsanda_panicked_holder_does_not_block_the_next_testcheck the lock itself.With the change, the 13 tests that call
renderpassed in 6 of 6 parallel runs, and the whole binary ran to the end in 4 of 4 parallel runs (255 passed). Each of those runs had one failure,replacefonts_tests::ribbon_button_opens_the_dialog_and_replaces, which also fails onmainand which #1043 fixes.A new test that calls
render()takes the lock on its first line.Checks:
cargo fmt --all -- --check,cargo clippy -p deckcraft-ui-egui --all-targets -- -D warnings,cargo xtask assetsandcargo xtask layers.On Windows 11 (x86-64) with rustc 1.99.1, on top of
mainat7be391a, with #1043 merged in:cargo xtask cipasses its 8 steps: 1,793 tests passed, 0 failed, 6 ignored.Without #1043, the gate stopped at its test step on
control_server::tests::a_pipelined_peer_still_reads_why_its_line_was_rejected. That test andcontrol_server::tests::blocked_ui_times_out_and_full_queue_is_busyfail intermittently on this machine onmainat7be391aas well (13 of 40 runs of thedeckcrafttest binary).git merge-treereports no conflicts withmainat7be391a.Summary by CodeRabbit