about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2020-08-11 16:49:39 -0700
committerEric Huss <eric@huss.org>2020-08-12 08:40:22 -0700
commitce717476ffc2d7ca1bc737942e778b8e0e813e05 (patch)
treee8e521ef93db4b518d1d77c0fac4d8e38b285259 /src/bootstrap
parent392116e021f786b81dd12faec189a7d199dcd999 (diff)
Add a script to verify the Platform Support page is up-to-date.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs1
-rw-r--r--src/bootstrap/test.rs44
2 files changed, 45 insertions, 0 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index e13a5f24653..4b0905bd6c1 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -404,6 +404,7 @@ impl<'a> Builder<'a> {
                 test::CrateLibrustc,
                 test::CrateRustdoc,
                 test::Linkcheck,
+                test::TierCheck,
                 test::Cargotest,
                 test::Cargo,
                 test::Rls,
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index bb5b9296c0a..11e2564305f 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -2043,3 +2043,47 @@ impl Step for Bootstrap {
         run.builder.ensure(Bootstrap);
     }
 }
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct TierCheck {
+    pub compiler: Compiler,
+    target: TargetSelection,
+}
+
+impl Step for TierCheck {
+    type Output = ();
+    const DEFAULT: bool = true;
+    const ONLY_HOSTS: bool = true;
+
+    fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
+        run.path("src/tools/tier-check")
+    }
+
+    fn make_run(run: RunConfig<'_>) {
+        let compiler = run.builder.compiler_for(run.builder.top_stage, run.host, run.host);
+        run.builder.ensure(TierCheck { compiler, target: run.host });
+    }
+
+    /// Tests the Platform Support page in the rustc book.
+    fn run(self, builder: &Builder<'_>) {
+        builder.ensure(compile::Std { compiler: self.compiler, target: self.target });
+        let mut cargo = tool::prepare_tool_cargo(
+            builder,
+            self.compiler,
+            Mode::ToolRustc,
+            self.target,
+            "run",
+            "src/tools/tier-check",
+            SourceType::InTree,
+            &[],
+        );
+        cargo.arg(builder.src.join("src/doc/rustc/src/platform-support.md"));
+        cargo.arg(&builder.rustc(self.compiler));
+        if builder.is_verbose() {
+            cargo.arg("--verbose");
+        }
+
+        builder.info("platform support check");
+        try_run(builder, &mut cargo.into());
+    }
+}