diff --git a/Cargo.lock b/Cargo.lock index cc823cef..a59f62b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -748,6 +748,7 @@ dependencies = [ "archmage", "bytemuck", "ec-core", + "ec-testkit", "multiversion", ] @@ -756,6 +757,7 @@ name = "ec-vp9" version = "0.1.0" dependencies = [ "ec-core", + "ec-testkit", "ec-vp9-syntax", ] @@ -764,6 +766,7 @@ name = "ec-vp9-syntax" version = "0.1.0" dependencies = [ "ec-core", + "ec-testkit", ] [[package]] diff --git a/crates/ec-vp8/Cargo.toml b/crates/ec-vp8/Cargo.toml index 094e36a2..bb65a053 100644 --- a/crates/ec-vp8/Cargo.toml +++ b/crates/ec-vp8/Cargo.toml @@ -11,3 +11,6 @@ archmage = "=0.9.31-beta.1" bytemuck = "1" ec-core.workspace = true multiversion = "0.9" + +[dev-dependencies] +ec-testkit.workspace = true diff --git a/crates/ec-vp8/fuzz/seed.sh b/crates/ec-vp8/fuzz/seed.sh index 8f3556e7..44cb6f0e 100755 --- a/crates/ec-vp8/fuzz/seed.sh +++ b/crates/ec-vp8/fuzz/seed.sh @@ -5,13 +5,13 @@ # into corpus/decode_frame/. Whole IVF files up to 256 KiB go into corpus/decode_ivf/, and # a 10-frame prefix of every larger file too. The corpus is generated, not committed. # -# Usage: crates/ec-vp8/fuzz/seed.sh (from any directory; needs python3 and the fixtures/ link) +# Usage: crates/ec-vp8/fuzz/seed.sh (from any directory; needs python3 and fixtures from scripts/fixtures.sh) set -euo pipefail here=$(cd -- "$(dirname -- "$0")" && pwd) repo=$(cd -- "$here/../../.." && pwd) rm -rf "$here/corpus" mkdir -p "$here/corpus/decode_frame" "$here/corpus/decode_ivf" -exec python3 -I - "$here" "decode_ivf" "$repo/fixtures/vp8/*.ivf" <<'PY' +exec python3 -I - "$here" "decode_ivf" "${EC_FIXTURES:-$repo/fixtures}/vp8/*.ivf" <<'PY' import glob, os, struct, sys here, stream_target = sys.argv[1], sys.argv[2] diff --git a/crates/ec-vp8/tests/it/common.rs b/crates/ec-vp8/tests/it/common.rs index 6211b97c..ac9acac6 100644 --- a/crates/ec-vp8/tests/it/common.rs +++ b/crates/ec-vp8/tests/it/common.rs @@ -76,21 +76,14 @@ pub fn webp_vp8_chunk(bytes: &[u8]) -> Vec { panic!("no VP8 chunk in webp"); } -/// Root of the workspace checkout this test runs in (crates/ec-vp8/../..). -pub fn fixture_dir() -> Option { - let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/vp8"); - if dir.is_dir() { Some(dir) } else { None } -} - /// ffmpeg's decoded rawvideo byte stream for an IVF file. -#[allow(dead_code)] // the malformed-input binary does not compare against ffmpeg pub fn ffmpeg_raw_yuv(path: &std::path::Path) -> Vec { - let out = std::process::Command::new("ffmpeg") + let out = ec_testkit::ffmpeg() .args(["-v", "error", "-i"]) .arg(path) .args(["-f", "rawvideo", "-pix_fmt", "yuv420p", "-"]) .output() - .expect("ffmpeg must be on PATH for the witnesses"); + .expect("ffmpeg runs"); assert!(out.status.success(), "ffmpeg failed on {path:?}"); out.stdout } diff --git a/crates/ec-vp8/tests/it/header_parse.rs b/crates/ec-vp8/tests/it/header_parse.rs index 6a76d29b..96fa50c7 100644 --- a/crates/ec-vp8/tests/it/header_parse.rs +++ b/crates/ec-vp8/tests/it/header_parse.rs @@ -18,11 +18,8 @@ const FIXTURES: &[(&str, u16, u16)] = &[ #[test] fn parses_real_key_frame_headers() { - let Some(dir) = common::fixture_dir() else { - panic!("fixtures missing; run scripts/gen_vp8_fixtures.sh"); - }; for (name, width, height) in FIXTURES { - let bytes = std::fs::read(dir.join(name)).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture(&format!("vp8/{name}"))).unwrap(); let (fourcc, w, h, frames) = common::parse_ivf(&bytes); assert_eq!(fourcc, "VP80", "{name}"); assert_eq!((w, h), (*width, *height), "{name} IVF dimensions"); @@ -74,10 +71,7 @@ fn parses_real_key_frame_headers() { #[test] fn parses_multi_partition_header() { - let Some(dir) = common::fixture_dir() else { - panic!("fixtures missing; run scripts/gen_vp8_fixtures.sh"); - }; - let bytes = std::fs::read(dir.join("mparts-160x96.ivf")).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture("vp8/mparts-160x96.ivf")).unwrap(); let (_, _, _, frames) = common::parse_ivf(&bytes); let mut state = PersistedState::default(); let (header, _) = FrameHeader::parse(&frames[0].data, &mut state).unwrap(); @@ -89,10 +83,7 @@ fn parses_multi_partition_header() { #[test] fn parses_vp8_in_webp_still() { - let Some(dir) = common::fixture_dir() else { - panic!("fixtures missing; run scripts/gen_vp8_fixtures.sh"); - }; - let Ok(bytes) = std::fs::read(dir.join("still.webp")) else { + let Ok(bytes) = std::fs::read(ec_testkit::fixture("vp8/still.webp")) else { panic!("still.webp missing (libwebp encoder unavailable at generation time)"); }; let vp8 = common::webp_vp8_chunk(&bytes); @@ -107,10 +98,7 @@ fn parses_vp8_in_webp_still() { #[test] fn gop_key_frame_parses_and_coexists_with_inter() { - let Some(dir) = common::fixture_dir() else { - panic!("fixtures missing; run scripts/gen_vp8_fixtures.sh"); - }; - let bytes = std::fs::read(dir.join("gop-160x96.ivf")).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture("vp8/gop-160x96.ivf")).unwrap(); let (_, _, _, frames) = common::parse_ivf(&bytes); assert!(frames.len() >= 30); diff --git a/crates/ec-vp8/tests/it/keyframe_exact.rs b/crates/ec-vp8/tests/it/keyframe_exact.rs index 6014d09d..9fc759f8 100644 --- a/crates/ec-vp8/tests/it/keyframe_exact.rs +++ b/crates/ec-vp8/tests/it/keyframe_exact.rs @@ -13,14 +13,8 @@ fn raw<'a>(pos: &mut usize, data: &'a [u8], len: usize) -> &'a [u8] { /// Decode every frame of an IVF with our decoder and compare each SHOWN /// frame's planes against ffmpeg's byte stream (ffmpeg skips hidden /// `show_frame == 0` frames exactly like a player). -fn compare(name: &str, skip_if_missing: bool) { - let Some(dir) = common::fixture_dir() else { - panic!("fixtures missing; run scripts/gen_vp8_fixtures.sh"); - }; - let path = dir.join(name); - if skip_if_missing && !path.exists() { - panic!("{name} missing (regenerate fixtures)"); - } +fn compare(name: &str) { + let path = ec_testkit::fixture(&format!("vp8/{name}")); let bytes = std::fs::read(&path).unwrap(); let (_, w, h, frames) = common::parse_ivf(&bytes); let all = ffmpeg_raw_yuv(&path); @@ -73,13 +67,13 @@ fn keyframes_match_ffmpeg() { ("kf-172x144-q25.ivf", 172, 144), ("kf-96x80-q63.ivf", 96, 80), ] { - compare(name, false); + compare(name); } } #[test] fn multi_partition_keyframe_matches_ffmpeg() { - compare("mparts-160x96.ivf", false); + compare("mparts-160x96.ivf"); } /// M3 witness: full inter-frame streams — simple-filter GOP, multi-token- @@ -95,8 +89,7 @@ fn interframe_streams_match_ffmpeg() { "altref-160x96.ivf", ] { if name == "altref-160x96.ivf" { - let dir = common::fixture_dir().expect("fixtures dir"); - let bytes = std::fs::read(dir.join(name)).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture(&format!("vp8/{name}"))).unwrap(); let hidden = census_hidden(&bytes); assert!( hidden >= 6, @@ -104,7 +97,7 @@ fn interframe_streams_match_ffmpeg() { scripts/gen_vp8_fixtures.sh (--auto-alt-ref=1 --passes=2)" ); } - compare(name, false); + compare(name); } } @@ -116,14 +109,11 @@ fn census_hidden(bytes: &[u8]) -> usize { #[test] fn vp8_in_webp_still_matches_ffmpeg() { - let Some(dir) = common::fixture_dir() else { - panic!("fixtures missing; run scripts/gen_vp8_fixtures.sh"); - }; - let bytes = std::fs::read(dir.join("still.webp")).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture("vp8/still.webp")).unwrap(); let vp8 = common::webp_vp8_chunk(&bytes); - let reference = std::process::Command::new("ffmpeg") + let reference = ec_testkit::ffmpeg() .args(["-v", "error", "-i"]) - .arg(dir.join("still.webp")) + .arg(ec_testkit::fixture("vp8/still.webp")) .args(["-f", "rawvideo", "-pix_fmt", "yuv420p", "-"]) .output() .unwrap(); diff --git a/crates/ec-vp8/tests/it/stream_exact.rs b/crates/ec-vp8/tests/it/stream_exact.rs index eee8babc..8db6b687 100644 --- a/crates/ec-vp8/tests/it/stream_exact.rs +++ b/crates/ec-vp8/tests/it/stream_exact.rs @@ -25,11 +25,8 @@ const FIXTURES: &[&str] = &[ #[test] fn decode_stream_matches_ffmpeg_on_every_fixture() { - let Some(dir) = common::fixture_dir() else { - panic!("fixtures missing; run scripts/gen_vp8_fixtures.sh"); - }; for name in FIXTURES { - let path = dir.join(name); + let path = ec_testkit::fixture(&format!("vp8/{name}")); let bytes = std::fs::read(&path).unwrap(); let (_, w, h, frames) = common::parse_ivf(&bytes); let all = ffmpeg_raw_yuv(&path); @@ -58,10 +55,7 @@ fn decode_stream_matches_ffmpeg_on_every_fixture() { /// ffmpeg. #[test] fn hidden_frames_update_references_and_produce_no_picture() { - let Some(dir) = common::fixture_dir() else { - panic!("fixtures missing; run scripts/gen_vp8_fixtures.sh"); - }; - let path = dir.join("altref-160x96.ivf"); + let path = ec_testkit::fixture("vp8/altref-160x96.ivf"); let bytes = std::fs::read(&path).unwrap(); let (_, w, h, frames) = common::parse_ivf(&bytes); let hidden_at: Vec = frames @@ -105,10 +99,7 @@ fn hidden_frames_update_references_and_produce_no_picture() { #[test] fn decode_stream_is_error_not_panic_on_bad_containers() { - let Some(dir) = common::fixture_dir() else { - panic!("fixtures missing; run scripts/gen_vp8_fixtures.sh"); - }; - let bytes = std::fs::read(dir.join("gop-160x96.ivf")).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture("vp8/gop-160x96.ivf")).unwrap(); // Missing magic. let mut bad = bytes.clone(); diff --git a/crates/ec-vp8/tests/malformed_no_panic.rs b/crates/ec-vp8/tests/malformed_no_panic.rs index 116c789c..326029b3 100644 --- a/crates/ec-vp8/tests/malformed_no_panic.rs +++ b/crates/ec-vp8/tests/malformed_no_panic.rs @@ -3,11 +3,6 @@ //! seeded single-byte corruptions; each decode runs under `catch_unwind` so a //! failure names the file and the damage that caused it. -// Only `fixture_dir` is used here; the IVF parser serves the other test crates. -#[allow(dead_code)] -#[path = "it/common.rs"] -mod ivf; - use std::panic::{AssertUnwindSafe, catch_unwind}; use ec_vp8::stream::decode_stream; @@ -59,9 +54,6 @@ fn decode_must_not_panic(data: &[u8], what: &str) { #[test] fn truncated_and_corrupted_fixtures_never_panic() { - let Some(dir) = ivf::fixture_dir() else { - panic!("fixtures missing; run scripts/gen_vp8_fixtures.sh"); - }; // Silence the default panic hook while probing; failures are reported // by the assertion above, which names the file and the damage. let hook = std::panic::take_hook(); @@ -70,7 +62,7 @@ fn truncated_and_corrupted_fixtures_never_panic() { let mut rng = Rng(SEED); let mut failures = Vec::new(); for name in FIXTURES { - let bytes = std::fs::read(dir.join(name)).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture(&format!("vp8/{name}"))).unwrap(); assert!(bytes.len() > 32, "{name}: fixture too small"); for k in 1..=TRUNCATIONS { diff --git a/crates/ec-vp9-syntax/Cargo.toml b/crates/ec-vp9-syntax/Cargo.toml index 5badd435..7dae96d0 100644 --- a/crates/ec-vp9-syntax/Cargo.toml +++ b/crates/ec-vp9-syntax/Cargo.toml @@ -8,3 +8,6 @@ authors.workspace = true [dependencies] ec-core.workspace = true + +[dev-dependencies] +ec-testkit.workspace = true diff --git a/crates/ec-vp9-syntax/tests/streams.rs b/crates/ec-vp9-syntax/tests/streams.rs index bf2d5016..789bfc39 100644 --- a/crates/ec-vp9-syntax/tests/streams.rs +++ b/crates/ec-vp9-syntax/tests/streams.rs @@ -1,19 +1,13 @@ //! Every VP9 fixture stream parsed end to end, field-compared against ffprobe. //! -//! `scripts/gen-bitstream-fixtures.sh` remuxes the container fixtures to IVF and -//! encodes the branch cases (superframes, 4:4:4, tiles). Fixtures are gitignored, -//! so a checkout without them skips rather than fails. +//! `scripts/fixtures.sh` builds the `bitstreams/` fixtures (superframes, 4:4:4, tiles); +//! a missing fixture fails the test. use std::path::{Path, PathBuf}; -use std::process::Command; use ec_core::Error; use ec_vp9_syntax::{FrameType, Vp9Parser, superframe}; -fn bitstreams() -> PathBuf { - Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/bitstreams") -} - /// The IVF frames of a file, payload only. fn ivf_frames(data: &[u8]) -> Vec<&[u8]> { let mut out = Vec::new(); @@ -31,7 +25,7 @@ fn ivf_frames(data: &[u8]) -> Vec<&[u8]> { } fn ffprobe(path: &Path, entries: &str) -> Vec { - let out = Command::new("ffprobe") + let out = ec_testkit::ffprobe() .args(["-v", "error", "-select_streams", "v:0", "-show_entries"]) .arg(entries) .args(["-of", "csv=p=0"]) @@ -84,32 +78,15 @@ fn pix_fmt_geometry(pix_fmt: &str) -> (u8, u8, u8) { } fn fixtures() -> Vec { - let dir = bitstreams(); - let Ok(entries) = std::fs::read_dir(&dir) else { - return Vec::new(); - }; - let mut files: Vec = entries - .filter_map(|e| e.ok().map(|e| e.path())) - .filter(|p| { - p.extension().is_some_and(|e| e == "ivf") - && p.file_name() - .is_some_and(|n| n.to_string_lossy().starts_with("vp9-")) - }) - .collect(); - files.sort(); - files + ec_testkit::fixtures("bitstreams", "ivf") + .into_iter() + .filter(|p| p.file_name().is_some_and(|n| n.to_string_lossy().starts_with("vp9-"))) + .collect() } #[test] fn every_fixture_matches_ffprobe() { - let files = fixtures(); - if files.is_empty() { - eprintln!( - "skipped: no fixtures/bitstreams/vp9-*.ivf — run scripts/gen-bitstream-fixtures.sh" - ); - return; - } - for path in files { + for path in fixtures() { let name = path.file_name().unwrap().to_string_lossy().to_string(); let (width, height, pix_fmt, profile) = probe_stream(&path); let (bit_depth, sx, sy) = pix_fmt_geometry(&pix_fmt); @@ -197,11 +174,7 @@ fn every_fixture_matches_ffprobe() { /// genuine `show_existing_frame` headers; libaom uses them.) #[test] fn altref_fixture_has_superframes_and_hidden_frames() { - let path = bitstreams().join("vp9-superframe-altref.ivf"); - if !path.exists() { - eprintln!("skipped: no vp9-superframe-altref.ivf"); - return; - } + let path = ec_testkit::fixture("bitstreams/vp9-superframe-altref.ivf"); let data = std::fs::read(&path).unwrap(); let mut parser = Vp9Parser::new(); let (mut superframes, mut hidden) = (0, 0); @@ -245,12 +218,6 @@ fn fuzz_10k_mutations_never_panics() { .collect::>() }) .collect(); - let seeds = if seeds.is_empty() { - // No fixtures: still exercise the parser against pure noise. - vec![vec![0x82u8; 128]] - } else { - seeds - }; let mut state = 0x2545_f491_4f6c_dd1du64; let mut rng = move || { diff --git a/crates/ec-vp9/Cargo.toml b/crates/ec-vp9/Cargo.toml index 7f433962..8fffc907 100644 --- a/crates/ec-vp9/Cargo.toml +++ b/crates/ec-vp9/Cargo.toml @@ -9,3 +9,6 @@ authors.workspace = true [dependencies] ec-core.workspace = true ec-vp9-syntax.workspace = true + +[dev-dependencies] +ec-testkit.workspace = true diff --git a/crates/ec-vp9/fuzz/seed.sh b/crates/ec-vp9/fuzz/seed.sh index a62eb24f..57b51f5e 100755 --- a/crates/ec-vp9/fuzz/seed.sh +++ b/crates/ec-vp9/fuzz/seed.sh @@ -5,13 +5,13 @@ # into corpus/decode_frame/. Whole IVF files up to 256 KiB go into corpus/decode_stream/, and # a 10-frame prefix of every larger file too. The corpus is generated, not committed. # -# Usage: crates/ec-vp9/fuzz/seed.sh (from any directory; needs python3 and the fixtures/ link) +# Usage: crates/ec-vp9/fuzz/seed.sh (from any directory; needs python3 and fixtures from scripts/fixtures.sh) set -euo pipefail here=$(cd -- "$(dirname -- "$0")" && pwd) repo=$(cd -- "$here/../../.." && pwd) rm -rf "$here/corpus" mkdir -p "$here/corpus/decode_frame" "$here/corpus/decode_stream" -exec python3 -I - "$here" "decode_stream" "$repo/fixtures/vp9/*.ivf" "$here/../tests/data/*.ivf" <<'PY' +exec python3 -I - "$here" "decode_stream" "${EC_FIXTURES:-$repo/fixtures}/vp9/*.ivf" "$here/../tests/data/*.ivf" <<'PY' import glob, os, struct, sys here, stream_target = sys.argv[1], sys.argv[2] diff --git a/crates/ec-vp9/tests/it/common.rs b/crates/ec-vp9/tests/it/common.rs index 5f21eabe..2c8e3013 100644 --- a/crates/ec-vp9/tests/it/common.rs +++ b/crates/ec-vp9/tests/it/common.rs @@ -1,37 +1,13 @@ //! Helpers shared by the integration-test modules of the `it` binary. -/// Fixture-presence probe for the committed-or-media-gated fixtures a test -/// decodes. Returns whether the fixture is present, but never silently: under -/// `EC_REQUIRE_FIXTURES=1` an absent fixture is a hard failure naming the path -/// and the script that regenerates it, so a host whose fixture library drifted -/// reports RED instead of a green SKIP (class: gate-skips-on-its-own-failure; -/// model `have_ffmpeg` in crates/ec-av1/src/stream.rs, which was silently -/// short-circuited because the probe ran first in a compound `if`). -/// -/// Order is load-bearing: probe, assert, return. Never merge the probe into -/// the same `if` as the escape. -pub(crate) fn require_fixture(path: &std::path::Path, generator: &str) -> bool { - let present = path.exists(); - assert!( - present || std::env::var_os("EC_REQUIRE_FIXTURES").is_none(), - "EC_REQUIRE_FIXTURES=1 but fixture {} is absent -- regenerate with: {}", - path.display(), - generator - ); - if !present { - eprintln!("SKIP: fixture {} absent", path.display()); - } - present -} - /// ffmpeg's decoded rawvideo byte stream (frame-packed I420, `w`x`h`). pub(crate) fn ffmpeg_raw_yuv(path: &std::path::Path, w: usize, h: usize) -> Vec { - let out = std::process::Command::new("ffmpeg") + let out = ec_testkit::ffmpeg() .args(["-v", "error", "-i"]) .arg(path) .args(["-f", "rawvideo", "-pix_fmt", "yuv420p", "-"]) .output() - .expect("ffmpeg on PATH"); + .expect("ffmpeg runs"); assert!(out.status.success(), "ffmpeg decode failed: {out:?}"); let frame = w * h + 2 * (w / 2) * (h / 2); assert_eq!( diff --git a/crates/ec-vp9/tests/it/dump_probe.rs b/crates/ec-vp9/tests/it/dump_probe.rs index 77a55597..7c7bd665 100644 --- a/crates/ec-vp9/tests/it/dump_probe.rs +++ b/crates/ec-vp9/tests/it/dump_probe.rs @@ -2,13 +2,12 @@ use crate::ivf; use ec_vp9::decode::Decoder; #[test] fn diff_stats() { - let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); - let bytes = std::fs::read(dir.join("fixtures/vp9/key-320.ivf")).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture("vp9/key-320.ivf")).unwrap(); let (_, _, _, frames) = ivf::parse_ivf(&bytes); let mut d = Decoder::new(); let pic = d.decode(&frames[0].data).unwrap().unwrap(); - let refout = std::process::Command::new("ffmpeg") - .args(["-v","error","-i",dir.join("fixtures/vp9/key-320.ivf").to_str().unwrap(), + let refout = ec_testkit::ffmpeg() + .args(["-v","error","-i",ec_testkit::fixture("vp9/key-320.ivf").to_str().unwrap(), "-frames:v","1","-f","rawvideo","-pix_fmt","yuv420p","-"]) .output().unwrap().stdout; let w = 320usize; diff --git a/crates/ec-vp9/tests/it/hbd_exact.rs b/crates/ec-vp9/tests/it/hbd_exact.rs index 7d93ca19..e7faeb09 100644 --- a/crates/ec-vp9/tests/it/hbd_exact.rs +++ b/crates/ec-vp9/tests/it/hbd_exact.rs @@ -3,34 +3,23 @@ //! yuv420p10le -`). Pre-fix the decoder refuses `profile 2` by name, so this //! test fails at the first frame; post-fix every shown frame matches. //! -//! Media-gated: the 10-bit corpus streams are gitignored, so the test prints -//! SKIP when the fixture is absent (set the fixture tree up per the lane -//! notes) -- and goes RED instead under `EC_REQUIRE_FIXTURES=1`, so a drifted -//! fixture library can never read as a pass. The 4:4:4 and 12-bit shapes are -//! covered by `subsampling_exact.rs`. +//! Needs the `bitstreams/` fixtures from scripts/fixtures.sh. The 4:4:4 and +//! 12-bit shapes are covered by `subsampling_exact.rs`. use crate::ivf; -use crate::common::require_fixture; use ec_vp9::decode::Decoder; -use std::path::{Path, PathBuf}; - -fn fixture(name: &str) -> PathBuf { - let mut p = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - p.pop(); - p.pop(); - p.join("fixtures/bitstreams").join(name) -} +use std::path::Path; /// ffmpeg's rawvideo `yuv420p10le` bytes (little-endian u16 samples, /// stride == visible width). fn ffmpeg_raw_yuv10(path: &Path) -> Vec { - let out = std::process::Command::new("ffmpeg") + let out = ec_testkit::ffmpeg() .args(["-v", "error", "-i"]) .arg(path) .args(["-f", "rawvideo", "-pix_fmt", "yuv420p10le", "-"]) .output() - .expect("ffmpeg must be on PATH for the witnesses"); + .expect("ffmpeg runs for the witnesses"); assert!(out.status.success(), "ffmpeg failed on {path:?}"); out.stdout } @@ -58,10 +47,7 @@ fn decode_all(path: &Path) -> (Vec>, u8) { /// produces, sample for sample. #[test] fn profile2_10bit_is_byte_exact() { - let a = fixture("vp9-1080p-23.976-10bit.ivf"); - if !require_fixture(&a, "scripts/gen-bitstream-fixtures.sh") { - return; - } + let a = ec_testkit::fixture("bitstreams/vp9-1080p-23.976-10bit.ivf"); let (ours, bd) = decode_all(&a); assert_eq!(bd, 10, "the fixture must decode at 10 bits"); let want = ffmpeg_raw_yuv10(&a); diff --git a/crates/ec-vp9/tests/it/inter_pixels_exact.rs b/crates/ec-vp9/tests/it/inter_pixels_exact.rs index b38e6918..65f3fa7f 100644 --- a/crates/ec-vp9/tests/it/inter_pixels_exact.rs +++ b/crates/ec-vp9/tests/it/inter_pixels_exact.rs @@ -7,7 +7,7 @@ //! `tests/scratch_pixdump.rs` (env-gated) instead; see `lanes/vp9pix.report.md`. use crate::ivf; -use crate::common::{ffmpeg_raw_yuv, require_fixture}; +use crate::common::ffmpeg_raw_yuv; use ec_vp9::decode::Decoder; /// Generate a GOP fixture with libvpx: 6 frames of testsrc2 at 320x240, @@ -19,7 +19,7 @@ fn ensure_fixture(path: &std::path::Path, tile_columns: u32) { if let Some(dir) = path.parent() { std::fs::create_dir_all(dir).unwrap(); } - let st = std::process::Command::new("ffmpeg") + let st = ec_testkit::ffmpeg() .args([ "-v", "error", @@ -44,7 +44,7 @@ fn ensure_fixture(path: &std::path::Path, tile_columns: u32) { .args(["-pix_fmt", "yuv420p", "-f", "ivf"]) .arg(path) .output() - .expect("ffmpeg with libvpx-vp9 must be on PATH for the witnesses"); + .expect("ffmpeg with libvpx-vp9 runs for the witnesses"); assert!(st.status.success(), "fixture generation failed: {st:?}"); } @@ -98,7 +98,7 @@ fn compare(path: &std::path::Path) -> usize { #[test] fn inter_gop_matches_ffmpeg() { - let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../target/vp9-witness"); + let dir = std::env::temp_dir().join("ec-vp9-witness"); let path = dir.join("inter-gop.ivf"); ensure_fixture(&path, 0); assert!(compare(&path) >= 2); @@ -106,7 +106,7 @@ fn inter_gop_matches_ffmpeg() { #[test] fn inter_gop_with_tile_columns_matches_ffmpeg() { - let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../target/vp9-witness"); + let dir = std::env::temp_dir().join("ec-vp9-witness"); let path = dir.join("inter-gop-tc1.ivf"); ensure_fixture(&path, 1); assert!(compare(&path) >= 2); @@ -119,16 +119,10 @@ fn inter_gop_with_tile_columns_matches_ffmpeg() { /// TAIL slot set (`write_tx_context`), and the next row of blocks read it /// as an entropy context. Every shown frame must match ffmpeg. /// -/// Media-gated: the corpus fixture is not versioned, so the witness prints -/// SKIP when `fixtures/bitstreams/vp9-1080p-60-8bit.ivf` is absent -- and goes -/// RED instead under `EC_REQUIRE_FIXTURES=1`. +/// Needs the `bitstreams/vp9-1080p-60-8bit.ivf` fixture from scripts/fixtures.sh. #[test] fn corpus_1080p_60fps_matches_ffmpeg_past_frame_72() { - let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../fixtures/bitstreams/vp9-1080p-60-8bit.ivf"); - if !require_fixture(&path, "scripts/gen-bitstream-fixtures.sh") { - return; - } + let path = ec_testkit::fixture("bitstreams/vp9-1080p-60-8bit.ivf"); let shown = compare(&path); assert!( shown >= 73, diff --git a/crates/ec-vp9/tests/it/ivf.rs b/crates/ec-vp9/tests/it/ivf.rs index 601b4ab7..536642ff 100644 --- a/crates/ec-vp9/tests/it/ivf.rs +++ b/crates/ec-vp9/tests/it/ivf.rs @@ -47,22 +47,3 @@ pub fn parse_ivf(bytes: &[u8]) -> (&str, u16, u16, Vec) { (fourcc, width, height, frames) } -/// Root of the workspace checkout this test runs in (crates/ec-vp9/../..). -#[allow(dead_code)] // shared by the `it` test binary -/// -/// With `EC_REQUIRE_FIXTURES` set, an absent directory is a hard failure, so a -/// host without the fixtures cannot pass by skipping. -pub fn fixture_dir() -> Option { - let bitstreams = - std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/bitstreams"); - if bitstreams.is_dir() { - Some(bitstreams) - } else { - assert!( - std::env::var_os("EC_REQUIRE_FIXTURES").is_none(), - "EC_REQUIRE_FIXTURES=1 but {} is absent", - bitstreams.display() - ); - None - } -} diff --git a/crates/ec-vp9/tests/it/keyframe_exact.rs b/crates/ec-vp9/tests/it/keyframe_exact.rs index d4711c3e..e068be0e 100644 --- a/crates/ec-vp9/tests/it/keyframe_exact.rs +++ b/crates/ec-vp9/tests/it/keyframe_exact.rs @@ -6,49 +6,14 @@ use crate::ivf; use ec_vp9::decode::Decoder; -/// Generate the small all-keyframe fixture with libvpx if it is absent -/// (2 keyframes of 320x240 testsrc2, realtime cpu-used 4). -fn ensure_fixture(path: &std::path::Path) { - if path.exists() { - return; - } - if let Some(dir) = path.parent() { - std::fs::create_dir_all(dir).unwrap(); - } - let st = std::process::Command::new("ffmpeg") - .args([ - "-y", - "-f", - "lavfi", - "-i", - "testsrc2=size=320x240:rate=30:duration=1", - "-pix_fmt", - "yuv420p", - "-c:v", - "libvpx-vp9", - "-g", - "1", - "-cpu-used", - "4", - "-deadline", - "realtime", - "-frames:v", - "2", - ]) - .arg(path) - .output() - .expect("ffmpeg with libvpx-vp9 must be on PATH for the witnesses"); - assert!(st.status.success(), "fixture generation failed: {st:?}"); -} - /// ffmpeg's decoded rawvideo byte stream for the same file. fn ffmpeg_raw_yuv(path: &std::path::Path) -> Vec { - let out = std::process::Command::new("ffmpeg") + let out = ec_testkit::ffmpeg() .args(["-v", "error", "-i"]) .arg(path) .args(["-f", "rawvideo", "-pix_fmt", "yuv420p", "-"]) .output() - .expect("ffmpeg must be on PATH for the witnesses"); + .expect("ffmpeg runs for the witnesses"); assert!(out.status.success(), "ffmpeg failed on {path:?}"); out.stdout } @@ -113,16 +78,13 @@ fn compare(path: &std::path::Path) { #[test] fn keyframes_match_ffmpeg() { - let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/vp9"); - let path = dir.join("key-320.ivf"); - ensure_fixture(&path); + let path = ec_testkit::fixture("vp9/key-320.ivf"); compare(&path); } #[test] fn lossless_64_matches_ffmpeg() { - let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); - let path = dir.join("fixtures/vp9/lossless-64.ivf"); + let path = ec_testkit::fixture("vp9/lossless-64.ivf"); let bytes = std::fs::read(&path).unwrap(); let (_fourcc, w, h, frames) = ivf::parse_ivf(&bytes); let reference = ffmpeg_raw_yuv(&path); @@ -157,10 +119,7 @@ fn inter_stream_decodes_and_matches_ffmpeg() { // used to be the "inter is refused by name" witness. Inter frames decode // now, so the witness is the pixels: every shown frame must match // ffmpeg's libvpx output byte for byte. - let Some(dir) = ivf::fixture_dir() else { - return; - }; - let path = dir.join("vp9-superframe-altref.ivf"); + let path = ec_testkit::fixture("bitstreams/vp9-superframe-altref.ivf"); let bytes = std::fs::read(&path).unwrap(); let (_, w, h, frames) = ivf::parse_ivf(&bytes); let (w, h) = (w as usize, h as usize); diff --git a/crates/ec-vp9/tests/it/libvpx_vectors.rs b/crates/ec-vp9/tests/it/libvpx_vectors.rs index 7bb908ea..fe63fc81 100644 --- a/crates/ec-vp9/tests/it/libvpx_vectors.rs +++ b/crates/ec-vp9/tests/it/libvpx_vectors.rs @@ -9,18 +9,11 @@ //! The test decodes every vector, digests every returned picture and compares //! the digest with the matching line, in order. Any frame-count or digest //! difference fails the test and is listed by vector name and frame index. -//! Vectors are read from the fixture tree (`scripts/fetch-vectors.sh -//! vp9-libvpx`). Without the fixtures the test skips, unless -//! `EC_REQUIRE_FIXTURES` is set, in which case it fails. +//! Vectors come from the fixture tree (`scripts/fixtures.sh`); a missing tree fails. use ec_vp9::decode::{Decoder, Picture}; use std::path::{Path, PathBuf}; -/// Directory of the fetched libvpx vectors (crates/ec-vp9/../../fixtures). -fn vector_dir() -> PathBuf { - Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/vectors/vp9-libvpx") -} - // ------------------------------------------------------------------ MD5 ---- /// RFC 1321 MD5 of `data`, as lowercase hex. @@ -253,20 +246,8 @@ fn check_vector(name: &str, frames: &[&[u8]], expected: &[String]) -> Vec e, - Err(_) => { - assert!( - !require, - "EC_REQUIRE_FIXTURES=1 but {} is absent (run scripts/fetch-vectors.sh vp9-libvpx)", - dir.display() - ); - eprintln!("skip: {} absent", dir.display()); - return; - } - }; + let dir = ec_testkit::fixture("vectors/vp9-libvpx"); + let entries = std::fs::read_dir(&dir).expect("vector directory"); let mut md5_files: Vec = entries .filter_map(|e| e.ok().map(|e| e.path())) .filter(|p| p.extension().is_some_and(|x| x == "md5")) diff --git a/crates/ec-vp9/tests/it/main.rs b/crates/ec-vp9/tests/it/main.rs index e716a9d6..586489ef 100644 --- a/crates/ec-vp9/tests/it/main.rs +++ b/crates/ec-vp9/tests/it/main.rs @@ -25,7 +25,6 @@ mod scratch_lossless; mod scratch_pixdump10; mod scratch_pixdump; mod scratch_realsweep; -mod scratch_synth; mod scratch_tiledbg; mod scratch_tok; mod subsampling_exact; diff --git a/crates/ec-vp9/tests/it/odd_dimensions_exact.rs b/crates/ec-vp9/tests/it/odd_dimensions_exact.rs index 46e651d8..df9d47f4 100644 --- a/crates/ec-vp9/tests/it/odd_dimensions_exact.rs +++ b/crates/ec-vp9/tests/it/odd_dimensions_exact.rs @@ -27,7 +27,7 @@ fn ensure_even_fixture(path: &Path) { if let Some(dir) = path.parent() { std::fs::create_dir_all(dir).unwrap(); } - let st = std::process::Command::new("ffmpeg") + let st = ec_testkit::ffmpeg() .args([ "-v", "error", @@ -55,7 +55,7 @@ fn ensure_even_fixture(path: &Path) { ]) .arg(path) .output() - .expect("ffmpeg with libvpx-vp9 must be on PATH for the witnesses"); + .expect("ffmpeg with libvpx-vp9 runs for the witnesses"); assert!(st.status.success(), "fixture generation failed: {st:?}"); } @@ -86,12 +86,12 @@ fn patched(ivf: &[u8], nw: u16, nh: u16) -> Vec { /// ffmpeg's decoded rawvideo byte stream (frame-packed I420, ceil chroma). fn ffmpeg_raw_yuv(path: &Path) -> Vec { - let out = std::process::Command::new("ffmpeg") + let out = ec_testkit::ffmpeg() .args(["-v", "error", "-i"]) .arg(path) .args(["-f", "rawvideo", "-pix_fmt", "yuv420p", "-"]) .output() - .expect("ffmpeg on PATH"); + .expect("ffmpeg runs"); assert!(out.status.success(), "ffmpeg decode failed: {out:?}"); out.stdout } @@ -100,7 +100,7 @@ fn ffmpeg_raw_yuv(path: &Path) -> Vec { /// every frame must carry the odd coded size (frame 0 sets it, the rest /// inherit it), and there must be inter frames. fn check(nw: u16, nh: u16) { - let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../target/vp9-witness"); + let dir = std::env::temp_dir().join("ec-vp9-witness"); let even = dir.join("odd-src-322x242.ivf"); ensure_even_fixture(&even); let odd = dir.join(format!("odd-{nw}x{nh}.ivf")); diff --git a/crates/ec-vp9/tests/it/scaledref_exact.rs b/crates/ec-vp9/tests/it/scaledref_exact.rs index e60d0c94..302f41d7 100644 --- a/crates/ec-vp9/tests/it/scaledref_exact.rs +++ b/crates/ec-vp9/tests/it/scaledref_exact.rs @@ -40,13 +40,13 @@ fn fixture(name: &str) -> std::path::PathBuf { /// Run ffmpeg over `path` with `args` and return its rawvideo stdout. fn ffmpeg_raw(path: &std::path::Path, args: &[&str]) -> Vec { - let out = std::process::Command::new("ffmpeg") + let out = ec_testkit::ffmpeg() .args(["-v", "error", "-y", "-i"]) .arg(path) .args(args) .args(["-f", "rawvideo", "-pix_fmt", "yuv420p", "-"]) .output() - .expect("ffmpeg on PATH"); + .expect("ffmpeg runs"); assert!(out.status.success(), "ffmpeg decode failed: {out:?}"); out.stdout } diff --git a/crates/ec-vp9/tests/it/scratch_bool.rs b/crates/ec-vp9/tests/it/scratch_bool.rs index 7033bccc..b1176967 100644 --- a/crates/ec-vp9/tests/it/scratch_bool.rs +++ b/crates/ec-vp9/tests/it/scratch_bool.rs @@ -3,8 +3,7 @@ use ec_vp9::bool::BoolDecoder; #[test] fn probe_first_bools() { - let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); - let bytes = std::fs::read(dir.join("fixtures/vp9/lossless-64.ivf")).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture("vp9/lossless-64.ivf")).unwrap(); let (_, _, _, frames) = ivf::parse_ivf(&bytes); let frame = &frames[0].data; println!("slice bytes: {:02x?}", &frame[18..26]); diff --git a/crates/ec-vp9/tests/it/scratch_err.rs b/crates/ec-vp9/tests/it/scratch_err.rs index f60a97e4..6aca5f15 100644 --- a/crates/ec-vp9/tests/it/scratch_err.rs +++ b/crates/ec-vp9/tests/it/scratch_err.rs @@ -2,14 +2,10 @@ use crate::ivf; use ec_vp9::decode::Decoder; #[test] fn show_err() { - let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); - let bytes = std::fs::read(dir.join("fixtures/bitstreams/vp9-superframe-altref.ivf")).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture("bitstreams/vp9-superframe-altref.ivf")).unwrap(); let (_, _, _, frames) = ivf::parse_ivf(&bytes); let mut d = Decoder::new(); - let dir2 = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); - let b2 = std::fs::read(dir2.join("fixtures/bitstreams/vp9-superframe-altref.ivf")).unwrap(); - let (_, _, _, f2) = ivf::parse_ivf(&b2); - println!("f0 bytes: {:02x?}", &f2[0].data[16..24]); + println!("f0 bytes: {:02x?}", &frames[0].data[16..24]); match d.decode(&frames[0].data) { Ok(_) => println!("OK"), Err(e) => println!("ERR: {e}"), diff --git a/crates/ec-vp9/tests/it/scratch_hdr.rs b/crates/ec-vp9/tests/it/scratch_hdr.rs index 23e133da..dc39f941 100644 --- a/crates/ec-vp9/tests/it/scratch_hdr.rs +++ b/crates/ec-vp9/tests/it/scratch_hdr.rs @@ -2,10 +2,7 @@ use ec_vp9_syntax::Vp9Parser; #[test] fn hdr_probe() { for name in ["lossless-64.ivf", "key-320.ivf"] { - let mut p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")); - p.pop(); p.pop(); - p = p.join("fixtures/vp9").join(name); - let bytes = std::fs::read(&p).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture(&format!("vp9/{name}"))).unwrap(); let fsize = u32::from_le_bytes(bytes[32..36].try_into().unwrap()) as usize; let frame = &bytes[44..44 + fsize]; let mut pp = Vp9Parser::new(); diff --git a/crates/ec-vp9/tests/it/scratch_hdr2.rs b/crates/ec-vp9/tests/it/scratch_hdr2.rs index 01e05635..a0283f4e 100644 --- a/crates/ec-vp9/tests/it/scratch_hdr2.rs +++ b/crates/ec-vp9/tests/it/scratch_hdr2.rs @@ -2,8 +2,7 @@ use crate::ivf; use ec_vp9_syntax::Vp9Parser; #[test] fn dump_hdr() { - let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); - let bytes = std::fs::read(dir.join("fixtures/vp9/lossless-64.ivf")).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture("vp9/lossless-64.ivf")).unwrap(); let (_, _, _, frames) = ivf::parse_ivf(&bytes); let mut p = Vp9Parser::new(); let h = p.parse_frame(&frames[0].data).unwrap(); diff --git a/crates/ec-vp9/tests/it/scratch_hdr3.rs b/crates/ec-vp9/tests/it/scratch_hdr3.rs index 0499b965..fc7296cd 100644 --- a/crates/ec-vp9/tests/it/scratch_hdr3.rs +++ b/crates/ec-vp9/tests/it/scratch_hdr3.rs @@ -2,8 +2,7 @@ use crate::ivf; use ec_vp9_syntax::Vp9Parser; #[test] fn dump_hdr() { - let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); - let bytes = std::fs::read(dir.join("fixtures/bitstreams/vp9-superframe-altref.ivf")).unwrap(); + let bytes = std::fs::read(ec_testkit::fixture("bitstreams/vp9-superframe-altref.ivf")).unwrap(); let (_, _, _, frames) = ivf::parse_ivf(&bytes); let subs = ec_vp9_syntax::superframe::split(&frames[0].data).unwrap(); println!("subframes: {}", subs.len()); diff --git a/crates/ec-vp9/tests/it/scratch_lfdump.rs b/crates/ec-vp9/tests/it/scratch_lfdump.rs index ed1260d4..cfe9f208 100644 --- a/crates/ec-vp9/tests/it/scratch_lfdump.rs +++ b/crates/ec-vp9/tests/it/scratch_lfdump.rs @@ -6,12 +6,12 @@ use crate::ivf; use ec_vp9::decode::Decoder; fn ffmpeg_raw_yuv(path: &std::path::Path) -> Vec { - let out = std::process::Command::new("ffmpeg") + let out = ec_testkit::ffmpeg() .args(["-v", "error", "-i"]) .arg(path) .args(["-f", "rawvideo", "-pix_fmt", "yuv420p", "-"]) .output() - .expect("ffmpeg on PATH"); + .expect("ffmpeg runs"); assert!(out.status.success()); out.stdout } @@ -19,7 +19,7 @@ fn ffmpeg_raw_yuv(path: &std::path::Path) -> Vec { #[test] fn dump_lf_diff_map() { let path = - std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/vp9/key-320.ivf"); + ec_testkit::fixture("vp9/key-320.ivf"); let bytes = std::fs::read(&path).unwrap(); let (_f, _w, _h, frames) = ivf::parse_ivf(&bytes); let reference = ffmpeg_raw_yuv(&path); @@ -38,9 +38,9 @@ fn dump_lf_diff_map() { dec.decode(&fr.data).expect("decode"); } let pic_pre = dec.decode(&frames[fi].data).expect("decode").expect("shown"); - std::fs::write("/tmp/y_pre_ours.raw", pic_pre.y[..ysz].iter().map(|&v| v as u8).collect::>()).unwrap(); - std::fs::write("/tmp/u_pre_ours.raw", pic_pre.u.iter().map(|&v| v as u8).collect::>()).unwrap(); - std::fs::write("/tmp/v_pre_ours.raw", pic_pre.v.iter().map(|&v| v as u8).collect::>()).unwrap(); + std::fs::write(std::env::temp_dir().join("y_pre_ours.raw"), pic_pre.y[..ysz].iter().map(|&v| v as u8).collect::>()).unwrap(); + std::fs::write(std::env::temp_dir().join("u_pre_ours.raw"), pic_pre.u.iter().map(|&v| v as u8).collect::>()).unwrap(); + std::fs::write(std::env::temp_dir().join("v_pre_ours.raw"), pic_pre.v.iter().map(|&v| v as u8).collect::>()).unwrap(); drop(skip_lf); // Post-LF run (fresh decoder). @@ -49,9 +49,9 @@ fn dump_lf_diff_map() { dec.decode(&fr.data).expect("decode"); } let pic_post = dec.decode(&frames[fi].data).expect("decode").expect("shown"); - std::fs::write("/tmp/y_post_ours.raw", pic_post.y[..ysz].iter().map(|&v| v as u8).collect::>()).unwrap(); - std::fs::write("/tmp/u_post_ours.raw", pic_post.u.iter().map(|&v| v as u8).collect::>()).unwrap(); - std::fs::write("/tmp/v_post_ours.raw", pic_post.v.iter().map(|&v| v as u8).collect::>()).unwrap(); + std::fs::write(std::env::temp_dir().join("y_post_ours.raw"), pic_post.y[..ysz].iter().map(|&v| v as u8).collect::>()).unwrap(); + std::fs::write(std::env::temp_dir().join("u_post_ours.raw"), pic_post.u.iter().map(|&v| v as u8).collect::>()).unwrap(); + std::fs::write(std::env::temp_dir().join("v_post_ours.raw"), pic_post.v.iter().map(|&v| v as u8).collect::>()).unwrap(); let fsz = ysz + 2 * (w / 2) * (h / 2); let ff = &reference[fi * fsz..fi * fsz + ysz]; diff --git a/crates/ec-vp9/tests/it/scratch_lossless.rs b/crates/ec-vp9/tests/it/scratch_lossless.rs index b4d4948f..45c1f52a 100644 --- a/crates/ec-vp9/tests/it/scratch_lossless.rs +++ b/crates/ec-vp9/tests/it/scratch_lossless.rs @@ -2,11 +2,10 @@ use crate::ivf; use ec_vp9::decode::Decoder; #[test] fn lossless_matches() { - let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); - let path = dir.join("fixtures/vp9/lossless-64.ivf"); + let path = ec_testkit::fixture("vp9/lossless-64.ivf"); let bytes = std::fs::read(&path).unwrap(); let (_, w, h, frames) = ivf::parse_ivf(&bytes); - let refout = std::process::Command::new("ffmpeg") + let refout = ec_testkit::ffmpeg() .args(["-v","error","-i", path.to_str().unwrap(), "-frames:v","1","-f","rawvideo","-pix_fmt","yuv420p","-"]) .output().unwrap().stdout; let mut d = Decoder::new(); diff --git a/crates/ec-vp9/tests/it/scratch_pixdump.rs b/crates/ec-vp9/tests/it/scratch_pixdump.rs index 6d343184..3c09ee87 100644 --- a/crates/ec-vp9/tests/it/scratch_pixdump.rs +++ b/crates/ec-vp9/tests/it/scratch_pixdump.rs @@ -9,11 +9,10 @@ use ec_vp9::decode::Decoder; #[test] +#[ignore = "manual dump: set INTER_IVF and EC_VP9_PIXDUMP"] fn pixdump() { - let (Ok(ivf), Ok(out)) = (std::env::var("INTER_IVF"), std::env::var("EC_VP9_PIXDUMP")) else { - eprintln!("SKIP scratch_pixdump: set INTER_IVF and EC_VP9_PIXDUMP"); - return; - }; + let ivf = std::env::var("INTER_IVF").expect("set INTER_IVF"); + let out = std::env::var("EC_VP9_PIXDUMP").expect("set EC_VP9_PIXDUMP"); let bytes = std::fs::read(&ivf).expect("read ivf"); let (_, w, h, frames) = parse_ivf(&bytes); let mut decoder = Decoder::new(); diff --git a/crates/ec-vp9/tests/it/scratch_pixdump10.rs b/crates/ec-vp9/tests/it/scratch_pixdump10.rs index 16c68d81..150840fd 100644 --- a/crates/ec-vp9/tests/it/scratch_pixdump10.rs +++ b/crates/ec-vp9/tests/it/scratch_pixdump10.rs @@ -10,11 +10,10 @@ use ec_vp9::decode::Decoder; #[test] +#[ignore = "manual dump: set INTER_IVF and EC_VP9_PIXDUMP"] fn pixdump10() { - let (Ok(ivf), Ok(out)) = (std::env::var("INTER_IVF"), std::env::var("EC_VP9_PIXDUMP")) else { - eprintln!("SKIP scratch_pixdump10: set INTER_IVF and EC_VP9_PIXDUMP"); - return; - }; + let ivf = std::env::var("INTER_IVF").expect("set INTER_IVF"); + let out = std::env::var("EC_VP9_PIXDUMP").expect("set EC_VP9_PIXDUMP"); let bytes = std::fs::read(&ivf).expect("read ivf"); let (_, w, h, frames) = parse_ivf(&bytes); let mut decoder = Decoder::new(); diff --git a/crates/ec-vp9/tests/it/scratch_realsweep.rs b/crates/ec-vp9/tests/it/scratch_realsweep.rs index 16831377..6cc30679 100644 --- a/crates/ec-vp9/tests/it/scratch_realsweep.rs +++ b/crates/ec-vp9/tests/it/scratch_realsweep.rs @@ -17,12 +17,12 @@ use crate::ivf; use ec_vp9::decode::Decoder; #[test] +#[ignore = "manual sweep: set SWEEP_SRC or SWEEP_IVF"] fn real_content_sweep() { let src = std::env::var("SWEEP_SRC").unwrap_or_default(); let prebuilt = std::env::var("SWEEP_IVF").ok(); if src.is_empty() && prebuilt.is_none() { - println!("SKIP: set SWEEP_SRC=