-
Notifications
You must be signed in to change notification settings - Fork 5k
ai slop #35410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
ai slop #35410
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
test/internal/source-lints/uws-terminate-diagnostic.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import { Glob } from "bun"; | ||
| import { expect, test } from "bun:test"; | ||
| import { readFileSync } from "node:fs"; | ||
| import path from "node:path"; | ||
|
|
||
| // #35256 banned <iostream> from Bun's release build and stripped the | ||
| // `std::cerr << "Error: ..."` lines ahead of each std::terminate() in bun-uws. | ||
| // Bun routes std::terminate through its own crash handler (JSCInitialize calls | ||
| // std::set_terminate), so without these writes every guard dies with the same | ||
| // generic "panic: A C++ exception occurred" and nothing names which uWS | ||
| // invariant fired. Keep every std::terminate() in bun-uws paired with a | ||
| // preceding fputs/fprintf to stderr, the replacement the shim prescribes. | ||
| test("bun-uws std::terminate() sites write a diagnostic to stderr first", async () => { | ||
| const uwsSrc = path.resolve(import.meta.dir, "..", "..", "..", "packages", "bun-uws", "src"); | ||
|
robobun marked this conversation as resolved.
|
||
|
|
||
| let terminates = 0; | ||
| const violations: string[] = []; | ||
| const glob = new Glob("**/*.{h,hpp,cpp}"); | ||
| for await (const rel of glob.scan({ cwd: uwsSrc })) { | ||
| const source = readFileSync(path.join(uwsSrc, rel), "utf8"); | ||
| const lines = source.split("\n"); | ||
| for (let i = 0; i < lines.length; i++) { | ||
| if (!/\bstd::terminate\s*\(\s*\)/.test(lines[i])) continue; | ||
| terminates++; | ||
| // Look back over the immediately preceding non-empty lines inside the | ||
| // same block for a stderr write. | ||
| let j = i - 1; | ||
| let ok = false; | ||
| while (j >= 0) { | ||
| const prev = lines[j].trim(); | ||
| if (prev === "" || prev.startsWith("//") || prev.startsWith("/*") || prev.startsWith("*")) { | ||
| j--; | ||
| continue; | ||
| } | ||
| if (prev.endsWith("{")) break; | ||
| if (/\b(fputs|fprintf)\b.*\bstderr\b/.test(prev)) ok = true; | ||
| break; | ||
| } | ||
| if (!ok) { | ||
| violations.push(`packages/bun-uws/src/${rel}:${i + 1}`); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| expect(terminates).toBeGreaterThan(0); | ||
| violations.sort(); | ||
| expect(violations).toEqual([]); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.