Skip to main content

assert_absent_device_was_counted

Function assert_absent_device_was_counted 

Source
pub fn assert_absent_device_was_counted(floor: u64) -> u64
Expand description

Assert that this thread’s absent-device skip was recorded, and return the count observed.

This is the minimum a gated test owes on its device-free path. A site that takes GpuTestGate::AbsentDevice and returns has executed zero assertions, which is the whole of #2422; calling this makes the count itself the thing under test, so the skip is verified to have been recorded rather than merely logged.

The comparison is deliberately monotone (>= floor + 1, not == floor + 1). The counter is process-wide and gated tests run concurrently under --test-threads, so a sibling’s increment lands between another test’s read and its own increment. An exact-delta assertion on a shared atomic is a flake, and a flaky guard on a skip path is worse than none — it teaches readers to re-run until green.

This is measured, not anticipated: with the two gate self-tests alone and an exact-delta assertion, cargo test -p gam-gpu --lib tests_gpu_test_gate_2422 -- --test-threads=8 failed 5 of 12 runs on a device-free host (left: 2, right: 1 — both tests incremented before either read back). Two callers were enough; there are now a dozen.