]> git.lizzy.rs Git - rust.git/commitdiff
Bootstrap: Add testsuite for compiletest tool
authorPhilipp Hansch <dev@phansch.net>
Thu, 13 Dec 2018 20:57:23 +0000 (21:57 +0100)
committerPhilipp Hansch <dev@phansch.net>
Fri, 14 Dec 2018 20:42:49 +0000 (21:42 +0100)
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. This adds a test suite for compiletest so that our tester is
tested, too.

The compiletest tests can then also be executed with:

    ./x.py test src/tools/compiletest

src/bootstrap/builder.rs
src/bootstrap/test.rs

index 32f3e573d6845bdf597e9b9e32ba88083e9c3fb7..c1d56865da55ceada06595b80834d42ebc827e5b 100644 (file)
@@ -416,6 +416,7 @@ macro_rules! describe {
                 test::Rustfmt,
                 test::Miri,
                 test::Clippy,
+                test::CompiletestTest,
                 test::RustdocJS,
                 test::RustdocTheme,
                 // Run bootstrap close to the end as it's unlikely to fail
index dc061fe5099a590a8cb38ec3a3352c84c3d6faeb..87d5737e2a0a2202ad89adf38a826442d7e30b74 100644 (file)
@@ -429,6 +429,45 @@ fn run(self, builder: &Builder) {
     }
 }
 
+#[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,