about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-09-05 14:59:32 +0000
committerbors <bors@rust-lang.org>2020-09-05 14:59:32 +0000
commit7d289aeade481c03d42e7f6d31bc6b64a73cfa45 (patch)
tree1c73e6113a1a479b514949d9db2ff538f3661357 /src/bootstrap
parent81a769f261047afd8e31cc488b173b0ab5ac4205 (diff)
parent85cee57fd791d670d92dc61e0ad71594128dd45a (diff)
downloadrust-7d289aeade481c03d42e7f6d31bc6b64a73cfa45.tar.gz
rust-7d289aeade481c03d42e7f6d31bc6b64a73cfa45.zip
Auto merge of #76376 - Dylan-DPC:rollup-8chsbw9, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #75695 (Add a regression test for issue-72793)
 - #75741 (Refactor byteorder to std in rustc_middle)
 - #75954 (Unstable Book: add links to tracking issues for FFI features)
 - #75994 (`impl Rc::new_cyclic`)
 - #76060 (Link vec doc to & reference)
 - #76078 (Remove disambiguators from intra doc link text)
 - #76082 (Fix intra-doc links on pub re-exports)
 - #76254 (Fold length constant in Rvalue::Repeat)
 - #76258 (x.py check checks tests/examples/benches)
 - #76263 (inliner: Check for codegen fn attributes compatibility)
 - #76285 (Move jointness censoring to proc_macro)

Failed merges:

r? @ghost
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs2
-rw-r--r--src/bootstrap/check.rs65
2 files changed, 63 insertions, 4 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index cecc9ef75ea..4708b207156 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -382,7 +382,7 @@ impl<'a> Builder<'a> {
                 native::Lld
             ),
             Kind::Check | Kind::Clippy | Kind::Fix | Kind::Format => {
-                describe!(check::Std, check::Rustc, check::Rustdoc, check::Clippy)
+                describe!(check::Std, check::Rustc, check::Rustdoc, check::Clippy, check::Bootstrap)
             }
             Kind::Test => describe!(
                 crate::toolstate::ToolStateCheck,
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 9f34bb4e6cc..ead0bd0413b 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -66,6 +66,43 @@ impl Step for Std {
         let libdir = builder.sysroot_libdir(compiler, target);
         let hostdir = builder.sysroot_libdir(compiler, compiler.host);
         add_to_sysroot(&builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target));
+
+        // Then run cargo again, once we've put the rmeta files for the library
+        // crates into the sysroot. This is needed because e.g., core's tests
+        // depend on `libtest` -- Cargo presumes it will exist, but it doesn't
+        // since we initialize with an empty sysroot.
+        //
+        // Currently only the "libtest" tree of crates does this.
+
+        let mut cargo = builder.cargo(
+            compiler,
+            Mode::Std,
+            SourceType::InTree,
+            target,
+            cargo_subcommand(builder.kind),
+        );
+        std_cargo(builder, target, compiler.stage, &mut cargo);
+        cargo.arg("--all-targets");
+
+        // Explicitly pass -p for all dependencies krates -- this will force cargo
+        // to also check the tests/benches/examples for these crates, rather
+        // than just the leaf crate.
+        for krate in builder.in_tree_crates("test") {
+            cargo.arg("-p").arg(krate.name);
+        }
+
+        builder.info(&format!(
+            "Checking std test/bench/example targets ({} -> {})",
+            &compiler.host, target
+        ));
+        run_cargo(
+            builder,
+            cargo,
+            args(builder.kind),
+            &libstd_test_stamp(builder, compiler, target),
+            vec![],
+            true,
+        );
     }
 }
 
@@ -106,6 +143,14 @@ impl Step for Rustc {
             cargo_subcommand(builder.kind),
         );
         rustc_cargo(builder, &mut cargo, target);
+        cargo.arg("--all-targets");
+
+        // Explicitly pass -p for all compiler krates -- this will force cargo
+        // to also check the tests/benches/examples for these crates, rather
+        // than just the leaf crate.
+        for krate in builder.in_tree_crates("rustc-main") {
+            cargo.arg("-p").arg(krate.name);
+        }
 
         builder.info(&format!("Checking compiler artifacts ({} -> {})", &compiler.host, target));
         run_cargo(
@@ -149,7 +194,7 @@ macro_rules! tool_check_step {
 
                 builder.ensure(Rustc { target });
 
-                let cargo = prepare_tool_cargo(
+                let mut cargo = prepare_tool_cargo(
                     builder,
                     compiler,
                     Mode::ToolRustc,
@@ -160,12 +205,14 @@ macro_rules! tool_check_step {
                     &[],
                 );
 
-                println!(
+                cargo.arg("--all-targets");
+
+                builder.info(&format!(
                     "Checking {} artifacts ({} -> {})",
                     stringify!($name).to_lowercase(),
                     &compiler.host.triple,
                     target.triple
-                );
+                ));
                 run_cargo(
                     builder,
                     cargo,
@@ -202,12 +249,24 @@ tool_check_step!(Rustdoc, "src/tools/rustdoc", SourceType::InTree);
 // rejected.
 tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree);
 
+tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree);
+
 /// Cargo's output path for the standard library in a given stage, compiled
 /// by a particular compiler for the specified target.
 fn libstd_stamp(builder: &Builder<'_>, compiler: Compiler, target: TargetSelection) -> PathBuf {
     builder.cargo_out(compiler, Mode::Std, target).join(".libstd-check.stamp")
 }
 
+/// Cargo's output path for the standard library in a given stage, compiled
+/// by a particular compiler for the specified target.
+fn libstd_test_stamp(
+    builder: &Builder<'_>,
+    compiler: Compiler,
+    target: TargetSelection,
+) -> PathBuf {
+    builder.cargo_out(compiler, Mode::Std, target).join(".libstd-check-test.stamp")
+}
+
 /// Cargo's output path for librustc in a given stage, compiled by a particular
 /// compiler for the specified target.
 fn librustc_stamp(builder: &Builder<'_>, compiler: Compiler, target: TargetSelection) -> PathBuf {