forge
Explore
Log in

Don't you dare go Hollow

ec-h264: a missing conformance vector FAILS under EC_REQUIRE_FIXTURES

Browse files at this commit

a7371851e7c1c502c5c5cd90d5a661d6082b0e3dAhmet Kaan GümüşParent: d4100f4
Five gates took `if !base.is_dir() { eprintln!("SKIP ..."); return; }`
over the JVT vector directory, and a sixth skipped a missing
`fixtures/video/h264-open-gop.mp4`. On a worktree -- which has no
gitignored root `fixtures/` -- all six reported green having decoded
nothing, so a conformance run there measures nothing while looking
clean. That is the same "gate skips on its own failure" class the ec-av1
inventory pins, one crate over.

A shared `require_fixtures(path, what, generator)` now drives every arm:
default-off it skips and says what it skipped and which command fixes it;
`EC_REQUIRE_FIXTURES=1` turns it into a hard failure naming the exact
missing path, `scripts/link-fixtures.sh` (the root cause) and the
generator for that particular fixture. Tests only; no decoder change.

Red: EC_REQUIRE_FIXTURES=1 with `fixtures/` unlinked fails
jvt_cavlc_first_idr_bit_exact ("the JVT conformance vectors missing at
.../fixtures/vectors/h264-jvt -- this gate would prove nothing") and
h264_seek_matches_linear_open_gop ("the open-GOP fixture missing at
.../fixtures/video/h264-open-gop.mp4"). Green: all six pass with
`fixtures/` linked (1.58s / 5.59s / 0.73s / 20.85s / 9.94s / 0.75s).
crates/ec-h264/tests/conformance.rsmodified+58 -15
@@ -68,6 +68,34 @@ fn vectors_dir() -> PathBuf {
68 Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/vectors/h264-jvt")68 Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/vectors/h264-jvt")
69 }69 }
70 70
71+/// A gate that skips when its fixtures are absent reports GREEN having checked
72+/// nothing — the "gate skips on its own failure" class. The root `fixtures/`
73+/// directory is gitignored, so `git worktree add` hands every lane worktree a
74+/// tree without it and the whole conformance suite silently stops testing.
75+///
76+/// `EC_REQUIRE_FIXTURES=1` turns the skip into a hard failure naming the exact
77+/// missing path and the command that produces it; unset (the default), the skip
78+/// is kept and now says what it skipped. Set it in every batch run.
79+fn require_fixtures(path: &Path, what: &str, generator: &str) -> bool {
80+ if path.exists() {
81+ return true;
82+ }
83+ assert!(
84+ std::env::var_os("EC_REQUIRE_FIXTURES").is_none(),
85+ "{what} missing at {} — this gate would prove nothing. A worktree has no \
86+ gitignored root `fixtures/`: run scripts/link-fixtures.sh, or generate \
87+ them with {generator}.",
88+ path.display()
89+ );
90+ eprintln!(
91+ "SKIP {what} missing at {} — this gate proved nothing; run \
92+ scripts/link-fixtures.sh, or generate them with {generator} \
93+ (or set EC_REQUIRE_FIXTURES=1 to make this a failure).",
94+ path.display()
95+ );
96+ false
97+}
98+
71 /// Every vector directory `scripts/fetch-vectors.sh` has populated, in name99 /// Every vector directory `scripts/fetch-vectors.sh` has populated, in name
72 /// order.100 /// order.
73 ///101 ///
@@ -289,11 +317,11 @@ fn compare_sequence(stream: &Path) -> Result<usize, String> {
289 #[test]317 #[test]
290 fn jvt_cavlc_first_idr_bit_exact() {318 fn jvt_cavlc_first_idr_bit_exact() {
291 let base = vectors_dir();319 let base = vectors_dir();
292- if !base.is_dir() {320+ if !require_fixtures(
293- eprintln!(321+ &base,
294- "SKIP: {} missing — run scripts/fetch-vectors.sh",322+ "the JVT conformance vectors",
295- base.display()323+ "scripts/fetch-vectors.sh",
296- );324+ ) {
297 return;325 return;
298 }326 }
299 let mut passed = Vec::new();327 let mut passed = Vec::new();
@@ -396,8 +424,11 @@ fn jvt_cavlc_first_idr_bit_exact() {
396 #[test]424 #[test]
397 fn steady_state_decode_loop_zero_alloc() {425 fn steady_state_decode_loop_zero_alloc() {
398 let base = vectors_dir();426 let base = vectors_dir();
399- if !base.is_dir() {427+ if !require_fixtures(
400- eprintln!("SKIP: fixtures missing");428+ &base,
429+ "the JVT conformance vectors",
430+ "scripts/fetch-vectors.sh",
431+ ) {
401 return;432 return;
402 }433 }
403 // One stream per entropy coder, and one with B slices and multiple434 // One stream per entropy coder, and one with B slices and multiple
@@ -480,8 +511,11 @@ fn steady_state_decode_loop_zero_alloc() {
480 #[test]511 #[test]
481 fn ns_per_macroblock_measurement() {512 fn ns_per_macroblock_measurement() {
482 let base = vectors_dir();513 let base = vectors_dir();
483- if !base.is_dir() {514+ if !require_fixtures(
484- eprintln!("SKIP: fixtures missing");515+ &base,
516+ "the JVT conformance vectors",
517+ "scripts/fetch-vectors.sh",
518+ ) {
485 return;519 return;
486 }520 }
487 for name in [521 for name in [
@@ -564,8 +598,11 @@ fn perf_whole_sequence() {
564 #[test]598 #[test]
565 fn corrupt_streams_never_panic() {599 fn corrupt_streams_never_panic() {
566 let base = vectors_dir();600 let base = vectors_dir();
567- if !base.is_dir() {601+ if !require_fixtures(
568- eprintln!("SKIP: fixtures missing");602+ &base,
603+ "the JVT conformance vectors",
604+ "scripts/fetch-vectors.sh",
605+ ) {
569 return;606 return;
570 }607 }
571 // One stream per entropy coder, plus one with B slices and multiple608 // One stream per entropy coder, plus one with B slices and multiple
@@ -1070,8 +1107,11 @@ fn p_only_gop_matches_ffmpeg_every_frame() {
1070 #[test]1107 #[test]
1071 fn jvt_full_sequence_bit_exact() {1108 fn jvt_full_sequence_bit_exact() {
1072 let base = vectors_dir();1109 let base = vectors_dir();
1073- if !base.is_dir() {1110+ if !require_fixtures(
1074- eprintln!("SKIP: {} missing", base.display());1111+ &base,
1112+ "the JVT conformance vectors",
1113+ "scripts/fetch-vectors.sh",
1114+ ) {
1075 return;1115 return;
1076 }1116 }
1077 let mut table = String::new();1117 let mut table = String::new();
@@ -2313,8 +2353,11 @@ fn h264_seek_matches_linear_open_gop() {
2313 return;2353 return;
2314 }2354 }
2315 let src = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/video/h264-open-gop.mp4");2355 let src = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/video/h264-open-gop.mp4");
2316- if !src.is_file() {2356+ if !require_fixtures(
2317- eprintln!("SKIP: no fixtures/video/h264-open-gop.mp4 (run scripts/gen-fixtures.sh)");2357+ &src,
2358+ "the open-GOP fixture",
2359+ "scripts/gen-fixtures.sh (fixtures/video/h264-open-gop.mp4)",
2360+ ) {
2318 return;2361 return;
2319 }2362 }
2320 let dir = scratch("open-gop");2363 let dir = scratch("open-gop");