Repository navigation
ci(test): serialize only GPU readbacks, run tests in parallel again - #236
Merged
Merged
Conversation
`.cargo/config.toml` set RUST_TEST_THREADS=1 for every test in the workspace because UI tests reading pixels back from the shared offscreen GPU device came back blank when run in parallel. That tripled the CI test step on every platform and in coverage (about 5 to 15 minutes since AlienTechSoftware#221). Only the readback needs to wait its turn: ui.rs now takes pictures through support::gpu::render, which holds a lock around Harness::render, and icons_visual.rs does the same around its single readback on its own shared device. Building windows, clicking and typing run on every test thread again. The website pipeline also restores the Rust dependency cache (saved only from main, which the nightly release builds), as ci.yml already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4im4p9XKJUrt6XFpFMUox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Since #221,
.cargo/config.tomlsetsRUST_TEST_THREADS = "1"for the whole workspace, because the UI tests' pixel readbacks from the shared offscreen GPU device came back blank when run in parallel. That made every test in every crate run one at a time. The CI test step went from about 5 minutes to about 15 on Linux, Windows and macOS, and coverage went from about 6 to about 16. Every run before 82474fa showed the first numbers and every run from #221 on shows the second (job timings from the Actions API).Only the readback has to wait its turn, so that's all this locks:
crates/ui-egui/tests/support/gpu.rsgetsrender(h), which holds a process-wide lock aroundHarness::render. All 17 picture readbacks inui.rs(includingreview) go through it. Building windows, stepping, clicking and typing still run on every test thread, and that's most of the suite's time.icons_visual.rsshares its own device the same way, so its one readback takes the same kind of lock.RUST_TEST_THREADSis removed, so every other test binary runs in parallel again.website-pipeline.ymlrestoresSwatinem/rust-cache(same pinned SHA as ci.yml). It only saves frommain, which the nightly release builds every night, so PR builds of the WASM demo stop compiling every dependency from scratch.Quality level L3 (see SKILLS/nc-devx/SKILL.md)
mainand has no merge commitscargo xtask cipassescoveragejob's warnings are read;cargo xtask coverage --updateis in this pull request if coverage rose (test-only change, no product code touched)CommandSpecwith a test (not applicable)assets/ordocs/images/(not applicable)How it was checked
On Linux (Ubuntu 24.04, mesa lavapipe, same packages as CI):
ui.rsrun (255 tests)RUST_TEST_THREADS=1, as onmain)cargo test(ui+icons_visual), with this lockThe lock costs nothing measurable.
cargo xtask ci(fmt, clippy, test, i18n-audit, layers, assets, docs, text, demo-check) passed end to end on this branch.Not checked: I couldn't reproduce the blank readbacks from #221 on lavapipe even without the lock, so I couldn't confirm the lock on the hardware GPU where they happened. If they come back there, the next step would be to also hold the lock while windows are stepped (texture uploads), still per test rather than per workspace. This PR's CI runs on Windows and macOS will show it on those runners.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Y4im4p9XKJUrt6XFpFMUox