about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2018-12-15 10:17:40 +0100
committerGitHub <noreply@github.com>2018-12-15 10:17:40 +0100
commit1f0a73039bb270767effb88a86c9a93d5f9be7ee (patch)
tree2401a384afc283b550eee73bfede4869aa3a6611
parent1116546e170dcc2951a541ebe38855ae746d8847 (diff)
parentc435357bc9c6b3ed7028dbe2f727c921065d7378 (diff)
downloadrust-1f0a73039bb270767effb88a86c9a93d5f9be7ee.tar.gz
rust-1f0a73039bb270767effb88a86c9a93d5f9be7ee.zip
Rollup merge of #56792 - phansch:add_compiletest_testsuite, r=alexcrichton
Bootstrap: Add testsuite for compiletest tool

This adds a test suite for compiletest so that the tester is tested, too.

The (currently) single unit test of the compiletest tool was never executed
on CI. At least I couldn't find any references of it in the logs.

The compiletest tests can then also be executed with:

    ./x.py test src/tools/compiletest --stage 0

cc #47606
-rw-r--r--src/bootstrap/builder.rs1
-rw-r--r--src/bootstrap/test.rs39
2 files changed, 40 insertions, 0 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 32f3e573d68..c1d56865da5 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -416,6 +416,7 @@ impl<'a> Builder<'a> {
                 test::Rustfmt,
                 test::Miri,
                 test::Clippy,
+                test::CompiletestTest,
                 test::RustdocJS,
                 test::RustdocTheme,
                 // Run bootstrap close to the end as it's unlikely to fail
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index dc061fe5099..87d5737e2a0 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -430,6 +430,45 @@ impl Step for Miri {
 }
 
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct CompiletestTest {
+    stage: u32,
+    host: Interned<String>,
+}
+
+impl Step for CompiletestTest {
+    type Output = ();
+
+    fn should_run(run: ShouldRun) -> ShouldRun {
+        run.path("src/tools/compiletest")
+    }
+
+    fn make_run(run: RunConfig) {
+        run.builder.ensure(CompiletestTest {
+            stage: run.builder.top_stage,
+            host: run.target,
+        });
+    }
+
+    /// Runs `cargo test` for compiletest.
+    fn run(self, builder: &Builder) {
+        let stage = self.stage;
+        let host = self.host;
+        let compiler = builder.compiler(stage, host);
+
+        let mut cargo = tool::prepare_tool_cargo(builder,
+                                                 compiler,
+                                                 Mode::ToolBootstrap,
+                                                 host,
+                                                 "test",
+                                                 "src/tools/compiletest",
+                                                 SourceType::InTree,
+                                                 &[]);
+
+        try_run(builder, &mut cargo);
+    }
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
 pub struct Clippy {
     stage: u32,
     host: Interned<String>,