about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-09-10 01:24:14 +0000
committerbors <bors@rust-lang.org>2017-09-10 01:24:14 +0000
commitf982ff05db1faedb5080100f9982ca084781a9f2 (patch)
tree565f4d06819525ce91b9bfe14e20064c4b01310e /src/bootstrap
parentddd123ed9a35ec76103d42cecf322ee8d2896bf9 (diff)
parentf87696b26883057302aea8509456990733ecd4b7 (diff)
downloadrust-f982ff05db1faedb5080100f9982ca084781a9f2.tar.gz
rust-f982ff05db1faedb5080100f9982ca084781a9f2.zip
Auto merge of #44274 - Mark-Simulacrum:rustdoc-tests, r=alexcrichton
Test rustdoc.

Also fixes the broken tests.

r? @alexcrichton
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs6
-rw-r--r--src/bootstrap/check.rs69
2 files changed, 71 insertions, 4 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 722b3d16e9d..4765546b184 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -251,9 +251,9 @@ impl<'a> Builder<'a> {
                 tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc, tool::Clippy,
                 native::Llvm),
             Kind::Test => describe!(check::Tidy, check::Bootstrap, check::DefaultCompiletest,
-                check::HostCompiletest, check::Crate, check::CrateLibrustc, check::Linkcheck,
-                check::Cargotest, check::Cargo, check::Rls, check::Docs, check::ErrorIndex,
-                check::Distcheck),
+                check::HostCompiletest, check::Crate, check::CrateLibrustc, check::Rustdoc,
+                check::Linkcheck, check::Cargotest, check::Cargo, check::Rls, check::Docs,
+                check::ErrorIndex, check::Distcheck),
             Kind::Bench => describe!(check::Crate, check::CrateLibrustc),
             Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook,
                 doc::Standalone, doc::Std, doc::Test, doc::Rustc, doc::ErrorIndex, doc::Nomicon,
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 92fb2105b7c..0d5c3addd9e 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -900,7 +900,6 @@ impl Step for CrateLibrustc {
     }
 }
 
-
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
 pub struct Crate {
     compiler: Compiler,
@@ -1080,6 +1079,74 @@ impl Step for Crate {
     }
 }
 
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct Rustdoc {
+    host: Interned<String>,
+    test_kind: TestKind,
+}
+
+impl Step for Rustdoc {
+    type Output = ();
+    const DEFAULT: bool = true;
+    const ONLY_HOSTS: bool = true;
+
+    fn should_run(run: ShouldRun) -> ShouldRun {
+        run.path("src/librustdoc").path("src/tools/rustdoc")
+    }
+
+    fn make_run(run: RunConfig) {
+        let builder = run.builder;
+
+        let test_kind = if builder.kind == Kind::Test {
+            TestKind::Test
+        } else if builder.kind == Kind::Bench {
+            TestKind::Bench
+        } else {
+            panic!("unexpected builder.kind in crate: {:?}", builder.kind);
+        };
+
+        builder.ensure(Rustdoc {
+            host: run.host,
+            test_kind,
+        });
+    }
+
+    fn run(self, builder: &Builder) {
+        let build = builder.build;
+        let test_kind = self.test_kind;
+
+        let compiler = builder.compiler(builder.top_stage, self.host);
+        let target = compiler.host;
+
+        builder.ensure(RemoteCopyLibs { compiler, target });
+
+        let mut cargo = builder.cargo(compiler, Mode::Librustc, target, test_kind.subcommand());
+        compile::rustc_cargo(build, &compiler, target, &mut cargo);
+        let _folder = build.fold_output(|| {
+            format!("{}_stage{}-rustdoc", test_kind.subcommand(), compiler.stage)
+        });
+        println!("{} rustdoc stage{} ({} -> {})", test_kind, compiler.stage,
+                &compiler.host, target);
+
+        if test_kind.subcommand() == "test" && !build.fail_fast {
+            cargo.arg("--no-fail-fast");
+        }
+
+        cargo.arg("-p").arg("rustdoc:0.0.0");
+
+        cargo.arg("--");
+        cargo.args(&build.config.cmd.test_args());
+
+        if build.config.quiet_tests {
+            cargo.arg("--quiet");
+        }
+
+        let _time = util::timeit();
+
+        try_run(build, &mut cargo);
+    }
+}
+
 fn envify(s: &str) -> String {
     s.chars().map(|c| {
         match c {