forge
Explore
Log in

Don't you dare go Hollow

Skip the AVI test when the AVI files have left the library

Browse files at this commit

283d44593bbcb006ae2ca75ec7c1cfc264d486a0Ahmet Kaan GümüşParent: 3e4bd29
  • fix
    • skip the AVI test when the AVI files have left the library
Show full message
fix(probe): skip the AVI test when the AVI files have left the library

`avi_audio_chunks_end_cleanly_on_real_files` asserted that at least one
of the two hard-coded AVI paths was present, so deleting that download
failed the workspace run. Its two siblings already skip; sweeping the
five test files that name paths under Downloads or Videos found this to
be the only one that asserted presence rather than skipping.
crates/ec-probe/tests/library.rsmodified+11 -12
@@ -185,10 +185,11 @@ fn assert_avi_index_is_bounded(path: &Path) {
185185 }
186186
187187 fn avi_indexed_point(path: &Path, target: u64, after: bool) -> (ec_riff::AviIndexPoint, f64) {
188- let reader = ec_riff::AviReader::new(File::open(path).expect("open AVI"))
189- .expect("AVI index builds");
188+ let reader =
189+ ec_riff::AviReader::new(File::open(path).expect("open AVI")).expect("AVI index builds");
190190 let stream = *reader.audio_streams().first().expect("AVI audio stream");
191- let interval = f64::from(stream.length) * f64::from(stream.scale) / f64::from(stream.rate)
191+ let interval = f64::from(stream.length) * f64::from(stream.scale)
192+ / f64::from(stream.rate)
192193 / reader.index_len() as f64;
193194 (
194195 reader
@@ -198,11 +199,7 @@ fn avi_indexed_point(path: &Path, target: u64, after: bool) -> (ec_riff::AviInde
198199 )
199200 }
200201
201-fn samples_to_avi_units(
202- stream: ec_riff::AviAudioStream,
203- samples: u64,
204- round_up: bool,
205-) -> u64 {
202+fn samples_to_avi_units(stream: ec_riff::AviAudioStream, samples: u64, round_up: bool) -> u64 {
206203 let denominator = u128::from(stream.scale) * u128::from(stream.sample_rate);
207204 let numerator = u128::from(samples) * u128::from(stream.rate);
208205 let units = if round_up {
@@ -221,7 +218,6 @@ fn avi_codec_preroll(codec: CodecId, rate: u32) -> f64 {
221218 }
222219 }
223220
224-
225221 fn decode_stream_to_eof(
226222 reader: &mut Reader,
227223 stream: u32,
@@ -385,8 +381,7 @@ fn assert_avi_seeks_match_reference(path: &Path) {
385381 let ours =
386382 decode_window(&mut reader, audio.index, 2.0).expect("decode after seek");
387383 let theirs = reference_seek_window(path, at);
388- let (lag, score) =
389- best_frame_corr(&ours, &theirs, channels, frame_samples);
384+ let (lag, score) = best_frame_corr(&ours, &theirs, channels, frame_samples);
390385 assert!(
391386 score >= 0.999,
392387 "{} @{:.0}% {label}: target {target:.3}s landed {at:.3}s lag {lag} frames corr vs reference decoder = {score}",
@@ -615,7 +610,11 @@ fn avi_audio_chunks_end_cleanly_on_real_files() {
615610 assert!(packets > 0, "{}: no audio packets", path.display());
616611 assert!(frames > 0, "{}: no decoded audio", path.display());
617612 }
618- assert!(present > 0, "AVI files absent");
613+ if present == 0 {
614+ // The library is his, so a file can leave it; the sibling AVI tests
615+ // skip the same way rather than failing a run on a deleted download.
616+ eprintln!("AVI files absent, skipping");
617+ }
619618 }
620619
621620 #[test]