In qoi-bench, report and skip invalid png files

This commit is contained in:
Ivan Smirnov 2022-01-02 18:58:54 +03:00
parent 59e67b455a
commit b8fe879b22

View file

@ -374,7 +374,12 @@ fn bench_png(filename: &Path, seconds: f64, use_median: bool) -> Result<ImageBen
fn bench_suite(files: &[PathBuf], seconds: f64, use_median: bool) -> Result<()> { fn bench_suite(files: &[PathBuf], seconds: f64, use_median: bool) -> Result<()> {
let mut totals = BenchTotals::new(); let mut totals = BenchTotals::new();
for file in files { for file in files {
totals.update(&bench_png(file, seconds, use_median)?); match bench_png(file, seconds, use_median) {
Ok(res) => totals.update(&res),
Err(err) => {
eprintln!("Error processing `{}`: {}", file.display(), err);
}
}
} }
totals.report(use_median); totals.report(use_median);
Ok(()) Ok(())