x.py test miri: respect --no-doc / --doc

This commit is contained in:
Ralf Jung 2024-03-28 22:46:07 +01:00
parent 929bceeaf8
commit fd7909aa59

View File

@ -680,12 +680,22 @@ fn run(self, builder: &Builder<'_>) {
.arg("--manifest-path")
.arg(builder.src.join("src/tools/miri/test-cargo-miri/Cargo.toml"));
cargo.arg("--target").arg(target.rustc_target_arg());
cargo.arg("--").args(builder.config.test_args());
// `prepare_tool_cargo` sets RUSTDOC to the bootstrap wrapper and RUSTDOC_REAL to a dummy path as this is a "run", not a "test".
// Also, we want the rustdoc from the "next" stage for the same reason that we build a std from the next stage.
// So let's just set that here, and bypass bootstrap's RUSTDOC (just like cargo-miri already ignores bootstrap's RUSTC_WRAPPER).
if builder.doc_tests != DocTests::No {
cargo.env("RUSTDOC", builder.rustdoc(compiler_std));
}
match builder.doc_tests {
DocTests::Yes => {}
DocTests::No => {
cargo.arg("--tests");
}
DocTests::Only => {
cargo.arg("--doc");
}
}
// Tell `cargo miri` where to find things.
cargo.env("MIRI_SYSROOT", &miri_sysroot);
@ -694,6 +704,8 @@ fn run(self, builder: &Builder<'_>) {
// Debug things.
cargo.env("RUST_BACKTRACE", "1");
// Finally, pass test-args and run everything.
cargo.arg("--").args(builder.config.test_args());
let mut cargo = Command::from(cargo);
{
let _time = helpers::timeit(builder);