ec-flac: a missing xiph corpus FAILS under EC_REQUIRE_FIXTURES
Browse files at this commit62abc0189e74e25afdd33adebabcc4b9a76720b1Parent: a7371851 changed file +23 -1
crates/ec-flac/tests/xiph_vectors.rsmodified+23 -1
| @@ -21,7 +21,29 @@ fn corpus(kind: &str) -> Option<Vec<PathBuf>> { | |||
| 21 | let dir = Path::new(env!("CARGO_MANIFEST_DIR")) | 21 | let dir = Path::new(env!("CARGO_MANIFEST_DIR")) |
| 22 | .join("../../fixtures/vectors/flac-xiph/flac-test-files-main") | 22 | .join("../../fixtures/vectors/flac-xiph/flac-test-files-main") |
| 23 | .join(kind); | 23 | .join(kind); |
| 24 | - let mut files: Vec<PathBuf> = std::fs::read_dir(dir) | 24 | + // A missing corpus made every gate below skip GREEN having decoded nothing |
| 25 | + // — the "gate skips on its own failure" class. The root `fixtures/` tree is | ||
| 26 | + // gitignored, so `git worktree add` hands every lane worktree a tree without | ||
| 27 | + // it. `EC_REQUIRE_FIXTURES=1` turns that into a hard failure naming the | ||
| 28 | + // exact path and the command that produces it; unset, the skip is kept and | ||
| 29 | + // now says what it skipped. Set it in every batch run. | ||
| 30 | + if !dir.is_dir() { | ||
| 31 | + assert!( | ||
| 32 | + std::env::var_os("EC_REQUIRE_FIXTURES").is_none(), | ||
| 33 | + "the FLAC xiph {kind} corpus is missing at {} — these gates would prove \ | ||
| 34 | + nothing. A worktree has no gitignored root `fixtures/`: run \ | ||
| 35 | + scripts/link-fixtures.sh, or fetch it with scripts/fetch-vectors.sh.", | ||
| 36 | + dir.display() | ||
| 37 | + ); | ||
| 38 | + eprintln!( | ||
| 39 | + "SKIP the FLAC xiph {kind} corpus is missing at {} — these gates proved \ | ||
| 40 | + nothing; run scripts/link-fixtures.sh, or fetch it with \ | ||
| 41 | + scripts/fetch-vectors.sh (or set EC_REQUIRE_FIXTURES=1 to make this a failure).", | ||
| 42 | + dir.display() | ||
| 43 | + ); | ||
| 44 | + return None; | ||
| 45 | + } | ||
| 46 | + let mut files: Vec<PathBuf> = std::fs::read_dir(&dir) | ||
| 25 | .ok()? | 47 | .ok()? |
| 26 | .filter_map(|e| e.ok().map(|e| e.path())) | 48 | .filter_map(|e| e.ok().map(|e| e.path())) |
| 27 | .filter(|p| p.extension().is_some_and(|e| e == "flac")) | 49 | .filter(|p| p.extension().is_some_and(|e| e == "flac")) |