Skip to content

Commit dd9dae6

Browse files
committed
markdown: make the oversized-input test robust on loaded debug+ASAN runners
The child reserves 4 GiB and runs under a debug+ASAN build: give the test the same explicit timeout its perf-test neighbors in this file use, and let the ASan allocator return null so an allocation failure inside the child surfaces as a catchable error (the SKIP branch) instead of an abort it cannot catch.
1 parent 7970229 commit dd9dae6

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

test/js/bun/md/md-edge-cases.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,10 @@ describe("inputs of 2^32 bytes or more", () => {
11961196
// every entry point. One subprocess covers all four: a crash must not take
11971197
// down the test runner, and one 4 GiB reservation (virtual only, never
11981198
// written) keeps this cheap. The SKIP branch covers runners that cannot
1199-
// reserve 4 GiB at all.
1199+
// reserve 4 GiB; under ASAN the allocator must be allowed to return null
1200+
// for that to surface as a catchable error rather than an abort. The
1201+
// explicit timeout is for the debug+ASAN lanes, where a spawned child is
1202+
// slow under load (same as the linear-time test above).
12001203
test("html, ansi, render and react reject a 2^32-byte input", async () => {
12011204
const script = `
12021205
let big;
@@ -1225,7 +1228,10 @@ describe("inputs of 2^32 bytes or more", () => {
12251228
`;
12261229
await using proc = Bun.spawn({
12271230
cmd: [bunExe(), "-e", script],
1228-
env: bunEnv,
1231+
env: {
1232+
...bunEnv,
1233+
ASAN_OPTIONS: [bunEnv.ASAN_OPTIONS, "allocator_may_return_null=1"].filter(Boolean).join(":"),
1234+
},
12291235
stdout: "pipe",
12301236
stderr: "inherit",
12311237
});
@@ -1236,5 +1242,5 @@ describe("inputs of 2^32 bytes or more", () => {
12361242
JSON.parse(stdout.trim() || '"NO_OUTPUT"'),
12371243
);
12381244
expect(exitCode).toBe(0);
1239-
});
1245+
}, 30_000);
12401246
});

0 commit comments

Comments
 (0)