-
Notifications
You must be signed in to change notification settings - Fork 5k
rust: fix cargo check --tests for bun_parsers and bun_sys after #34820/#35002 #35068
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
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a4b84e3
parsers: fix cargo test -p bun_parsers after #34820 and #35002
robobun a5d8232
Address review: move highway_memmem shim to native_test_shims.rs, fix…
robobun 0568075
test: guard that cfg(test) compiles for bun_parsers and bun_sys
robobun bc406ca
sys: keep stderr coverage in dropping_stdio_is_safe via File::from_fd…
robobun 5ce0a97
test: match sibling lolhtml skip guard, ignore stdout, widen error fi…
robobun 930c7fd
sys: also assert stderr survives in dropping_stdio_is_safe
robobun 58e25b4
ci: retrigger
robobun 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // Verifies that the `#[cfg(test)]` code in a fixed set of Rust crates compiles. | ||
| // | ||
| // `bun bd`, `rust:check`, and `rust:clippy` all build with the default cfg only, | ||
| // so a workspace-wide refactor that removes a symbol whose sole caller sits | ||
| // behind `#[cfg(test)]` is invisible to every other CI lane. That is exactly how | ||
| // #35002 broke `cargo test -p bun_parsers` (removed `Expr::get_boolean`) and | ||
| // `cargo test -p bun_sys` (removed `File::stderr`). | ||
| // | ||
| // This does not try to link or run the unit tests (linking needs the C/C++ dep | ||
| // archive assembled by `scripts/bench-json-rust.sh`); `cargo check --tests` is | ||
| // enough to catch the class of breakage above and is fast on a warm build tree. | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| import { expect, test } from "bun:test"; | ||
| import { existsSync } from "node:fs"; | ||
| import { join } from "node:path"; | ||
|
|
||
| const repo = join(import.meta.dir, "..", ".."); | ||
|
|
||
| // Crates whose `#[cfg(test)]` modules are worth guarding here. Keep this list | ||
| // small: each entry costs a `cargo check` of its dependency closure. | ||
| const CRATES = ["bun_parsers", "bun_sys"]; | ||
|
|
||
| const cargo = Bun.which("cargo"); | ||
| // `cargo check` needs a resolvable workspace: the codegen dir from | ||
| // `bun bd` / `bun run build --configure-only`, and vendor/lolhtml (a path dep | ||
| // in the root Cargo.toml). Test-only lanes run a prebuilt binary and have | ||
| // neither; see scripts/rust-miri.ts for the same prerequisite check. | ||
| const workspaceReady = | ||
| existsSync(join(repo, "build", "debug", "codegen", "build_options.rs")) && | ||
| existsSync(join(repo, "vendor", "lolhtml", "Cargo.toml")); | ||
|
|
||
| test.skipIf(!cargo || !workspaceReady)( | ||
| `cargo check --tests compiles: ${CRATES.join(", ")}`, | ||
| async () => { | ||
| await using proc = Bun.spawn({ | ||
| cmd: [cargo!, "check", ...CRATES.flatMap(c => ["-p", c]), "--tests", "--keep-going", "--message-format=short"], | ||
| cwd: repo, | ||
| env: { ...process.env, CARGO_TERM_COLOR: "never" }, | ||
| stdout: "ignore", | ||
| stderr: "pipe", | ||
| }); | ||
| const [stderr, exitCode] = await Promise.all([proc.stderr.text(), proc.exited]); | ||
| const errors = stderr | ||
| .split("\n") | ||
| .filter(l => /^error(\[|:)|: error[[:]/.test(l)) | ||
| .join("\n"); | ||
| expect(errors).toBe(""); | ||
| expect(exitCode).toBe(0); | ||
| }, | ||
| 120_000, | ||
| ); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
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.