about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-01-26 00:44:52 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2018-02-08 10:53:09 +0100
commit51580d46f919c1f97d82aeca1ea1086c545c7484 (patch)
tree9c14eccb3366b76e988077a9d12bc1724c612a47 /src/bootstrap
parent63ee1cd846b92eb3a124ec345d4889bdb5bca8e3 (diff)
downloadrust-51580d46f919c1f97d82aeca1ea1086c545c7484.tar.gz
rust-51580d46f919c1f97d82aeca1ea1086c545c7484.zip
Add tests for themes
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs2
-rw-r--r--src/bootstrap/check.rs1
-rw-r--r--src/bootstrap/test.rs42
3 files changed, 43 insertions, 2 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index bf7b1015a49..6c68ee18506 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -258,7 +258,7 @@ impl<'a> Builder<'a> {
                 test::HostCompiletest, test::Crate, test::CrateLibrustc, test::Rustdoc,
                 test::Linkcheck, test::Cargotest, test::Cargo, test::Rls, test::Docs,
                 test::ErrorIndex, test::Distcheck, test::Rustfmt, test::Miri, test::Clippy,
-                test::RustdocJS),
+                test::RustdocJS, test::RustdocTheme),
             Kind::Bench => describe!(test::Crate, test::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 e6871764b2c..ede403491d7 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -160,4 +160,3 @@ pub fn libtest_stamp(build: &Build, compiler: Compiler, target: Interned<String>
 pub fn librustc_stamp(build: &Build, compiler: Compiler, target: Interned<String>) -> PathBuf {
     build.cargo_out(compiler, Mode::Librustc, target).join(".librustc-check.stamp")
 }
-
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index e4c1cdb79fd..1c6cd066ad9 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -425,6 +425,48 @@ fn path_for_cargo(builder: &Builder, compiler: Compiler) -> OsString {
 }
 
 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
+pub struct RustdocTheme {
+    pub compiler: Compiler,
+    pub host: Interned<String>,
+}
+
+impl Step for RustdocTheme {
+    type Output = ();
+    const DEFAULT: bool = true;
+    const ONLY_HOSTS: bool = true;
+
+    fn should_run(run: ShouldRun) -> ShouldRun {
+        run.path("src/tools/rustdoc-themes")
+    }
+
+    fn make_run(run: RunConfig) {
+        let compiler = run.builder.compiler(run.builder.top_stage, run.host);
+
+        run.builder.ensure(RustdocTheme {
+            compiler: compiler,
+            host: run.builder.build.build,
+        });
+    }
+
+    fn run(self, builder: &Builder) {
+        let rustdoc = builder.rustdoc(self.compiler.host);
+        let mut cmd = Command::new(builder.config.python.clone().expect("python not defined"));
+        cmd.args(&["src/tools/rustdoc-themes/test-themes.py", rustdoc.to_str().unwrap()]);
+        cmd.env("RUSTC_STAGE", self.compiler.stage.to_string())
+           .env("RUSTC_SYSROOT", builder.sysroot(self.compiler))
+           .env("RUSTDOC_LIBDIR", builder.sysroot_libdir(self.compiler, self.compiler.host))
+           .env("CFG_RELEASE_CHANNEL", &builder.build.config.channel)
+           .env("RUSTDOC_REAL", builder.rustdoc(self.host))
+           .env("RUSTDOC_CRATE_VERSION", builder.build.rust_version())
+           .env("RUSTC_BOOTSTRAP", "1");
+        if let Some(linker) = builder.build.linker(self.host) {
+            cmd.env("RUSTC_TARGET_LINKER", linker);
+        }
+        builder.run(&mut cmd);
+    }
+}
+
+#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
 pub struct RustdocJS {
     pub host: Interned<String>,
     pub target: Interned<String>,