mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 03:18:53 +00:00
[STAB-861] Suppress known-benign core dumps in CI (#21321)
### What does this PR do?
- for these kinds of aborts which we test in CI, introduce a feature
flag to suppress core dumps and crash reporting only from that abort,
and set the flag when running the test:
- libuv stub functions
- Node-API abort (used in particular when calling illegal functions
during finalizers)
- passing `process.kill` its own PID
- core dumps are suppressed with `setrlimit`, and crash reporting with
the new `suppress_reporting` field. these suppressions are only engaged
right before crashing, so we won't ignore new kinds of crashes that come
up in these tests.
- for the test bindings used to test the crash handler in
`run-crash-handler.test.ts`, disables core dumps but does not disable
crash reporting (because crashes get reported to a server that the test
is running to make sure they are reported)
- fixes a panic when printing source code around an error containing
`\n\r`
- updates the code where we clone vendor tests to checkout the right tag
- adds `vendor/elysia/test/path/plugin.test.ts` to
no-validate-exceptions
- this failure was exposed by starting to test the version of elysia we
have been intending to test. the crash trace suggests it may be fixed by
#21307.
- makes dumping core or uploading a crash report count as a failing test
- this ensures we don't realize a crash has occurred if it happened in a
subprocess and the main test doesn't adequately check the exit code. to
spawn a subprocess you expect to fail, prefer `expect(code).toBe(1)`
over `expect(code).not.toBe(0)`. if you really expect multiple possible
erroneous exit codes, you might try `expect(signal).toBeNull()` to still
disallow crashes.
### How did you verify your code works?
Running affected tests on a Linux machine with core dumps set up and
checking no new ones appear.
https://buildkite.com/bun/bun/builds/21465 has no core dumps.
This commit is contained in:
@@ -1613,34 +1613,34 @@ pub fn indexOfLineRanges(text: []const u8, target_line: u32, comptime line_range
|
||||
cursor.i = current_i;
|
||||
cursor.width = 0;
|
||||
const current_line_range: LineRange = brk: {
|
||||
if (iter.next(&cursor)) {
|
||||
const codepoint = cursor.c;
|
||||
switch (codepoint) {
|
||||
'\n' => {
|
||||
const start = prev_end;
|
||||
prev_end = cursor.i;
|
||||
bun.assert(iter.next(&cursor)); // cursor points to current_i where we know there is some character
|
||||
const codepoint = cursor.c;
|
||||
switch (codepoint) {
|
||||
'\n' => {
|
||||
const start = prev_end;
|
||||
prev_end = cursor.i;
|
||||
break :brk .{
|
||||
.start = start,
|
||||
.end = cursor.i + 1,
|
||||
};
|
||||
},
|
||||
'\r' => {
|
||||
const current_end = cursor.i;
|
||||
if (iter.next(&cursor) and cursor.c == '\n') {
|
||||
defer prev_end = cursor.i;
|
||||
break :brk .{
|
||||
.start = start,
|
||||
.start = prev_end,
|
||||
.end = current_end,
|
||||
};
|
||||
} else {
|
||||
break :brk .{
|
||||
.start = prev_end,
|
||||
.end = cursor.i + 1,
|
||||
};
|
||||
},
|
||||
'\r' => {
|
||||
const current_end = cursor.i;
|
||||
if (iter.next(&cursor)) {
|
||||
const codepoint2 = cursor.c;
|
||||
if (codepoint2 == '\n') {
|
||||
defer prev_end = cursor.i;
|
||||
break :brk .{
|
||||
.start = prev_end,
|
||||
.end = current_end,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
else => continue,
|
||||
}
|
||||
}
|
||||
},
|
||||
else => continue,
|
||||
}
|
||||
@panic("unreachable");
|
||||
};
|
||||
|
||||
if (ranges.len == line_range_count and current_line <= target_line) {
|
||||
|
||||
Reference in New Issue
Block a user