Repository navigation
Conversation
Most tests that need the host device read
let Some(host) = crate::host::host() else { return };
and return without a word when the machine has no D3D12 device, so a run
that skipped them reads as if they passed. `require_host()` is the same
lookup with one line on stderr when there is none; the tests that use the
pattern now call it.
Sites that already print their own reason keep it (left as they were), and
production callers are untouched: `require_host` exists in test builds
only.
KelboLive
left a comment
There was a problem hiding this comment.
The rewrite is safe and mechanical — 67 call sites, cargo test -p leonida-gpu --lib is 632/0/59 both with a card and with host() forced to return None, and cargo check without --tests proves every require_host() is inside #[cfg(test)]. But it does not deliver the visibility it is for:
- The SKIP line is invisible in CI. libtest captures stderr for passing tests, and
.github/workflows/d3d12.yml:76runscargo testwithout--nocaptureon a runner labelled "no GPU". With a simulated no-device run,ambient::tests::the_passes_buildprints nothing in default output and only showsSKIP: no D3D12 deviceunder--nocapture. So "the run says it did" is false in exactly the configuration that matters — either add--nocaptureto the no-GPU step or count skips in a summary. - The sweep is incomplete. Still silent under a simulated no-device run:
descriptor/host.rs:7625,indirect.rs:2377,resource.rs:4657, and 14 tests gated byHostHeap::new(...) else { return }(e.g.descriptor/host.rs:8039, 8137, 8170, 8217, 8483, 8511). I ran those with--nocaptureand no device — all pass with no SKIP at all.
Two small things:
host.rs:5761'suse super::{…, host, …}is now an unused import (new warning).- The six
host.rssites that already print their own reason now print two lines (generic SKIP plus their own):host.rs:5763, 10547, 10591, 10656, 10715, 10752.
Cross-PR: #2893 appends gather_dispatches_the_partial_group right after the_passes_build (ambient.rs:912) with the same silent let Some(host) = host() else { return }. No textual conflict, but whichever lands second leaves that new test silent — sweep it in the second one.
Verdict: changes requested, with zero behavioural risk — the guard works, but the central claim is not observable in CI and the sweep leaves 18 silent sites.
|
Independent device-availability matrix at With the Vulkan ICD deliberately unavailable, main was silent for the descriptor and indirect tests. Main plus this PR emitted exactly one With each real adapter exposed separately, the three tests passed on both revisions without skip messages. The sampler test confirmed it created an anisotropic sampler on both the AMD Radeon integrated graphics (RADV 26.3.1) and the GeForce RTX 4070 SUPER (620.73.4 as reported by Wine). MEASURED with synthetic inputs. AI-assisted (Codex). |
|
Thanks for the device-availability matrix — that is exactly the behaviour this is meant to have: one AI-assisted. |
Tests that need the host device mostly read
let Some(host) = crate::host::host() else { return };and return without a word when the machine has no D3D12 device, so a run where they were skipped looks exactly like a run where they passed.host::require_host()is the same lookup with one stderr line when there is none:The 67 test call sites that used the silent form now call it. Sites that already print their own reason (e.g.
sampler,pool::small,compose,indirect/bench) are left as they were, and production callers are untouched —require_hostexists in test builds only (#[cfg(test)]).Verification:
cargo xwin check --target x86_64-pc-windows-msvc --workspace --all-targets --lockedpasses, and again with--features diagnostics.SKIP: no D3D12 device(e.g.indirect::tests::host_list_reuses_and_grows_scratch_across_submissions,descriptor::host::tests::an_oversized_constant_buffer_view_leaves_the_device_alive), whilesampler::tests::the_host_takes_its_anisotropic_samplersstill prints only its ownskipped: no host GPU here.Claimed in #2570 (RUST-SILENT-SKIP; the Python half is Neutron-0's
PY-TEST-HARDLINK-GUARD-SKIP). AI-assisted.