From 2cf598487ca55382264f0a4888fd9356f893c0a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 30 Aug 2026 16:32:23 +0300 Subject: [PATCH] test(av1): pin the four gates that turn a decode error into a SKIP A gate named ..._decodes_pixel_exact that cannot decode has failed. Four of them instead print SKIP and return, which keeps the suite green while the gate proves nothing -- the same vacuum as a gate whose feature never fires, reached from the other side. Found by sweeping the class after lane-palette's new gate did it too (it SKIPped on a pixel mismatch it had already diagnosed). Pinned rather than converted: turning them into hard failures without the attempt-loop pattern the newer gates use would trade a silent gate for a flaky one, and five lanes are editing stream.rs right now. The list cannot grow, and each entry comes off as its gate is converted. Negative-checked: dropping one entry fails naming that gate. Suite 243/0. --- crates/ec-av1/src/refusal_inventory.rs | 57 +++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 42b4bed6..f48b900b 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -70,9 +70,27 @@ const REFUSALS: &[&str] = &[ "filter intra on a HORZ/VERT strip (this decoder predicts square-only)", ]; +/// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than +/// a test failure. +/// +/// A gate named `..._decodes_pixel_exact` that cannot decode has failed, and +/// swallowing the error keeps the suite green while the gate proves nothing -- +/// the same vacuum as a gate whose feature never fires, arrived at from the +/// other side. These four predate the attempt-loop pattern the newer gates use +/// (encode several fixtures, require at least one to decode, hard-assert the +/// firing count). They are pinned here so the set cannot grow while they are +/// converted one at a time. +#[cfg(test)] +const GATES_THAT_SKIP_ON_A_DECODE_ERROR: &[&str] = &[ + "a_real_aomenc_filter_intra_stream_decodes_pixel_exact", + "a_real_aomenc_inter_sequence_with_deblocking_decodes_pixel_exact", + "a_real_aomenc_intra_stream_with_deblocking_decodes_pixel_exact", + "a_real_libaom_gradients_stream_with_cdef_decodes_pixel_exact", +]; + #[cfg(test)] mod tests { - use super::{CAPABILITY_CLAIMS, REFUSALS}; + use super::{CAPABILITY_CLAIMS, GATES_THAT_SKIP_ON_A_DECODE_ERROR, REFUSALS}; use std::collections::BTreeSet; /// Every distinct `unsupported(...)` reason on the decode path. @@ -187,4 +205,41 @@ mod tests { ); } } + + /// No NEW gate may quietly turn a decode error into a skip. + #[test] + fn gates_that_swallow_a_decode_error_are_declared() { + let src = include_str!("stream.rs"); + let mut found: BTreeSet = BTreeSet::new(); + for (i, _) in src.match_indices("\"SKIP ") { + let rest = &src[i + "\"SKIP ".len()..]; + let Some(colon) = rest.find(':') else { continue }; + let name = &rest[..colon]; + if !name.chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_') { + continue; + } + // The tail of the message says what was skipped. Only "{e}" -- the + // decode error itself -- is the shape this test is about; "no + // ffmpeg"/"no aomenc" are tool absence, governed by + // EC_AV1_REQUIRE_AOMENC instead. + let Some(end) = rest.find("\"") else { continue }; + if rest[colon..end].contains("{e}") { + found.insert(name.to_owned()); + } + } + let listed: BTreeSet<&str> = GATES_THAT_SKIP_ON_A_DECODE_ERROR.iter().copied().collect(); + let added: Vec<&String> = found.iter().filter(|n| !listed.contains(n.as_str())).collect(); + assert!( + added.is_empty(), + "these gates turn a decode error into a printed SKIP and are not declared: \ + {added:#?}\nA gate that cannot decode has failed -- assert on the error, or use \ + the attempt-loop pattern (several fixtures, at least one must decode, firing count \ + hard-asserted)." + ); + let stale: Vec<&&str> = listed.iter().filter(|n| !found.contains(**n)).collect(); + assert!( + stale.is_empty(), + "{stale:#?} no longer swallow a decode error -- delete them from the list." + ); + } }