Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion test/bundler/native-plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,13 @@ const many_foo = ["foo","foo","foo","foo","foo","foo","foo"]
`;

await Bun.$`echo ${build_code} > build.ts`;
const { stdout, stderr } = await Bun.$`BUN_TEST_TEMP_DIR=${tempdir} ${bunExe()} run build.ts`.throws(false);
// BUN_CRASH_REPORT_URL="": this segfault is deliberate; uploading it to
// CI's remap server pins a spurious "crash reported" error on the next
// unrelated failing test (runner only drains /traces on non-zero exit).
const { stdout, stderr } =
await Bun.$`BUN_CRASH_REPORT_URL="" BUN_ENABLE_CRASH_REPORTING=0 BUN_TEST_TEMP_DIR=${tempdir} ${bunExe()} run build.ts`.throws(
false,
);
const errorString = stderr.toString();
expect(errorString).toContain('\x1b[31m\x1b[2m"native_plugin_test"\x1b[0m');
});
Expand Down
11 changes: 8 additions & 3 deletions test/cli/run/run-crash-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { bunEnv, bunExe, isDebug, isLinux, isPosix, mergeWindowEnvs } from "harn
import path from "path";
const { getMachOImageZeroOffset } = crash_handler;

// CI sets BUN_CRASH_REPORT_URL so unexpected crashes are captured; these
// deliberate crashes must not upload there or the runner pins them on the
// next unrelated failing test as "crash reported" and blocks its retries.
const noReportEnv = { ...bunEnv, BUN_CRASH_REPORT_URL: "", BUN_ENABLE_CRASH_REPORTING: "0" };
Comment thread
robobun marked this conversation as resolved.

// On Linux, debug builds symbolize crash traces by spawning llvm-symbolizer;
// without it the fallback printer has no Rust symbol names to assert on.
const hasSymbolizer = !!(Bun.which("llvm-symbolizer") || Bun.which("llvm-symbolizer-21"));
Expand All @@ -13,7 +18,7 @@ test.if(isDebug && isLinux && hasSymbolizer)(
async () => {
await using proc = Bun.spawn({
cmd: [bunExe(), path.join(import.meta.dir, "fixture-crash.js"), "panic"],
env: bunEnv,
env: noReportEnv,
stdio: ["ignore", "pipe", "pipe"],
});
// The panic header goes to stderr; the symbolized frames are printed by
Expand Down Expand Up @@ -58,7 +63,7 @@ test.if(isPosix)(
// spawning llvm-symbolizer, which can take tens of seconds.
"--debug-crash-handler-use-trace-string",
],
env: bunEnv,
env: noReportEnv,
stdio: ["ignore", "pipe", "pipe"],
});

Expand Down Expand Up @@ -101,7 +106,7 @@ describe.if(isPosix)("terminal signal reflects the crash cause", () => {
approach,
"--debug-crash-handler-use-trace-string",
],
env: bunEnv,
env: noReportEnv,
stdio: ["ignore", "pipe", "pipe"],
});
const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);
Expand Down
13 changes: 7 additions & 6 deletions test/js/node/tls/tls-syscall-fault.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,22 @@ afterEach(() => fault.clear());
// stream; anything past "ARMED" means a TLS socket survived the failed
// allocation and reached its read loop.
const OOM_FIXTURE_MARKERS = ["ARMED", "READ DATA", "CLOSED", "CLIENT ERROR"];
// How `CrashReason::OutOfMemory` is phrased depends on whether a crash report is
// being generated, and CI configures that per job (BUN_CRASH_REPORT_URL is only
// set when its remap server came up). Match either phrasing.
const OOM_CRASH_MESSAGES = ["Bun ran out of memory", "Bun has run out of memory"];
test.skipIf(!fault.available())(
"a failed per-loop TLS buffer allocation reports out of memory instead of faulting inside SSL_read",
async () => {
await using proc = Bun.spawn({
cmd: [bunExe(), join(import.meta.dir, "tls-loop-buffer-oom-fixture.ts")],
env: bunEnv,
// BUN_CRASH_REPORT_URL="": this OOM is deliberate; uploading it to CI's
// remap server would pin a spurious "crash reported" error on the next
// unrelated failing test.
env: { ...bunEnv, BUN_CRASH_REPORT_URL: "", BUN_ENABLE_CRASH_REPORTING: "0" },
stdout: "pipe",
stderr: "pipe",
});
const [stdout, stderr] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);
const outOfMemory = OOM_CRASH_MESSAGES.some(message => stderr.includes(message));
// `CrashReason::OutOfMemory` phrasing varies with SHOW_CRASH_TRACE, so
// match the shared substring (see run-crash-handler.test.ts).
const outOfMemory = stderr.toLowerCase().includes("out of memory");
expect({
markers: stdout
.split("\n")
Expand Down
Loading