mirror of
https://github.com/morluto/rea.git
synced 2026-11-07 05:56:19 -10:00
test(firmware): keep producer fixtures within supported Node limits (#7048)
* test(firmware): bound fixture hashing and avoid Node startup warnings * test(firmware): apply the Wasm flag only on Node 22
This commit is contained in:
2 files changed
+22
-3
No files matched your search
Vendored
+19
-3
@@ -1,8 +1,8 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import { createReadStream } from "node:fs";
|
||||
import {
|
||||
chmod,
|
||||
mkdir,
|
||||
open,
|
||||
readFile,
|
||||
truncate,
|
||||
writeFile,
|
||||
@@ -146,8 +146,24 @@ if (args.includes("--version")) {
|
||||
const oversized = 128 * 1024 * 1024 + 1;
|
||||
await truncate(child, oversized);
|
||||
const oversizedDigest = createHash("sha256");
|
||||
for await (const chunk of createReadStream(child))
|
||||
oversizedDigest.update(chunk);
|
||||
// Reuse one buffer under the real engine's address-space ceiling instead
|
||||
// of depending on when Node collects the stream's retired chunk buffers.
|
||||
const source = await open(child, "r");
|
||||
try {
|
||||
const buffer = Buffer.alloc(64 * 1024);
|
||||
for (;;) {
|
||||
const { bytesRead } = await source.read(
|
||||
buffer,
|
||||
0,
|
||||
buffer.length,
|
||||
null,
|
||||
);
|
||||
if (bytesRead === 0) break;
|
||||
oversizedDigest.update(buffer.subarray(0, bytesRead));
|
||||
}
|
||||
} finally {
|
||||
await source.close();
|
||||
}
|
||||
const oversizedHash = oversizedDigest.digest("hex");
|
||||
const nestedUnknownRecords = [
|
||||
{
|
||||
|
||||
Vendored
+3
@@ -22,6 +22,9 @@ export const firmwareFixture = async (mode = "normal", banner?: string) => {
|
||||
process.execPath,
|
||||
// Keep the synthetic JS producer within the real engines' address-space ceiling.
|
||||
"--jitless",
|
||||
// Node 22 warns when jitless implicitly disables Wasm. Newer releases do
|
||||
// not need this flag, and Node 26 no longer accepts it.
|
||||
...(process.versions.node.startsWith("22.") ? ["--no-expose-wasm"] : []),
|
||||
fileURLToPath(new URL("./producer.mjs", import.meta.url)),
|
||||
engine,
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user