mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Merge pull request #18260 from davidmann4/fix/nightly-psd-tools-mutations-split
Split the psd-tools mutation sweep into four parts so the nightly fits the test limit (#18259)
This commit is contained in:
1 file changed
+28
-6
@@ -459,11 +459,14 @@ fn next(state: &mut u64) -> u64 {
|
||||
/// header, resources and layer records live. A full sweep cuts each file at every eighth and
|
||||
/// corrupts it 24 times; other runs cut at every other eighth and keep the first 8 corruptions
|
||||
/// (the same seeds).
|
||||
fn run_mutations(src: &Source) {
|
||||
///
|
||||
/// The sweep runs in four parts, each taking every fourth file: the psd-tools full sweep in one
|
||||
/// test ran past nextest's 600 s limit (#18259). Every file still gets the same variants.
|
||||
fn run_mutations(src: &Source, part: usize) {
|
||||
let (root, files) = files_of(src);
|
||||
let (cut_step, corruptions) = if photocraft_testkit::full_sweep() { (1, 24) } else { (2, 8) };
|
||||
let (mut runs, mut panics, mut slow) = (0usize, Vec::new(), Vec::new());
|
||||
for p in &files {
|
||||
for p in files.iter().skip(part).step_by(MUTATION_PARTS) {
|
||||
let name = p.strip_prefix(&root).unwrap_or(p).display().to_string();
|
||||
let Ok(bytes) = std::fs::read(p) else { continue };
|
||||
let mut seed = 0x9E37_79B9_7F4A_7C15u64 ^ bytes.len() as u64;
|
||||
@@ -510,8 +513,10 @@ fn run_mutations(src: &Source) {
|
||||
}
|
||||
}
|
||||
}
|
||||
eprintln!("{}: {runs} mutated imports, {} panics, {} slow (> 20 s): {slow:?}", src.label, panics.len(), slow.len());
|
||||
assert!(panics.is_empty(), "{}: mutated files panicked (Rule 9): {panics:?}", src.label);
|
||||
let label = src.label;
|
||||
eprintln!("{label} part {part}: {runs} mutated imports, {} panics, {} slow (> 20 s): {slow:?}", panics.len(), slow.len());
|
||||
assert!(runs > 0, "{label} part {part}: no file was mutated");
|
||||
assert!(panics.is_empty(), "{label} part {part}: mutated files panicked (Rule 9): {panics:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -529,7 +534,24 @@ fn photoshop_oracle_corpus() {
|
||||
run_oracle(&PHOTOSHOP);
|
||||
}
|
||||
|
||||
const MUTATION_PARTS: usize = 4;
|
||||
|
||||
#[test]
|
||||
fn psd_tools_mutations_never_panic() {
|
||||
run_mutations(&PSD_TOOLS);
|
||||
fn psd_tools_mutations_never_panic_part_0() {
|
||||
run_mutations(&PSD_TOOLS, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn psd_tools_mutations_never_panic_part_1() {
|
||||
run_mutations(&PSD_TOOLS, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn psd_tools_mutations_never_panic_part_2() {
|
||||
run_mutations(&PSD_TOOLS, 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn psd_tools_mutations_never_panic_part_3() {
|
||||
run_mutations(&PSD_TOOLS, 3);
|
||||
}
|
||||
Reference in new issue
Block a user