about summary refs log tree commit diff
path: root/src/bootstrap/test.rs
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/test.rs
parent63ee1cd846b92eb3a124ec345d4889bdb5bca8e3 (diff)
downloadrust-51580d46f919c1f97d82aeca1ea1086c545c7484.tar.gz
rust-51580d46f919c1f97d82aeca1ea1086c545c7484.zip
Add tests for themes
Diffstat (limited to 'src/bootstrap/test.rs')
-rw-r--r--src/bootstrap/test.rs42
1 files changed, 42 insertions, 0 deletions
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>,