forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-hwwt' (a191a35b): test fixture selection matched the whole checkout path, so a worktree named after a codec fed foreign fixtures to it; swept to ec-image/ec-ogg/ec-mp4

Browse files at this commit

c9c94fc17e1bf7bb599248fd0d27588c43d0a403Ahmet Kaan GümüşParent: 6c19568a8b31aa
crates/ec-hw/tests/gpu.rsmodified+32 -3
@@ -366,13 +366,23 @@ fn compare_against_ffmpeg(files: &[PathBuf], codec: Codec, ten_bit: bool) {
366 }366 }
367 }367 }
368 368
369+/// The fixture's own name. Never the whole path: a checkout directory called
370+/// `edith_codecs-av1fast` made every `.ivf` — VP9 included — select as an AV1
371+/// fixture, and the VP9 streams then came back as `obu_forbidden_bit is set`.
372+fn name_of(p: &Path) -> String {
373+ p.file_name()
374+ .unwrap_or_default()
375+ .to_string_lossy()
376+ .to_string()
377+}
378+
369 /// The 4:2:0 fixtures of one kind; the 4:4:4 and monochrome ones are the379 /// The 4:2:0 fixtures of one kind; the 4:4:4 and monochrome ones are the
370 /// profiles this GPU does not decode, and have their own test.380 /// profiles this GPU does not decode, and have their own test.
371 fn profile_420(pattern: &str, codec: &str) -> Vec<PathBuf> {381 fn profile_420(pattern: &str, codec: &str) -> Vec<PathBuf> {
372 fixtures(pattern)382 fixtures(pattern)
373 .into_iter()383 .into_iter()
374 .filter(|p| {384 .filter(|p| {
375- let name = p.to_string_lossy().to_string();385+ let name = name_of(p);
376 name.contains(codec) && !name.contains("444") && !name.contains("monochrome")386 name.contains(codec) && !name.contains("444") && !name.contains("monochrome")
377 })387 })
378 .collect()388 .collect()
@@ -381,17 +391,36 @@ fn profile_420(pattern: &str, codec: &str) -> Vec<PathBuf> {
381 fn eight_bit(pattern: &str, codec: &str) -> Vec<PathBuf> {391 fn eight_bit(pattern: &str, codec: &str) -> Vec<PathBuf> {
382 profile_420(pattern, codec)392 profile_420(pattern, codec)
383 .into_iter()393 .into_iter()
384- .filter(|p| !p.to_string_lossy().contains("10bit"))394+ .filter(|p| !name_of(p).contains("10bit"))
385 .collect()395 .collect()
386 }396 }
387 397
388 fn ten_bit(pattern: &str, codec: &str) -> Vec<PathBuf> {398 fn ten_bit(pattern: &str, codec: &str) -> Vec<PathBuf> {
389 profile_420(pattern, codec)399 profile_420(pattern, codec)
390 .into_iter()400 .into_iter()
391- .filter(|p| p.to_string_lossy().contains("10bit"))401+ .filter(|p| name_of(p).contains("10bit"))
392 .collect()402 .collect()
393 }403 }
394 404
405+/// The selection must not depend on where the repository is checked out.
406+#[test]
407+fn fixture_selection_ignores_the_checkout_path() {
408+ for p in eight_bit(".ivf", "av1") {
409+ let name = name_of(&p);
410+ assert!(
411+ name.starts_with("av1") && !name.contains("10bit"),
412+ "{name} is not an 8-bit AV1 fixture"
413+ );
414+ }
415+ for p in ten_bit(".ivf", "vp9") {
416+ let name = name_of(&p);
417+ assert!(
418+ name.starts_with("vp9") && name.contains("10bit"),
419+ "{name} is not a 10-bit VP9 fixture"
420+ );
421+ }
422+}
423+
395 #[test]424 #[test]
396 fn h264_matches_ffmpeg() {425 fn h264_matches_ffmpeg() {
397 compare_against_ffmpeg(&fixtures(".264"), Codec::H264, false);426 compare_against_ffmpeg(&fixtures(".264"), Codec::H264, false);
crates/ec-image/tests/differential.rsmodified+12 -3
@@ -11,6 +11,15 @@
11 use image::GenericImageView;11 use image::GenericImageView;
12 use std::path::{Path, PathBuf};12 use std::path::{Path, PathBuf};
13 13
14+/// The fixture's own name — never the whole path, which carries the checkout
15+/// directory and has matched fixture keywords by accident.
16+fn name_of(p: &std::path::Path) -> String {
17+ p.file_name()
18+ .unwrap_or_default()
19+ .to_string_lossy()
20+ .to_string()
21+}
22+
14 fn fixtures() -> PathBuf {23 fn fixtures() -> PathBuf {
15 Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/stills")24 Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/stills")
16 }25 }
@@ -115,7 +124,7 @@ fn png_decodes_pixel_exactly() {
115 fn webp_lossless_decodes_pixel_exactly() {124 fn webp_lossless_decodes_pixel_exactly() {
116 let files: Vec<PathBuf> = corpus("webp")125 let files: Vec<PathBuf> = corpus("webp")
117 .into_iter()126 .into_iter()
118- .filter(|p| p.to_string_lossy().contains("lossless"))127+ .filter(|p| name_of(p).contains("lossless"))
119 .collect();128 .collect();
120 if files.is_empty() && skip("webp") {129 if files.is_empty() && skip("webp") {
121 return;130 return;
@@ -183,7 +192,7 @@ fn jpeg_matches_the_incumbent_within_rounding() {
183 fn webp_lossy_reconstructs_at_least_as_well_as_the_incumbent() {192 fn webp_lossy_reconstructs_at_least_as_well_as_the_incumbent() {
184 let files: Vec<PathBuf> = corpus("webp")193 let files: Vec<PathBuf> = corpus("webp")
185 .into_iter()194 .into_iter()
186- .filter(|p| p.to_string_lossy().contains("lossy"))195+ .filter(|p| name_of(p).contains("lossy"))
187 .collect();196 .collect();
188 if files.is_empty() && skip("webp") {197 if files.is_empty() && skip("webp") {
189 return;198 return;
@@ -235,7 +244,7 @@ fn header_dimensions_match_the_incumbent() {
235 let mut checked = 0;244 let mut checked = 0;
236 for extension in ["png", "jpg", "webp"] {245 for extension in ["png", "jpg", "webp"] {
237 for path in corpus(extension) {246 for path in corpus(extension) {
238- if path.to_string_lossy().contains("animated") {247+ if name_of(&path).contains("animated") {
239 continue;248 continue;
240 }249 }
241 let bytes = std::fs::read(&path).unwrap();250 let bytes = std::fs::read(&path).unwrap();
crates/ec-mp4/tests/mp4.rsmodified+1 -1
@@ -246,7 +246,7 @@ fn every_fixture_demuxes_into_the_streams_ffprobe_reports() {
246 rates[i],246 rates[i],
247 avg_rates[i]247 avg_rates[i]
248 );248 );
249- if path.to_string_lossy().contains("23.976") {249+ if name_of(&path).contains("23.976") {
250 assert_eq!(250 assert_eq!(
251 video.frame_rate,251 video.frame_rate,
252 Some(TimeBase::new(24_000, 1001)),252 Some(TimeBase::new(24_000, 1001)),
crates/ec-ogg/tests/ogg.rsmodified+12 -3
@@ -19,6 +19,15 @@ use ec_core::{
19 };19 };
20 use ec_ogg::{Mapping, OggDemuxer, OggMuxer, granule_of, granule_side_data};20 use ec_ogg::{Mapping, OggDemuxer, OggMuxer, granule_of, granule_side_data};
21 21
22+/// The fixture's own name — never the whole path, which carries the checkout
23+/// directory and has matched fixture keywords by accident.
24+fn name_of(p: &std::path::Path) -> String {
25+ p.file_name()
26+ .unwrap_or_default()
27+ .to_string_lossy()
28+ .to_string()
29+}
30+
22 fn fixtures() -> PathBuf {31 fn fixtures() -> PathBuf {
23 Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/audio")32 Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures/audio")
24 }33 }
@@ -327,7 +336,7 @@ fn page_size_does_not_change_the_audio() {
327 let files = ogg_fixtures();336 let files = ogg_fixtures();
328 let Some(path) = files337 let Some(path) = files
329 .iter()338 .iter()
330- .find(|p| p.to_string_lossy().contains("vorbis-ogg-stereo-48000"))339+ .find(|p| name_of(p).contains("vorbis-ogg-stereo-48000"))
331 else {340 else {
332 eprintln!("fixtures absent — skipping");341 eprintln!("fixtures absent — skipping");
333 return;342 return;
@@ -341,7 +350,7 @@ fn damage_costs_one_page_and_no_more() {
341 let files = ogg_fixtures();350 let files = ogg_fixtures();
342 let Some(path) = files351 let Some(path) = files
343 .iter()352 .iter()
344- .find(|p| p.to_string_lossy().contains("vorbis-ogg-stereo-44100"))353+ .find(|p| name_of(p).contains("vorbis-ogg-stereo-44100"))
345 else {354 else {
346 eprintln!("fixtures absent — skipping");355 eprintln!("fixtures absent — skipping");
347 return;356 return;
@@ -458,7 +467,7 @@ fn reads_flac_in_ogg() {
458 let files = ogg_fixtures();467 let files = ogg_fixtures();
459 let Some(source) = files468 let Some(source) = files
460 .iter()469 .iter()
461- .find(|p| p.to_string_lossy().contains("vorbis-ogg-stereo-44100"))470+ .find(|p| name_of(p).contains("vorbis-ogg-stereo-44100"))
462 else {471 else {
463 eprintln!("fixtures absent — skipping");472 eprintln!("fixtures absent — skipping");
464 return;473 return;