From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v3 06/12] scripts/igt_doc.py: re-introduce it by calling test_list.py
Date: Thu, 30 Mar 2023 15:05:12 +0200 [thread overview]
Message-ID: <20230330130518.2731441-7-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20230330130518.2731441-1-mauro.chehab@linux.intel.com>
From: Mauro Carvalho Chehab <mchehab@kernel.org>
Now that the class on a separate file, move the argument parser
to igt_doc.py.
Acked-by: Jari Tahvanainen <jari.tahvanainen@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/igt_doc.py | 80 ++++++++++++++++++++++++++++++++++++++++++++
scripts/test_list.py | 67 -------------------------------------
2 files changed, 80 insertions(+), 67 deletions(-)
create mode 100755 scripts/igt_doc.py
diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
new file mode 100755
index 000000000000..547cb81bce02
--- /dev/null
+++ b/scripts/igt_doc.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python3
+# pylint: disable=C0301
+# SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+## Copyright (C) 2023 Intel Corporation ##
+## Author: Mauro Carvalho Chehab <mchehab@kernel.org> ##
+## ##
+## Allow keeping inlined test documentation and validate ##
+## if the documentation is kept updated. ##
+
+"""Maintain test plan and test implementation documentation on IGT."""
+
+import argparse
+
+from test_list import TestList
+
+IGT_BUILD_PATH = 'build'
+IGT_RUNNER = 'runner/igt_runner'
+
+parser = argparse.ArgumentParser(description = "Print formatted kernel documentation to stdout.",
+ formatter_class = argparse.ArgumentDefaultsHelpFormatter,
+ epilog = 'If no action specified, assume --rest.')
+parser.add_argument("--config", required = True,
+ help="JSON file describing the test plan template")
+parser.add_argument("--rest",
+ help="Output documentation from the source files in REST file.")
+parser.add_argument("--per-test", action="store_true",
+ help="Modifies ReST output to print subtests per test.")
+parser.add_argument("--to-json",
+ help="Output test documentation in JSON format as TO_JSON file")
+parser.add_argument("--show-subtests", action="store_true",
+ help="Shows the name of the documented subtests in alphabetical order.")
+parser.add_argument("--sort-field",
+ help="modify --show-subtests to sort output based on SORT_FIELD value")
+parser.add_argument("--filter-field",
+ help="modify --show-subtests to filter output based a regex given by FILTER_FIELD=~'regex'")
+parser.add_argument("--check-testlist", action="store_true",
+ help="Compare documentation against IGT runner testlist.")
+parser.add_argument("--include-plan", action="store_true",
+ help="Include test plans, if any.")
+parser.add_argument("--igt-build-path",
+ help="Path where the IGT runner is sitting. Used by --check-testlist.",
+ default=IGT_BUILD_PATH)
+parser.add_argument("--gen-testlist",
+ help="Generate documentation at the GEN_TESTLIST directory, using SORT_FIELD to split the tests. Requires --sort-field.")
+parser.add_argument("--igt-runner",
+ help="Path where the IGT runner is sitting. Used by --check-testlist.",
+ default=IGT_RUNNER)
+parser.add_argument('--files', nargs='+',
+ help="File name(s) to be processed")
+
+parse_args = parser.parse_args()
+
+tests = TestList(parse_args.config, parse_args.include_plan, parse_args.files,
+ parse_args.igt_build_path, parse_args.igt_runner)
+
+RUN = 0
+if parse_args.show_subtests:
+ RUN = 1
+ tests.show_subtests(parse_args.sort_field, parse_args.filter_field)
+
+if parse_args.check_testlist:
+ RUN = 1
+ tests.check_tests()
+
+if parse_args.gen_testlist:
+ RUN = 1
+ if not parse_args.sort_field:
+ sys.exit("Need a field to split the testlists")
+ tests.gen_testlist(parse_args.gen_testlist, parse_args.sort_field, parse_args.filter_field)
+
+if parse_args.to_json:
+ RUN = 1
+ tests.print_json(parse_args.to_json)
+
+if not RUN or parse_args.rest:
+ if parse_args.per_test:
+ tests.print_rest_flat(parse_args.rest)
+ else:
+ tests.print_nested_rest(parse_args.rest)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 8eed875b0681..73c1794caec5 100755
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -10,7 +10,6 @@
"""Maintain test plan and test implementation documentation on IGT."""
-import argparse
import glob
import json
import os
@@ -22,9 +21,6 @@ MIN_PYTHON = (3, 6)
if sys.version_info < MIN_PYTHON:
sys.exit("Python %s.%s or later is required.\n" % MIN_PYTHON) # pylint: disable=C0209
-IGT_BUILD_PATH = 'build'
-IGT_RUNNER = 'runner/igt_runner'
-
#
# ancillary functions to sort dictionary hierarchy
#
@@ -1071,66 +1067,3 @@ class TestList:
for sub in test_subtests[test]:
handler.write (f"{sub}\n")
print(f"{fname} created.")
-
-#
-# Main
-#
-
-parser = argparse.ArgumentParser(description = "Print formatted kernel documentation to stdout.",
- formatter_class = argparse.ArgumentDefaultsHelpFormatter,
- epilog = 'If no action specified, assume --rest.')
-parser.add_argument("--config", required = True,
- help="JSON file describing the test plan template")
-parser.add_argument("--rest",
- help="Output documentation from the source files in REST file.")
-parser.add_argument("--per-test", action="store_true",
- help="Modifies ReST output to print subtests per test.")
-parser.add_argument("--to-json",
- help="Output test documentation in JSON format as TO_JSON file")
-parser.add_argument("--show-subtests", action="store_true",
- help="Shows the name of the documented subtests in alphabetical order.")
-parser.add_argument("--sort-field",
- help="modify --show-subtests to sort output based on SORT_FIELD value")
-parser.add_argument("--filter-field",
- help="modify --show-subtests to filter output based a regex given by FILTER_FIELD=~'regex'")
-parser.add_argument("--check-testlist", action="store_true",
- help="Compare documentation against IGT runner testlist.")
-parser.add_argument("--include-plan", action="store_true",
- help="Include test plans, if any.")
-parser.add_argument("--igt-build-path",
- help="Path where the IGT runner is sitting. Used by --check-testlist.",
- default=IGT_BUILD_PATH)
-parser.add_argument("--gen-testlist",
- help="Generate documentation at the GEN_TESTLIST directory, using SORT_FIELD to split the tests. Requires --sort-field.")
-parser.add_argument('--files', nargs='+',
- help="File name(s) to be processed")
-
-parse_args = parser.parse_args()
-
-tests = TestList(parse_args.config, parse_args.include_plan, parse_args.files,
- IGT_BUILD_PATH, IGT_RUNNER)
-
-RUN = 0
-if parse_args.show_subtests:
- RUN = 1
- tests.show_subtests(parse_args.sort_field, parse_args.filter_field)
-
-if parse_args.check_testlist:
- RUN = 1
- tests.check_tests()
-
-if parse_args.gen_testlist:
- RUN = 1
- if not parse_args.sort_field:
- sys.exit("Need a field to split the testlists")
- tests.gen_testlist(parse_args.gen_testlist, parse_args.sort_field, parse_args.filter_field)
-
-if parse_args.to_json:
- RUN = 1
- tests.print_json(parse_args.to_json)
-
-if not RUN or parse_args.rest:
- if parse_args.per_test:
- tests.print_rest_flat(parse_args.rest)
- else:
- tests.print_nested_rest(parse_args.rest)
--
2.39.2
next prev parent reply other threads:[~2023-03-30 13:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 13:05 [igt-dev] [PATCH i-g-t v3 00/12] Improve igt_doc.py Mauro Carvalho Chehab
2023-03-30 13:05 ` [igt-dev] [PATCH i-g-t v3 01/12] xe_test_config.json: do some adjustments at the output hierarchy Mauro Carvalho Chehab
2023-03-30 13:05 ` [igt-dev] [PATCH i-g-t v3 02/12] scripts/igt_doc.py: move show_subtests logic to the class Mauro Carvalho Chehab
2023-03-30 13:05 ` [igt-dev] [PATCH i-g-t v3 03/12] scripts/igt_doc.py: add support to generate testlists Mauro Carvalho Chehab
2023-03-30 13:05 ` [igt-dev] [PATCH i-g-t v3 04/12] scripts/igt_doc.py: prepare to place TestList class on a separate file Mauro Carvalho Chehab
2023-03-30 13:05 ` [igt-dev] [PATCH i-g-t v3 05/12] scripts/test_list.py: prepare to place " Mauro Carvalho Chehab
2023-03-30 13:05 ` Mauro Carvalho Chehab [this message]
2023-03-30 13:05 ` [igt-dev] [PATCH i-g-t v3 07/12] scripts/test_list.py: better handle documentation validation issues Mauro Carvalho Chehab
2023-03-30 13:05 ` [igt-dev] [PATCH i-g-t v3 08/12] scripts/test_list.py: add support for igt_simple_main Mauro Carvalho Chehab
2023-03-30 13:05 ` [igt-dev] [PATCH i-g-t v3 09/12] testplan/meson.build: Validate documentation at build time Mauro Carvalho Chehab
2023-03-30 13:05 ` [igt-dev] [PATCH i-g-t v3 10/12] xe/xe_vm: add documentation for igt@xe_vm@userptr-invalid Mauro Carvalho Chehab
2023-03-30 13:05 ` [igt-dev] [PATCH i-g-t v3 11/12] xe/xe_noexec_ping_pong: document subtest Mauro Carvalho Chehab
2023-03-30 13:05 ` [igt-dev] [PATCH i-g-t v3 12/12] runner/meson.build: fix minimal build Mauro Carvalho Chehab
2023-03-31 13:42 ` Kamil Konieczny
2023-03-30 15:46 ` [igt-dev] ✓ Fi.CI.BAT: success for Improve igt_doc.py (rev3) Patchwork
2023-03-31 11:14 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230330130518.2731441-7-mauro.chehab@linux.intel.com \
--to=mauro.chehab@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox