-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Passing --no-doc
to ./x.py test causes panic_abort tests to fail
#80124
Comments
This also reproduces with |
I think the issue is that bootstrap passes diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 965d1162145..2b6266be7ee 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1887,7 +1887,7 @@ fn run(self, builder: &Builder<'_>) {
cargo.arg("--doc");
}
DocTests::No => {
- cargo.args(&["--lib", "--bins", "--examples", "--tests", "--benches"]);
+ cargo.args(&["--bins", "--examples", "--tests", "--benches"]);
}
DocTests::Yes => {}
} I've suggested "--no-doc" (and similar things) to the cargo team before, but I don't think there's currently an RFC for it. |
Also it seems like a bug that cargo tries to compile unit tests for the crate even though they're disabled: rust/library/panic_abort/Cargo.toml Line 11 in b52769b
@ehuss do you happen to know if there's an open issue for that? |
For now, that is intentional behavior, so that you can override the setting via the command-line. I feel like it is a toss-up which behavior is better, but for now it's working as intended. |
bootstrap: Unify test argument handling Fixes rust-lang#104198. Does *not* help with rust-lang#80124 because I couldn't figure out a reasonable way to omit `--lib` only for `panic_abort` and not other `std` dependencies. - Remove unnecessary `test_kind` field and `TestKind` struct. These are just subsets of the existing `builder.kind` / `Kind` struct. - Add a new `run_cargo_test` function which handles passing arguments to cargo based on `builder.config` - Switch all Steps in `mod test` to `run_cargo_test` where possible - Combine several steps into one `CrateBootstrap` step. These tests all do the same thing, just with different crate names. - Fix `x test --no-doc`. This is much simpler after the refactors mentioned earlier, but I'm happy to split it into a separate PR if desired. Before, this would panic a lot because steps forgot to pass `--lib`.
bootstrap: Unify test argument handling Fixes rust-lang#104198. Does *not* help with rust-lang#80124 because I couldn't figure out a reasonable way to omit `--lib` only for `panic_abort` and not other `std` dependencies. - Remove unnecessary `test_kind` field and `TestKind` struct. These are just subsets of the existing `builder.kind` / `Kind` struct. - Add a new `run_cargo_test` function which handles passing arguments to cargo based on `builder.config` - Switch all Steps in `mod test` to `run_cargo_test` where possible - Combine several steps into one `CrateBootstrap` step. These tests all do the same thing, just with different crate names. - Fix `x test --no-doc`. This is much simpler after the refactors mentioned earlier, but I'm happy to split it into a separate PR if desired. Before, this would panic a lot because steps forgot to pass `--lib`.
bootstrap: Unify test argument handling Fixes rust-lang#104198. Does *not* help with rust-lang#80124 because I couldn't figure out a reasonable way to omit `--lib` only for `panic_abort` and not other `std` dependencies. - Remove unnecessary `test_kind` field and `TestKind` struct. These are just subsets of the existing `builder.kind` / `Kind` struct. - Add a new `run_cargo_test` function which handles passing arguments to cargo based on `builder.config` - Switch all Steps in `mod test` to `run_cargo_test` where possible - Combine several steps into one `CrateBootstrap` step. These tests all do the same thing, just with different crate names. - Fix `x test --no-doc`. This is much simpler after the refactors mentioned earlier, but I'm happy to split it into a separate PR if desired. Before, this would panic a lot because steps forgot to pass `--lib`.
bootstrap: Unify test argument handling Fixes rust-lang#104198. Does *not* help with rust-lang#80124 because I couldn't figure out a reasonable way to omit `--lib` only for `panic_abort` and not other `std` dependencies. - Remove unnecessary `test_kind` field and `TestKind` struct. These are just subsets of the existing `builder.kind` / `Kind` struct. - Add a new `run_cargo_test` function which handles passing arguments to cargo based on `builder.config` - Switch all Steps in `mod test` to `run_cargo_test` where possible - Combine several steps into one `CrateBootstrap` step. These tests all do the same thing, just with different crate names. - Fix `x test --no-doc`. This is much simpler after the refactors mentioned earlier, but I'm happy to split it into a separate PR if desired. Before, this would panic a lot because steps forgot to pass `--lib`.
bootstrap: Unify test argument handling Fixes rust-lang#104198. Does *not* help with rust-lang#80124 because I couldn't figure out a reasonable way to omit `--lib` only for `panic_abort` and not other `std` dependencies. - Remove unnecessary `test_kind` field and `TestKind` struct. These are just subsets of the existing `builder.kind` / `Kind` struct. - Add a new `run_cargo_test` function which handles passing arguments to cargo based on `builder.config` - Switch all Steps in `mod test` to `run_cargo_test` where possible - Combine several steps into one `CrateBootstrap` step. These tests all do the same thing, just with different crate names. - Fix `x test --no-doc`. This is much simpler after the refactors mentioned earlier, but I'm happy to split it into a separate PR if desired. Before, this would panic a lot because steps forgot to pass `--lib`.
Running
./x.py test --stage 1 --no-doc
on the latest version of nightly (#80114) causes the test suite to crash with the following error:This seems like a bug in the bootstrapper where
--no-doc
causes tests to be erroneously compiled with the abort panic strategy, since tests pass as expected with./x.py test --stage 1
(--no-doc
omitted)This error can be also triggered with a subset of the test suite by running
./x.py test library/panic_abort --stage 1 --no-doc
The text was updated successfully, but these errors were encountered: