Skip to content

Commit fd7909a

Browse files
committed
x.py test miri: respect --no-doc / --doc
1 parent 929bcee commit fd7909a

File tree

1 file changed

+14
-2
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+14
-2
lines changed

src/bootstrap/src/core/build_steps/test.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -680,12 +680,22 @@ impl Step for Miri {
680680
.arg("--manifest-path")
681681
.arg(builder.src.join("src/tools/miri/test-cargo-miri/Cargo.toml"));
682682
cargo.arg("--target").arg(target.rustc_target_arg());
683-
cargo.arg("--").args(builder.config.test_args());
684683

685684
// `prepare_tool_cargo` sets RUSTDOC to the bootstrap wrapper and RUSTDOC_REAL to a dummy path as this is a "run", not a "test".
686685
// Also, we want the rustdoc from the "next" stage for the same reason that we build a std from the next stage.
687686
// So let's just set that here, and bypass bootstrap's RUSTDOC (just like cargo-miri already ignores bootstrap's RUSTC_WRAPPER).
688-
cargo.env("RUSTDOC", builder.rustdoc(compiler_std));
687+
if builder.doc_tests != DocTests::No {
688+
cargo.env("RUSTDOC", builder.rustdoc(compiler_std));
689+
}
690+
match builder.doc_tests {
691+
DocTests::Yes => {}
692+
DocTests::No => {
693+
cargo.arg("--tests");
694+
}
695+
DocTests::Only => {
696+
cargo.arg("--doc");
697+
}
698+
}
689699

690700
// Tell `cargo miri` where to find things.
691701
cargo.env("MIRI_SYSROOT", &miri_sysroot);
@@ -694,6 +704,8 @@ impl Step for Miri {
694704
// Debug things.
695705
cargo.env("RUST_BACKTRACE", "1");
696706

707+
// Finally, pass test-args and run everything.
708+
cargo.arg("--").args(builder.config.test_args());
697709
let mut cargo = Command::from(cargo);
698710
{
699711
let _time = helpers::timeit(builder);

0 commit comments

Comments
 (0)