about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorNixon Enraght-Moony <nixon.emoony@gmail.com>2022-11-26 15:32:49 +0000
committerNixon Enraght-Moony <nixon.emoony@gmail.com>2022-11-26 15:32:49 +0000
commit4b2a1eb775d7a9ff37b5b4dc990c287f427c2c80 (patch)
tree8435cdb3a1335982c1d416c3b6cc2317ad9685d6 /src/bootstrap
parent8681d4cffcd23bbe619984ab62772a91827a40dc (diff)
downloadrust-4b2a1eb775d7a9ff37b5b4dc990c287f427c2c80.tar.gz
rust-4b2a1eb775d7a9ff37b5b4dc990c287f427c2c80.zip
Support unit tests for jsondoclint
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/builder.rs1
-rw-r--r--src/bootstrap/test.rs36
2 files changed, 37 insertions, 0 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 251431a15eb..cff5fd8c5b0 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -644,6 +644,7 @@ impl<'a> Builder<'a> {
                 test::CrateLibrustc,
                 test::CrateRustdoc,
                 test::CrateRustdocJsonTypes,
+                test::CrateJsonDocLint,
                 test::Linkcheck,
                 test::TierCheck,
                 test::ReplacePlaceholderTest,
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index a69979d7f07..39cedfdac5f 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -91,6 +91,42 @@ fn try_run_quiet(builder: &Builder<'_>, cmd: &mut Command) -> bool {
 }
 
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+pub struct CrateJsonDocLint {
+    host: TargetSelection,
+}
+
+impl Step for CrateJsonDocLint {
+    type Output = ();
+    const ONLY_HOSTS: bool = true;
+    const DEFAULT: bool = true;
+
+    fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
+        run.path("src/tools/jsondoclint")
+    }
+
+    fn make_run(run: RunConfig<'_>) {
+        run.builder.ensure(CrateJsonDocLint { host: run.target });
+    }
+
+    fn run(self, builder: &Builder<'_>) {
+        let bootstrap_host = builder.config.build;
+        let compiler = builder.compiler(0, bootstrap_host);
+
+        let cargo = tool::prepare_tool_cargo(
+            builder,
+            compiler,
+            Mode::ToolBootstrap,
+            bootstrap_host,
+            "test",
+            "src/tools/jsondoclint",
+            SourceType::InTree,
+            &[],
+        );
+        try_run(builder, &mut cargo.into());
+    }
+}
+
+#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
 pub struct Linkcheck {
     host: TargetSelection,
 }