From 2d22003e8ba78c7a326d59198884ae7f9b2f4b50 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 1 Dec 2023 10:25:01 +0200 Subject: tests: generate library docs for share/**/*.yaml in ./check They go into test-outputs/libdocs so they're easy to extract. Signed-off-by: Lars Wirzenius Sponsored-by: author --- check | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/check b/check index d1edc07..12196a5 100755 --- a/check +++ b/check @@ -162,6 +162,21 @@ class Runcmd: **kwargs, ) + def libdocgen(self, bindings, output): + self.cargo( + [ + "run", + "--package=subplot", + "--bin=subplot", + "--", + f"--resources={os.path.abspath('share')}", + "libdocgen", + "--output", + output, + bindings, + ] + ) + def get_templates(self, filename): metadata = self.cargo( [ @@ -358,6 +373,26 @@ def check_tooling(r): ) +def check_doc(r): + docs = os.path.join("test-outputs", "libdocs") + if not os.path.exists(docs): + os.mkdir(docs) + + bindings = [] + for dirname, _, basenames in os.walk("share"): + dirname = dirname[len("share/") :] + bindings += [ + os.path.join(dirname, x) + for x in basenames + if x != "template.yaml" and x.endswith(".yaml") + ] + + for filename in bindings: + md = os.path.splitext(os.path.basename(filename))[0] + ".md" + md = os.path.join(docs, md) + r.libdocgen(filename, md) + + def parse_args(): """Parse command line arguments to this script""" p = argparse.ArgumentParser() @@ -375,7 +410,7 @@ def parse_args(): "--offline", action="store_true", help="only run tests that can be run offline" ) - all_whats = ["tooling", "python", "shell", "rust", "subplots"] + all_whats = ["tooling", "python", "shell", "rust", "subplots", "doc"] p.add_argument( "what", nargs="*", default=all_whats, help=f"what to test: {all_whats}" ) @@ -410,6 +445,8 @@ def main(): check_subplots(r) elif what == "tooling": check_tooling(r) + elif what == "doc": + check_doc(r) else: sys.exit(f"Unknown test {what}") -- cgit v1.2.1