summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorRune Tynan <runetynan@gmail.com>2021-01-15 20:34:15 -0500
committerRune Tynan <runetynan@gmail.com>2021-01-19 14:24:25 -0500
commit7715656edd201b8c6bbddf0040f424c27e4db4df (patch)
treea3c2f7b0835fd4f3728d85755df926566ee29f36 /src/tools/compiletest
parentf09fb488f70c5965ec4f64453a6e681fbfcff56c (diff)
downloadrust-7715656edd201b8c6bbddf0040f424c27e4db4df.tar.gz
rust-7715656edd201b8c6bbddf0040f424c27e4db4df.zip
Add jsondocck tool, and use it for rustdoc JSON
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/common.rs3
-rw-r--r--src/tools/compiletest/src/header/tests.rs1
-rw-r--r--src/tools/compiletest/src/main.rs3
-rw-r--r--src/tools/compiletest/src/runtest.rs22
4 files changed, 18 insertions, 11 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 43dbaeb4655..4cefb562b13 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -198,6 +198,9 @@ pub struct Config {
     /// The Python executable to use for htmldocck.
     pub docck_python: String,
 
+    /// The jsondocck executable.
+    pub jsondocck_path: String,
+
     /// The LLVM `FileCheck` binary path.
     pub llvm_filecheck: Option<PathBuf>,
 
diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs
index 4bcbd89f095..ec99fde0df9 100644
--- a/src/tools/compiletest/src/header/tests.rs
+++ b/src/tools/compiletest/src/header/tests.rs
@@ -45,6 +45,7 @@ fn config() -> Config {
         "--rustc-path=",
         "--lldb-python=",
         "--docck-python=",
+        "--jsondocck-path=",
         "--src-base=",
         "--build-base=",
         "--stage-id=stage2",
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index aefcfe222e5..03a443c8bff 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -60,6 +60,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
         .optopt("", "rust-demangler-path", "path to rust-demangler to use in tests", "PATH")
         .reqopt("", "lldb-python", "path to python to use for doc tests", "PATH")
         .reqopt("", "docck-python", "path to python to use for doc tests", "PATH")
+        .reqopt("", "jsondocck-path", "path to jsondocck to use for doc tests", "PATH")
         .optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM")
         .optflag("", "force-valgrind", "fail if Valgrind tests cannot be run under Valgrind")
         .optopt("", "run-clang-based-tests-with", "path to Clang executable", "PATH")
@@ -196,6 +197,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
     let has_tidy = Command::new("tidy")
         .arg("--version")
         .stdout(Stdio::null())
+        .stderr(Stdio::null())
         .status()
         .map_or(false, |status| status.success());
     Config {
@@ -207,6 +209,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
         rust_demangler_path: matches.opt_str("rust-demangler-path").map(PathBuf::from),
         lldb_python: matches.opt_str("lldb-python").unwrap(),
         docck_python: matches.opt_str("docck-python").unwrap(),
+        jsondocck_path: matches.opt_str("jsondocck-path").unwrap(),
         valgrind_path: matches.opt_str("valgrind-path"),
         force_valgrind: matches.opt_present("force-valgrind"),
         run_clang_based_tests_with: matches.opt_str("run-clang-based-tests-with"),
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 9f31b3ae1b1..b15a563a930 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2490,27 +2490,27 @@ impl<'test> TestCx<'test> {
         let mut json_out = out_dir.join(self.testpaths.file.file_stem().unwrap());
         json_out.set_extension("json");
         let res = self.cmd2procres(
-            Command::new(&self.config.docck_python)
-                .arg(root.join("src/test/rustdoc-json/check_missing_items.py"))
-                .arg(&json_out),
+            Command::new(&self.config.jsondocck_path)
+                .arg("--doc-dir")
+                .arg(root.join(&out_dir))
+                .arg("--template")
+                .arg(&self.testpaths.file),
         );
 
         if !res.status.success() {
-            self.fatal_proc_rec("check_missing_items failed!", &res);
+            self.fatal_proc_rec("jsondocck failed!", &res)
         }
 
-        let mut expected = self.testpaths.file.clone();
-        expected.set_extension("expected");
+        let mut json_out = out_dir.join(self.testpaths.file.file_stem().unwrap());
+        json_out.set_extension("json");
         let res = self.cmd2procres(
             Command::new(&self.config.docck_python)
-                .arg(root.join("src/test/rustdoc-json/compare.py"))
-                .arg(&expected)
-                .arg(&json_out)
-                .arg(&expected.parent().unwrap()),
+                .arg(root.join("src/etc/check_missing_items.py"))
+                .arg(&json_out),
         );
 
         if !res.status.success() {
-            self.fatal_proc_rec("compare failed!", &res);
+            self.fatal_proc_rec("check_missing_items failed!", &res);
         }
     }