Skip to main content

Module test_gate

Module test_gate 

Source
Expand description

One gate for every GPU-conditional test (#2422); pub because the tests that need it live in other crates. One gate for every GPU-conditional test, so an absent device is RECORDED rather than reported as a pass (#2422).

41 tests could report 1 passed having executed zero assertions, 37 of them because a CPU-only runner takes a bare return; before the first assertion. sphere_gpu_end_to_end_fit_hill_climb_10x_vs_cpu was green for its entire life and had never appeared in MASTER_FAILURES; on a real A10 it misses its >=10x gate at 0.51x. A test that passes having verified nothing is worse than a missing test, because a reader counts it as coverage.

Five different skip idioms had grown up across fifteen files, and they disagreed on the two things that matter:

  • A device FAULT is not an absent device. Twenty-one sites wrote let Some(rt) = GpuRuntime::resolve(..) else { return; }, and that else also swallows Err(..). A machine WITH a GPU whose driver is broken therefore reported the same silent pass as a machine without one. This gate panics on Err unconditionally: a fault is a failure, always.
  • A lane that demanded a GPU must not skip. crate::global_policy already carries that demand, so GpuPolicy::Required turns an absent device into a panic here. A GPU lane sets the policy once and every gated test in the process becomes mandatory — no per-test opt-in, and no environment variable (env::var is banned in this tree).

What remains — Auto/Off with no device — is a real skip, and it is counted. crate::test_gate::skipped_for_absent_device lets a suite assert how many gated tests declined to run, so “37 passed” can no longer hide “37 verified nothing”.

Enums§

GpuTestGate
The outcome of asking for a device in a test.

Constants§

SKIPPED_MARKER
The one line a skipped GPU test prints, and the one string a CI ledger step has to grep for.

Functions§

assert_absent_device_was_counted
Assert that this thread’s absent-device skip was recorded, and return the count observed.
gpu_for_test
Resolve a runtime for a GPU-conditional test.
skipped_for_absent_device
How many gated tests have declined to run in this process for want of a device.