summaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-12-01 10:25:01 +0200
committerLars Wirzenius <liw@liw.fi>2023-12-01 11:48:09 +0200
commit2d22003e8ba78c7a326d59198884ae7f9b2f4b50 (patch)
treee211eb725f227503e8477b9cc82615a4bfa2b7f3 /check
parent0ca88baf56a6621524028bd821e35b82f17be460 (diff)
downloadsubplot-2d22003e8ba78c7a326d59198884ae7f9b2f4b50.tar.gz
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 <liw@liw.fi> Sponsored-by: author
Diffstat (limited to 'check')
-rwxr-xr-xcheck39
1 files changed, 38 insertions, 1 deletions
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}")