From fd7909aa59a761f8ba5bf34df3d84a6afa4bff1c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 28 Mar 2024 22:46:07 +0100 Subject: [PATCH] x.py test miri: respect --no-doc / --doc --- src/bootstrap/src/core/build_steps/test.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 48596af7ca0..11baf0cda80 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -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). - cargo.env("RUSTDOC", builder.rustdoc(compiler_std)); + 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);