From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 4/7] scripts/igt_doc.py: add support to specify numeric values
Date: Tue, 21 Feb 2023 09:35:38 +0100 [thread overview]
Message-ID: <20230221083541.1079643-5-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20230221083541.1079643-1-mauro.chehab@linux.intel.com>
From: Mauro Carvalho Chehab <mchehab@kernel.org>
Add a way to specify a set of default values to be used when numeric
wildcards like "%d" are present at the igt subtest.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/igt_doc.py | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
index 3f061a5fcfd3..a1d3a0350499 100755
--- a/scripts/igt_doc.py
+++ b/scripts/igt_doc.py
@@ -126,6 +126,27 @@ class TestList:
* @userptr-misaligned-binds: userptr misaligned
*/
+ It is also possible to define a list of values that will actually be
+ used by the test and no string replacement is needed.
+ This is done by using one or multiple arg[n].values lines:
+
+ /**
+ * SUBTEST: unbind-all-%d-vmas
+ * Description: unbind all with %arg[1] VMAs
+ *
+ * arg[1].values: 2, 8
+ * arg[1].values: 16, 32
+ */
+
+ /**
+ * SUBTEST: unbind-all-%d-vmas
+ * Description: unbind all with %arg[1] VMAs
+ *
+ * arg[1].values: 64, 128
+ */
+
+ Such feature is specially useful for numeric parameters
+
The valid `field` values are defined on a JSON configuration file.
The TEST documents the common fields present on all tests. Typically,
@@ -703,6 +724,21 @@ class TestList:
continue
+ # We don't need a multi-lined version here
+ if (match := re.match(r'arg\[(\d+)\]\.values:\s*(.*)', file_line)):
+ cur_arg = int(match.group(1)) - 1
+
+ if cur_arg not in self.doc[current_test]["arg"][arg_ref]:
+ self.doc[current_test]["arg"][arg_ref][cur_arg] = {}
+
+ values = match.group(2).split(",")
+ for split_val in values:
+ if split_val == "":
+ continue
+ self.doc[current_test]["arg"][arg_ref][cur_arg][split_val.strip()] = split_val.strip()
+
+ continue
+
if (match := re.match(r'^(.*):', file_line)):
sys.exit(f"{fname}:{file_ln + 1}: Error: unrecognized field '%s'. Need to add at %s" %
(match.group(1), self.config_fname))
--
2.39.2
next prev parent reply other threads:[~2023-02-21 8:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 8:35 [igt-dev] [PATCH i-g-t 0/7] Improve scripts/igt_doc.py script Mauro Carvalho Chehab
2023-02-21 8:35 ` [igt-dev] [PATCH i-g-t 1/7] scripts/igt_doc.py: beautify its code Mauro Carvalho Chehab
2023-02-21 8:35 ` [igt-dev] [PATCH i-g-t 2/7] scripts/igt_doc.py: add JSON file output Mauro Carvalho Chehab
2023-02-21 8:35 ` [igt-dev] [PATCH i-g-t 3/7] scripts/igt_doc.py: dynamically create fields array from a JSON file Mauro Carvalho Chehab
2023-02-21 8:35 ` Mauro Carvalho Chehab [this message]
2023-02-21 8:35 ` [igt-dev] [PATCH i-g-t 5/7] scripts/igt_doc.py: add support to produce hierarchical output Mauro Carvalho Chehab
2023-02-21 8:35 ` [igt-dev] [PATCH i-g-t 6/7] scripts/igt_doc.py: improve --show-subtests logic Mauro Carvalho Chehab
2023-02-21 8:35 ` [igt-dev] [PATCH i-g-t 7/7] scripts/igt_doc.py: add error handler for subprocess Mauro Carvalho Chehab
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=20230221083541.1079643-5-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