forge
Explore
Log in

Don't you dare go Hollow

Pin the four gates that turn a decode error into a SKIP

Browse files at this commit

2cf598487ca55382264f0a4888fd9356f893c0a5Ahmet Kaan GümüşParent: 5e92401
  • test
    • pin the four gates that turn a decode error into a SKIP
Show full message
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.rsmodified+56 -1
@@ -70,9 +70,27 @@ const REFUSALS: &[&str] = &[
7070 "filter intra on a HORZ/VERT strip (this decoder predicts square-only)",
7171 ];
7272
73+/// Gates whose `Err` arm turns a decode failure into a printed SKIP rather than
74+/// a test failure.
75+///
76+/// A gate named `..._decodes_pixel_exact` that cannot decode has failed, and
77+/// swallowing the error keeps the suite green while the gate proves nothing --
78+/// the same vacuum as a gate whose feature never fires, arrived at from the
79+/// other side. These four predate the attempt-loop pattern the newer gates use
80+/// (encode several fixtures, require at least one to decode, hard-assert the
81+/// firing count). They are pinned here so the set cannot grow while they are
82+/// converted one at a time.
83+#[cfg(test)]
84+const GATES_THAT_SKIP_ON_A_DECODE_ERROR: &[&str] = &[
85+ "a_real_aomenc_filter_intra_stream_decodes_pixel_exact",
86+ "a_real_aomenc_inter_sequence_with_deblocking_decodes_pixel_exact",
87+ "a_real_aomenc_intra_stream_with_deblocking_decodes_pixel_exact",
88+ "a_real_libaom_gradients_stream_with_cdef_decodes_pixel_exact",
89+];
90+
7391 #[cfg(test)]
7492 mod tests {
75- use super::{CAPABILITY_CLAIMS, REFUSALS};
93+ use super::{CAPABILITY_CLAIMS, GATES_THAT_SKIP_ON_A_DECODE_ERROR, REFUSALS};
7694 use std::collections::BTreeSet;
7795
7896 /// Every distinct `unsupported(...)` reason on the decode path.
@@ -187,4 +205,41 @@ mod tests {
187205 );
188206 }
189207 }
208+
209+ /// No NEW gate may quietly turn a decode error into a skip.
210+ #[test]
211+ fn gates_that_swallow_a_decode_error_are_declared() {
212+ let src = include_str!("stream.rs");
213+ let mut found: BTreeSet<String> = BTreeSet::new();
214+ for (i, _) in src.match_indices("\"SKIP ") {
215+ let rest = &src[i + "\"SKIP ".len()..];
216+ let Some(colon) = rest.find(':') else { continue };
217+ let name = &rest[..colon];
218+ if !name.chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_') {
219+ continue;
220+ }
221+ // The tail of the message says what was skipped. Only "{e}" -- the
222+ // decode error itself -- is the shape this test is about; "no
223+ // ffmpeg"/"no aomenc" are tool absence, governed by
224+ // EC_AV1_REQUIRE_AOMENC instead.
225+ let Some(end) = rest.find("\"") else { continue };
226+ if rest[colon..end].contains("{e}") {
227+ found.insert(name.to_owned());
228+ }
229+ }
230+ let listed: BTreeSet<&str> = GATES_THAT_SKIP_ON_A_DECODE_ERROR.iter().copied().collect();
231+ let added: Vec<&String> = found.iter().filter(|n| !listed.contains(n.as_str())).collect();
232+ assert!(
233+ added.is_empty(),
234+ "these gates turn a decode error into a printed SKIP and are not declared: \
235+ {added:#?}\nA gate that cannot decode has failed -- assert on the error, or use \
236+ the attempt-loop pattern (several fixtures, at least one must decode, firing count \
237+ hard-asserted)."
238+ );
239+ let stale: Vec<&&str> = listed.iter().filter(|n| !found.contains(**n)).collect();
240+ assert!(
241+ stale.is_empty(),
242+ "{stale:#?} no longer swallow a decode error -- delete them from the list."
243+ );
244+ }
190245 }