From 7375ab6e34e511095a74d5a67e57cec28d56fd10 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Wed, 14 Oct 2026 13:58:18 +0800 Subject: [PATCH] test(firmware): stream hashes of sparse oversize fixtures Hash the complete oversize fixture through a read stream rather than allocating the entire 128 MiB file. Preserve the digest and oversize admission test semantics. Validation: node --check and full static checks pass. The capacity fixture was not rerun locally to avoid heavy work. Based on #1892. Co-authored-by: GRAB Racem --- tests/fixtures/firmware/producer.mjs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/fixtures/firmware/producer.mjs b/tests/fixtures/firmware/producer.mjs index d7629073a0..338c746b9b 100644 --- a/tests/fixtures/firmware/producer.mjs +++ b/tests/fixtures/firmware/producer.mjs @@ -1,4 +1,5 @@ import { createHash } from "node:crypto"; +import { createReadStream } from "node:fs"; import { chmod, mkdir, @@ -140,9 +141,10 @@ if (args.includes("--version")) { // accept it even though the unknown chunk's range is small. const oversized = 128 * 1024 * 1024 + 1; await truncate(child, oversized); - const oversizedHash = createHash("sha256") - .update(await readFile(child)) - .digest("hex"); + const oversizedDigest = createHash("sha256"); + for await (const chunk of createReadStream(child)) + oversizedDigest.update(chunk); + const oversizedHash = oversizedDigest.digest("hex"); const nestedUnknownRecords = [ { task: childTask,