From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 4/5] scripts/igt_doc.py: pass a single file when checking docs
Date: Tue, 11 Jul 2023 09:12:12 +0200 [thread overview]
Message-ID: <20230711071213.737377-5-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20230711071213.737377-1-mauro.chehab@linux.intel.com>
From: Mauro Carvalho Chehab <mchehab@kernel.org>
Instead of passing a directory with several *.testlist files,
pass intel-ci.testlist, which should contain already everything.
That makes the script a lot more generic, as there won't be any
real dependencies from IGT related to the check logic.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
docs/testplan/meson.build | 2 +-
scripts/igt_doc.py | 6 +++---
scripts/test_list.py | 42 +++++++++++++++++++-------------------
tests/intel-ci/meson.build | 2 +-
4 files changed, 26 insertions(+), 26 deletions(-)
mode change 100755 => 100644 scripts/test_list.py
diff --git a/docs/testplan/meson.build b/docs/testplan/meson.build
index e838f2eb1540..b388a04b20ea 100644
--- a/docs/testplan/meson.build
+++ b/docs/testplan/meson.build
@@ -16,7 +16,7 @@ if build_tests
# Check if documentation matches the actual tests and tests can run
if not meson.is_cross_build()
build_info += 'Will Check if documentation is in sync with testlist'
- check_testlist = [ '--check-testlist', '--igt-build-path', build_root ]
+ check_testlist = [ '--check-testlist', '--built-testlist', built_testlist.full_path() ]
else
warning('WARNING: Will not check if documentation is in sync with testlist')
endif
diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
index 38e2bdee4f2a..c02029e03a31 100755
--- a/scripts/igt_doc.py
+++ b/scripts/igt_doc.py
@@ -38,8 +38,8 @@ parser.add_argument("--check-testlist", action="store_true",
help="Compare documentation against IGT built tests.")
parser.add_argument("--include-plan", action="store_true",
help="Include test plans, if any.")
-parser.add_argument("--igt-build-path",
- help="Path to the IGT build directory. Used by --check-testlist.",
+parser.add_argument("--built-testlist",
+ help="Testlist generated at build time. 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.")
@@ -49,7 +49,7 @@ parser.add_argument('--files', nargs='+',
parse_args = parser.parse_args()
tests = TestList(parse_args.config, parse_args.include_plan, parse_args.files,
- parse_args.igt_build_path)
+ parse_args.built_testlist)
if parse_args.filter_field:
for filter_expr in parse_args.filter_field:
diff --git a/scripts/test_list.py b/scripts/test_list.py
old mode 100755
new mode 100644
index 8dca7fc7c49e..1fd27ef560a7
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -246,7 +246,7 @@ class TestList:
"""
def __init__(self, config_fname, include_plan = False, file_list = False,
- igt_build_path = None,
+ built_testlist = None,
test_tag = "TEST", subtest_tag = "SUBTESTS?",
main_name = "igt", subtest_separator = "@"):
self.doc = {}
@@ -256,7 +256,7 @@ class TestList:
self.plan_filenames = []
self.props = {}
self.config_fname = config_fname
- self.igt_build_path = igt_build_path
+ self.built_testlist = built_testlist
self.level_count = 0
self.field_list = {}
self.title = None
@@ -852,7 +852,7 @@ class TestList:
fname = self.doc[test]["File"]
test_name = re.sub(r'.*/', '', fname)
- test_name = re.sub(r'\.[ch]', '', test_name)
+ test_name = re.sub(r'\.[ch]\s*', '', test_name)
test_name = self.main_name + test_name
subtest_array += self.expand_subtest(fname, test_name, test, True)
@@ -918,29 +918,15 @@ class TestList:
return subtests
- def get_testlist(self):
-
- """ Return a list of tests as reported by --list-subtests """
- tests = []
- for name in self.filenames:
- fname = re.sub(r"\.c$", ".testlist", name.split('/')[-1])
- fname = os.path.join(self.igt_build_path, "tests", fname)
-
- with open(fname, 'r', encoding='utf8') as handle:
- for line in handle:
- tests.append(line.rstrip("\n"))
-
- return sorted(tests)
-
#
# Validation methods
#
def check_tests(self):
- """Compare documented subtests with the IGT test list"""
+ """Compare documented subtests with the test list"""
- if not self.igt_build_path:
- sys.exit("Need the IGT build path")
+ if not self.built_testlist:
+ sys.exit("Need the build path where the exec files are located")
if self.filters:
print("NOTE: test checks are affected by filters")
@@ -957,7 +943,21 @@ class TestList:
doc_subtests = list(sorted(doc_subtests))
# Get a list of tests from
- run_subtests = self.get_testlist()
+ tests = set()
+ for name in self.filenames:
+ test = self.main_name + re.sub(r"\.c$", "", name.split('/')[-1])
+ tests.add(test)
+
+ run_subtests = []
+ with open(self.built_testlist, 'r', encoding='utf8') as handle:
+ for line in handle:
+ name = line.rstrip("\n")
+ if name in tests:
+ run_subtests.append(name)
+ else:
+ result = name.rsplit(self.subtest_separator, 1)[0]
+ if name in tests:
+ run_subtests.append(name)
# Compare arrays
diff --git a/tests/intel-ci/meson.build b/tests/intel-ci/meson.build
index a1ec517f8da1..e984fcb817aa 100644
--- a/tests/intel-ci/meson.build
+++ b/tests/intel-ci/meson.build
@@ -9,7 +9,7 @@ intelci_files = [
'xe.blocklist.txt',
]
-custom_target('intel-ci.testlist',
+built_testlist = custom_target('intel-ci.testlist',
build_by_default : true,
command : ['sort', testlist_files],
install : true,
--
2.40.1
next prev parent reply other threads:[~2023-07-11 7:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 7:12 [igt-dev] [PATCH i-g-t 0/5] Make test_list.py more generic Mauro Carvalho Chehab
2023-07-11 7:12 ` [igt-dev] [PATCH i-g-t 1/5] tests/intel-ci/meson.build: Generate and store an intel-ci.testlist Mauro Carvalho Chehab
2023-07-11 7:12 ` [igt-dev] [PATCH i-g-t 2/5] scripts/test_list.py: make the class more generic Mauro Carvalho Chehab
2023-07-11 7:12 ` [igt-dev] [PATCH i-g-t 3/5] scripts/test_list.py: rename the internal summary value Mauro Carvalho Chehab
2023-07-11 7:12 ` Mauro Carvalho Chehab [this message]
2023-07-11 7:12 ` [igt-dev] [PATCH i-g-t 5/5] scripts/test_list.py: document what BAT stands for Mauro Carvalho Chehab
2023-07-11 9:52 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic 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=20230711071213.737377-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