Skip to content
This repository was archived by the owner on Jul 11, 2026. It is now read-only.

Commit 6dba9ed

Browse files
h4x0rclaude
andcommitted
test(verify): RED — verify() on a shared &self for parallel decompression
verify() hashes the whole image; MD5/SHA1 are serial, but the zlib decompression (the CPU cost) is not. The parallel consumer requires verify to take &self so chunks can decompress concurrently. Adds a test that calls verify() on a non-mut binding (forces &self) and asserts the computed MD5 still matches exfat1.E01's stored MD5 — i.e. parallel decompression reproduces the exact serial byte stream. Fails to compile today: verify is &mut self. GREEN parallelizes the decompression behind a &self signature. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ef0ea45 commit 6dba9ed

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

ewf/tests/concurrent_reads.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,19 @@ fn concurrent_reads_of_same_chunk_are_stable() {
8282
}
8383
});
8484
}
85+
86+
/// `verify()` must run through a shared `&self` so it can decompress chunks in
87+
/// PARALLEL (MD5/SHA1 are serial, but zlib decompression — the CPU cost — is
88+
/// not). A non-mut binding forces the `&self` signature; the computed MD5 must
89+
/// still match the stored hash, i.e. parallel decompression reproduces the
90+
/// exact serial byte stream. exfat1.E01 ships a stored MD5.
91+
#[test]
92+
fn verify_runs_on_shared_ref_and_matches_stored_md5() {
93+
let reader = EwfReader::open(data("exfat1.E01")).expect("open");
94+
let result = reader.verify().expect("verify");
95+
assert_eq!(
96+
result.md5_match,
97+
Some(true),
98+
"parallel verify's computed MD5 must match the stored MD5"
99+
);
100+
}

0 commit comments

Comments
 (0)