Add jsondocck tool, and use it for rustdoc JSON
This commit is contained in:
parent
f09fb488f7
commit
7715656edd
25 changed files with 546 additions and 820 deletions
|
|
@ -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>,
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ fn config() -> Config {
|
|||
"--rustc-path=",
|
||||
"--lldb-python=",
|
||||
"--docck-python=",
|
||||
"--jsondocck-path=",
|
||||
"--src-base=",
|
||||
"--build-base=",
|
||||
"--stage-id=stage2",
|
||||
|
|
|
|||
|
|
@ -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"),
|
||||
|
|
|
|||
|
|
@ -2487,31 +2487,31 @@ impl<'test> TestCx<'test> {
|
|||
}
|
||||
|
||||
let root = self.config.find_rust_src_root().unwrap();
|
||||
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.jsondocck_path)
|
||||
.arg("--doc-dir")
|
||||
.arg(root.join(&out_dir))
|
||||
.arg("--template")
|
||||
.arg(&self.testpaths.file),
|
||||
);
|
||||
|
||||
if !res.status.success() {
|
||||
self.fatal_proc_rec("jsondocck failed!", &res)
|
||||
}
|
||||
|
||||
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(root.join("src/etc/check_missing_items.py"))
|
||||
.arg(&json_out),
|
||||
);
|
||||
|
||||
if !res.status.success() {
|
||||
self.fatal_proc_rec("check_missing_items failed!", &res);
|
||||
}
|
||||
|
||||
let mut expected = self.testpaths.file.clone();
|
||||
expected.set_extension("expected");
|
||||
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()),
|
||||
);
|
||||
|
||||
if !res.status.success() {
|
||||
self.fatal_proc_rec("compare failed!", &res);
|
||||
}
|
||||
}
|
||||
|
||||
fn get_lines<P: AsRef<Path>>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue