Skip the AVI test when the AVI files have left the library
Browse files at this commit283d44593bbcb006ae2ca75ec7c1cfc264d486a0Parent: 3e4bd29- fix
- skip the AVI test when the AVI files have left the library
1 changed file +11 -12
- crates/ec-probe/tests/library.rs +11 -12
crates/ec-probe/tests/library.rsmodified+11 -12
| @@ -185,10 +185,11 @@ fn assert_avi_index_is_bounded(path: &Path) { | ||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | 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"); | |
| 190 | 190 | 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) | |
| 192 | 193 | / reader.index_len() as f64; |
| 193 | 194 | ( |
| 194 | 195 | reader |
| @@ -198,11 +199,7 @@ fn avi_indexed_point(path: &Path, target: u64, after: bool) -> (ec_riff::AviInde | ||
| 198 | 199 | ) |
| 199 | 200 | } |
| 200 | 201 | |
| 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 { | |
| 206 | 203 | let denominator = u128::from(stream.scale) * u128::from(stream.sample_rate); |
| 207 | 204 | let numerator = u128::from(samples) * u128::from(stream.rate); |
| 208 | 205 | let units = if round_up { |
| @@ -221,7 +218,6 @@ fn avi_codec_preroll(codec: CodecId, rate: u32) -> f64 { | ||
| 221 | 218 | } |
| 222 | 219 | } |
| 223 | 220 | |
| 224 | - | |
| 225 | 221 | fn decode_stream_to_eof( |
| 226 | 222 | reader: &mut Reader, |
| 227 | 223 | stream: u32, |
| @@ -385,8 +381,7 @@ fn assert_avi_seeks_match_reference(path: &Path) { | ||
| 385 | 381 | let ours = |
| 386 | 382 | decode_window(&mut reader, audio.index, 2.0).expect("decode after seek"); |
| 387 | 383 | 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); | |
| 390 | 385 | assert!( |
| 391 | 386 | score >= 0.999, |
| 392 | 387 | "{} @{:.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() { | ||
| 615 | 610 | assert!(packets > 0, "{}: no audio packets", path.display()); |
| 616 | 611 | assert!(frames > 0, "{}: no decoded audio", path.display()); |
| 617 | 612 | } |
| 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 | + } | |
| 619 | 618 | } |
| 620 | 619 | |
| 621 | 620 | #[test] |