From 3ac5f2e4e6c42d6933a364506b5177a7f2b0a1f2 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sat, 30 May 2026 08:39:56 +0000 Subject: [PATCH] test: apply the ASAN-wide RSS bound to debug builds in the FileSystemRouter leak test Debug builds enable ASAN by default, so its quarantine inflates RSS the same way it does for bun-asan; use the existing wide bound there too so the test stays meaningful under a local debug build. --- test/js/bun/util/filesystem_router.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/js/bun/util/filesystem_router.test.ts b/test/js/bun/util/filesystem_router.test.ts index 4a5fa7b96789..7f475fb3b15c 100644 --- a/test/js/bun/util/filesystem_router.test.ts +++ b/test/js/bun/util/filesystem_router.test.ts @@ -1,7 +1,7 @@ import { FileSystemRouter } from "bun"; import { expect, it } from "bun:test"; import fs, { mkdirSync, rmSync } from "fs"; -import { bunEnv, bunExe, isASAN, isMacOS, isWindows, tempDir, tmpdirSync } from "harness"; +import { bunEnv, bunExe, isASAN, isDebug, isMacOS, isWindows, tempDir, tmpdirSync } from "harness"; import path, { dirname } from "path"; function createTree(basedir: string, paths: string[]) { @@ -522,8 +522,9 @@ it("MatchedRoute.params does not leak", async () => { const growthMB = (process.memoryUsage.rss() - before) / 1024 / 1024; console.error("RSS growth: " + growthMB.toFixed(2) + "MB"); // ASAN's quarantine retains freed allocations (default 256 MB) so RSS - // deltas run far higher under bun-asan; widen the threshold there. - if (growthMB > ${isASAN ? 400 : 20}) throw new Error("leaked " + growthMB.toFixed(2) + "MB"); + // deltas run far higher under ASAN. Debug builds enable ASAN by default, + // so treat them the same; the non-ASAN bound guards the actual leak. + if (growthMB > ${isASAN || isDebug ? 400 : 20}) throw new Error("leaked " + growthMB.toFixed(2) + "MB"); `; await using proc = Bun.spawn({