From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 11/18] scripts/igt_doc.py: use a different logic to get IGT prefix
Date: Fri, 10 Mar 2023 09:23:19 +0100 [thread overview]
Message-ID: <20230310082326.12088-12-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20230310082326.12088-1-zbigniew.kempczynski@intel.com>
From: Mauro Carvalho Chehab <mchehab@kernel.org>
The past logic was dependent on how the initial Xe IGT support
was conceived. Change it to be more generic and use
os.path.commonprefix.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/igt_doc.py | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
index 5b08ac1442..f1b6d64615 100755
--- a/scripts/igt_doc.py
+++ b/scripts/igt_doc.py
@@ -235,7 +235,6 @@ class TestList:
def __init__(self, config_fname, include_plan, file_list):
self.doc = {}
self.test_number = 0
- self.min_test_prefix = ''
self.config = None
self.filenames = file_list
self.plan_filenames = []
@@ -494,7 +493,7 @@ class TestList:
for test in self.doc: # pylint: disable=C0206
fname = self.doc[test]["File"]
- name = re.sub(r'.*tests/', '', fname)
+ name = re.sub(r'.*/', '', fname)
name = re.sub(r'\.[\w+]$', '', name)
name = "igt@" + name
@@ -548,7 +547,7 @@ class TestList:
for test in sorted(self.doc.keys()):
fname = self.doc[test]["File"]
- name = re.sub(r'.*tests/', '', fname)
+ name = re.sub(r'.*/', '', fname)
name = re.sub(r'\.[ch]', '', name)
name = "igt@" + name
@@ -720,7 +719,7 @@ class TestList:
for test in sorted(self.doc.keys()):
fname = self.doc[test]["File"]
- test_name = re.sub(r'.*tests/', '', fname)
+ test_name = re.sub(r'.*/', '', fname)
test_name = re.sub(r'\.[ch]', '', test_name)
test_name = "igt@" + test_name
@@ -759,10 +758,12 @@ class TestList:
for i in range(0, len(doc_subtests)): # pylint: disable=C0200
doc_subtests[i] = re.sub(r'\<[^\>]+\>', r'\\d+', doc_subtests[i])
+ test_prefix = os.path.commonprefix(doc_subtests)
+
# Get a list of tests from
try:
result = subprocess.run([ f"{IGT_BUILD_PATH}/{IGT_RUNNER}",
- "-L", "-t", self.min_test_prefix,
+ "-L", "-t", test_prefix,
f"{IGT_BUILD_PATH}/tests"], check = True,
stdout=subprocess.PIPE, universal_newlines=True)
except subprocess.CalledProcessError as sub_err:
@@ -824,14 +825,6 @@ class TestList:
cur_arg = -1
cur_arg_element = 0
- prefix = re.sub(r'.*tests/', '', fname)
- prefix = r'igt\@' + re.sub(r'(.*/).*', r'\1', prefix)
-
- if self.min_test_prefix == '':
- self.min_test_prefix = prefix
- elif len(prefix) < len(self.min_test_prefix):
- self.min_test_prefix = prefix
-
with open(fname, 'r', encoding='utf8') as handle:
arg_ref = None
current_test = ''
--
2.34.1
next prev parent reply other threads:[~2023-03-10 8:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 8:23 [igt-dev] [PATCH i-g-t 00/18] Add igt_doc.py Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 01/18] scripts/igt_doc.py: beautify its code Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 02/18] scripts/igt_doc.py: add JSON file output Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 03/18] scripts/igt_doc.py: dynamically create fields array from a JSON file Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 04/18] scripts/igt_doc.py: add support to specify numeric values Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 05/18] scripts/igt_doc.py: improve --show-subtests logic Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 06/18] scripts/igt_doc.py: add error handler for subprocess Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 07/18] scripts/igt_doc.py: improve multi-line logic Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 08/18] scripts/igt_doc.py: don't use ":=" operator Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 09/18] scripts/igt_doc.py: make it compatible with Python 3.6 Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 10/18] scripts/igt_doc.py: sets the minimal version to run the script Zbigniew Kempczyński
2023-03-10 8:23 ` Zbigniew Kempczyński [this message]
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 12/18] testplan/meson.build: add targets to build Xe test documentation Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 13/18] xe/xe_test_config.json: cleanup the field struct Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 14/18] xe/xe_huc_copy: add GPU dependency to its documentation Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 15/18] xe/xe_*: add TEST/SUBTEST documentation Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 16/18] xe-fast-feedback.testlist: update debugfs tests Zbigniew Kempczyński
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 17/18] xe_mmap: skip VRAM tests if no VRAM is found Zbigniew Kempczyński
2023-03-10 10:52 ` Das, Nirmoy
2023-03-13 6:48 ` Zbigniew Kempczyński
2023-03-14 12:26 ` Das, Nirmoy
2023-03-10 8:23 ` [igt-dev] [PATCH i-g-t 18/18] meson: replace "igt@xe/" by "igt@" Zbigniew Kempczyński
2023-03-10 10:23 ` [igt-dev] ✓ Fi.CI.BAT: success for Add igt_doc.py Patchwork
2023-03-13 1:18 ` [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=20230310082326.12088-12-zbigniew.kempczynski@intel.com \
--to=zbigniew.kempczynski@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