From 7a41f7902639b150a2fa8186c243b522604a8bba Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 24 Nov 2026 22:31:46 +0000 Subject: [PATCH] tests: heif damage sweep runs the divisor's fraction --- Cargo.lock | 1 + crates/heif/Cargo.toml | 1 + crates/heif/src/tests_synthetic.rs | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33ed1761f..e89a92493 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2946,6 +2946,7 @@ dependencies = [ name = "craft-heif" version = "0.1.0" dependencies = [ + "craft-testkit", "heic-rs", "proptest", "rayon", diff --git a/crates/heif/Cargo.toml b/crates/heif/Cargo.toml index b79b8f989..8b505eaf2 100644 --- a/crates/heif/Cargo.toml +++ b/crates/heif/Cargo.toml @@ -20,6 +20,7 @@ heic-rs = { version = "=0.1.4", default-features = false, features = ["std", "pa rayon = { workspace = true, optional = true } [dev-dependencies] +craft-testkit = { workspace = true } proptest = { workspace = true } [features] diff --git a/crates/heif/src/tests_synthetic.rs b/crates/heif/src/tests_synthetic.rs index dbd4ca70b..8d4f9fd96 100644 --- a/crates/heif/src/tests_synthetic.rs +++ b/crates/heif/src/tests_synthetic.rs @@ -186,7 +186,9 @@ fn grid_tiles_are_held_to_the_pixel_budget_together() { fn truncated_and_corrupted_files_are_errors_not_panics() { let bytes = build(&Spec { props: vec![FULL_601, Prop::Irot(1)], thumbnail: Some(&grey), ..Spec::new(64, 64, &grey) }); let full = decode(&bytes, &Options::default()).unwrap(); - for cut in (0..bytes.len()).step_by(7) { + // The gate runs a divisor's fraction of the cuts and flips; nightly runs all. + let divisor = craft_testkit::hostile::divisor(); + for cut in (0..bytes.len()).step_by(7 * divisor) { let b = &bytes[..cut]; // Cut inside the photo: an error. Cut in the trailing thumbnail: the whole photo. if let (Ok(_), Ok(d)) = (probe(b), decode(b, &Options::default())) { @@ -197,7 +199,7 @@ fn truncated_and_corrupted_files_are_errors_not_panics() { } // Flip bits all over the file: any outcome but a panic. let mut state = 0x2545_f491_u32; - for _ in 0..400 { + for _ in 0..400 / divisor { let mut b = bytes.clone(); for _ in 0..3 { state ^= state << 13;