tests: heif damage sweep runs the divisor's fraction

This commit is contained in:
aiongg
2026-11-24 22:31:46 +00:00
parent d1b4304952
commit 7a41f79026
3 changed files with 6 additions and 2 deletions
Generated
+1
View File
@@ -2946,6 +2946,7 @@ dependencies = [
name = "craft-heif"
version = "0.1.0"
dependencies = [
"craft-testkit",
"heic-rs",
"proptest",
"rayon",
+1
View File
@@ -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]
+4 -2
View File
@@ -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;