jsondoclint: New Tool

This commit is contained in:
Nixon Enraght-Moony 2022-08-23 14:49:37 +01:00
parent c97922dca5
commit 2506aa0394
10 changed files with 32 additions and 0 deletions

View File

@ -1891,6 +1891,10 @@ dependencies = [
"shlex", "shlex",
] ]
[[package]]
name = "jsondoclint"
version = "0.1.0"
[[package]] [[package]]
name = "jsonpath_lib" name = "jsonpath_lib"
version = "0.2.6" version = "0.2.6"

View File

@ -33,6 +33,7 @@ members = [
"src/tools/unicode-table-generator", "src/tools/unicode-table-generator",
"src/tools/expand-yaml-anchors", "src/tools/expand-yaml-anchors",
"src/tools/jsondocck", "src/tools/jsondocck",
"src/tools/jsondoclint",
"src/tools/html-checker", "src/tools/html-checker",
"src/tools/bump-stage0", "src/tools/bump-stage0",
"src/tools/replace-version-placeholder", "src/tools/replace-version-placeholder",

View File

@ -1341,6 +1341,8 @@ note: if you're sure you want to do this, please open an issue as to why. In the
let json_compiler = compiler.with_stage(0); let json_compiler = compiler.with_stage(0);
cmd.arg("--jsondocck-path") cmd.arg("--jsondocck-path")
.arg(builder.ensure(tool::JsonDocCk { compiler: json_compiler, target })); .arg(builder.ensure(tool::JsonDocCk { compiler: json_compiler, target }));
cmd.arg("--jsondoclint-path")
.arg(builder.ensure(tool::JsonDocLint { compiler: json_compiler, target }));
} }
if mode == "run-make" { if mode == "run-make" {

View File

@ -376,6 +376,7 @@ bootstrap_tool!(
ExpandYamlAnchors, "src/tools/expand-yaml-anchors", "expand-yaml-anchors"; ExpandYamlAnchors, "src/tools/expand-yaml-anchors", "expand-yaml-anchors";
LintDocs, "src/tools/lint-docs", "lint-docs"; LintDocs, "src/tools/lint-docs", "lint-docs";
JsonDocCk, "src/tools/jsondocck", "jsondocck"; JsonDocCk, "src/tools/jsondocck", "jsondocck";
JsonDocLint, "src/tools/jsondoclint", "jsondoclint";
HtmlChecker, "src/tools/html-checker", "html-checker"; HtmlChecker, "src/tools/html-checker", "html-checker";
BumpStage0, "src/tools/bump-stage0", "bump-stage0"; BumpStage0, "src/tools/bump-stage0", "bump-stage0";
ReplaceVersionPlaceholder, "src/tools/replace-version-placeholder", "replace-version-placeholder"; ReplaceVersionPlaceholder, "src/tools/replace-version-placeholder", "replace-version-placeholder";

View File

@ -203,6 +203,9 @@ pub struct Config {
/// The jsondocck executable. /// The jsondocck executable.
pub jsondocck_path: Option<String>, pub jsondocck_path: Option<String>,
/// The jsondoclint executable.
pub jsondoclint_path: Option<String>,
/// The LLVM `FileCheck` binary path. /// The LLVM `FileCheck` binary path.
pub llvm_filecheck: Option<PathBuf>, pub llvm_filecheck: Option<PathBuf>,

View File

@ -64,6 +64,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
.optopt("", "rust-demangler-path", "path to rust-demangler to use in tests", "PATH") .optopt("", "rust-demangler-path", "path to rust-demangler to use in tests", "PATH")
.reqopt("", "python", "path to python to use for doc tests", "PATH") .reqopt("", "python", "path to python to use for doc tests", "PATH")
.optopt("", "jsondocck-path", "path to jsondocck to use for doc tests", "PATH") .optopt("", "jsondocck-path", "path to jsondocck to use for doc tests", "PATH")
.optopt("", "jsondoclint-path", "path to jsondoclint to use for doc tests", "PATH")
.optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM") .optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM")
.optflag("", "force-valgrind", "fail if Valgrind tests cannot be run under Valgrind") .optflag("", "force-valgrind", "fail if Valgrind tests cannot be run under Valgrind")
.optopt("", "run-clang-based-tests-with", "path to Clang executable", "PATH") .optopt("", "run-clang-based-tests-with", "path to Clang executable", "PATH")
@ -226,6 +227,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
rust_demangler_path: matches.opt_str("rust-demangler-path").map(PathBuf::from), rust_demangler_path: matches.opt_str("rust-demangler-path").map(PathBuf::from),
python: matches.opt_str("python").unwrap(), python: matches.opt_str("python").unwrap(),
jsondocck_path: matches.opt_str("jsondocck-path"), jsondocck_path: matches.opt_str("jsondocck-path"),
jsondoclint_path: matches.opt_str("jsondoclint-path"),
valgrind_path: matches.opt_str("valgrind-path"), valgrind_path: matches.opt_str("valgrind-path"),
force_valgrind: matches.opt_present("force-valgrind"), force_valgrind: matches.opt_present("force-valgrind"),
run_clang_based_tests_with: matches.opt_str("run-clang-based-tests-with"), run_clang_based_tests_with: matches.opt_str("run-clang-based-tests-with"),

View File

@ -2572,6 +2572,14 @@ impl<'test> TestCx<'test> {
if !res.status.success() { if !res.status.success() {
self.fatal_proc_rec("check_missing_items failed!", &res); self.fatal_proc_rec("check_missing_items failed!", &res);
} }
let res = self.cmd2procres(
Command::new(self.config.jsondoclint_path.as_ref().unwrap()).arg(&json_out),
);
if !res.status.success() {
self.fatal_proc_rec("jsondoclint failed!", &res);
}
} }
fn get_lines<P: AsRef<Path>>( fn get_lines<P: AsRef<Path>>(

View File

@ -0,0 +1,8 @@
[package]
name = "jsondoclint"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -0,0 +1 @@
fn main() {}

View File

@ -132,6 +132,7 @@ trigger_files = [
"src/etc/htmldocck.py", "src/etc/htmldocck.py",
"src/etc/check_missing_items.py", "src/etc/check_missing_items.py",
"src/tools/jsondocck", "src/tools/jsondocck",
"src/tools/jsondoclint",
"src/tools/rustdoc-gui", "src/tools/rustdoc-gui",
"src/tools/rustdoc-js", "src/tools/rustdoc-js",
"src/tools/rustdoc-themes", "src/tools/rustdoc-themes",
@ -147,6 +148,7 @@ trigger_files = [
"src/rustdoc-json-types", "src/rustdoc-json-types",
"src/test/rustdoc-json", "src/test/rustdoc-json",
"src/tools/jsondocck", "src/tools/jsondocck",
"src/tools/jsondoclint",
] ]
[autolabel."T-compiler"] [autolabel."T-compiler"]