* [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic
@ 2023-07-12 13:58 Mauro Carvalho Chehab
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 01/13] tests/intel-ci/meson.build: Generate and store an intel-ci.testlist Mauro Carvalho Chehab
` (15 more replies)
0 siblings, 16 replies; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
While most of the code at test_list.py is generic, it contains a
couple of IGT-specific stuff on it.
I'm planning to make it more generic, as we also need to document
in-kernel tests (KUnit).
So, let's remove what's specific to IGT to the main logic. This
way, the same code can be sent to the Linux Kernel upstream,
to be used to document kunit and kselftests there.
Mauro Carvalho Chehab (13):
tests/intel-ci/meson.build: Generate and store an intel-ci.testlist
scripts/test_list.py: make the class more generic
scripts/test_list.py: rename the internal summary value
scripts/igt_doc.py: pass a single file when checking docs
scripts/test_list.py: document what BAT stands for
scripts/test_list.py: close config file before start processing
scripts/test_list.py: don't rely on file name to parse config
scripts/test_list.py: allow passing a config dict directly
scripts/igt_doc.py: use field names when create a TestList instance
scripts/test_list.py: add a check before deleting properties
scripts/test_list.py: filename arguments for print_ methods are
optional
scripts/test_list.py: skip some internal fields
scripts/test_list.py: add support to return a string instead of print
docs/testplan/meson.build | 2 +-
scripts/igt_doc.py | 10 +-
scripts/test_list.py | 363 ++++++++++++++++++++-----------------
tests/intel-ci/meson.build | 8 +
4 files changed, 212 insertions(+), 171 deletions(-)
mode change 100755 => 100644 scripts/test_list.py
--
2.40.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 01/13] tests/intel-ci/meson.build: Generate and store an intel-ci.testlist
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 17:22 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 02/13] scripts/test_list.py: make the class more generic Mauro Carvalho Chehab
` (14 subsequent siblings)
15 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
Store a sorted testlist with tests that could be used to test the
DRM core and the Intel drivers in a format that it would be
expected by igt_runner.
This is a preparation to simplify test_list.py checks to make it
more generic.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
tests/intel-ci/meson.build | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/intel-ci/meson.build b/tests/intel-ci/meson.build
index d5a6e4f47203..a1ec517f8da1 100644
--- a/tests/intel-ci/meson.build
+++ b/tests/intel-ci/meson.build
@@ -9,4 +9,12 @@ intelci_files = [
'xe.blocklist.txt',
]
+custom_target('intel-ci.testlist',
+ build_by_default : true,
+ command : ['sort', testlist_files],
+ install : true,
+ install_dir : datadir,
+ capture : true,
+ output : 'intel-ci.testlist')
+
install_data(sources : intelci_files, install_dir : datadir)
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 02/13] scripts/test_list.py: make the class more generic
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 01/13] tests/intel-ci/meson.build: Generate and store an intel-ci.testlist Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 17:29 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 03/13] scripts/test_list.py: rename the internal summary value Mauro Carvalho Chehab
` (13 subsequent siblings)
15 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
Currently, the class is meant to be used only on IGT. However, it
could also be used on other projects. It actually makes sense to
port it to the Kernel, in order to document KUnit and Kselftests.
Make the class more generic by allowing the constructor to pass
three additional arguments:
- The tag name for the test group ("TEST");
- The tag name for the subtest group ("SUBTEST");
- the prefix name for the tests;
- the separator between testa and subtests.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/test_list.py | 43 ++++++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 4f580fb3de58..18fdd619211a 100755
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -101,8 +101,8 @@ class TestList:
"""
Parse and handle test lists with test/subtest documentation, in the
- form of C comments, with two meta-tags (TEST and SUBTEST), and a set of
- `field: value` items:
+ form of C comments, with two meta-tags (by default, TEST and SUBTEST),
+ and a set of `field: value` items:
/**
* TEST: Check if new IGT test documentation logic functionality is working
@@ -246,7 +246,9 @@ class TestList:
"""
def __init__(self, config_fname, include_plan = False, file_list = False,
- igt_build_path = None):
+ igt_build_path = None,
+ test_tag = "TEST", subtest_tag = "SUBTESTS?",
+ main_name = "igt", subtest_separator = "@"):
self.doc = {}
self.test_number = 0
self.config = None
@@ -259,6 +261,11 @@ class TestList:
self.field_list = {}
self.title = None
self.filters = {}
+ self.subtest_separator = subtest_separator
+ self.main_name = main_name
+
+ if self.main_name:
+ self.main_name += subtest_separator
driver_name = re.sub(r'(.*/)?([^\/]+)/.*', r'\2', config_fname).capitalize()
@@ -355,11 +362,13 @@ class TestList:
if fname == '':
continue
- self.__add_file_documentation(fname, implemented_class, field_re)
+ self.__add_file_documentation(fname, implemented_class, field_re,
+ test_tag, subtest_tag)
if include_plan:
for fname in self.plan_filenames:
- self.__add_file_documentation(fname, planned_class, field_re)
+ self.__add_file_documentation(fname, planned_class, field_re,
+ test_tag, subtest_tag)
#
# ancillary methods
@@ -421,7 +430,7 @@ class TestList:
for subtest in self.doc[test]["subtest"].keys():
summary = test_name
if self.doc[test]["subtest"][subtest]["Summary"] != '':
- summary += '@' + self.doc[test]["subtest"][subtest]["Summary"]
+ summary += self.subtest_separator + self.doc[test]["subtest"][subtest]["Summary"]
if not summary:
continue
@@ -551,7 +560,7 @@ class TestList:
name = re.sub(r'.*/', '', fname)
name = re.sub(r'\.[\w+]$', '', name)
- name = "igt@" + name
+ name = self.main_name + name
if not subtest_only:
test_dict[name] = {}
@@ -606,7 +615,7 @@ class TestList:
name = re.sub(r'.*/', '', fname)
name = re.sub(r'\.[ch]', '', name)
- name = "igt@" + name
+ name = self.main_name + name
tmp_subtest = self.expand_subtest(fname, name, test, False)
@@ -844,7 +853,7 @@ class TestList:
test_name = re.sub(r'.*/', '', fname)
test_name = re.sub(r'\.[ch]', '', test_name)
- test_name = "igt@" + test_name
+ test_name = self.main_name + test_name
subtest_array += self.expand_subtest(fname, test_name, test, True)
@@ -941,8 +950,8 @@ class TestList:
args_regex = re.compile(r'\<[^\>]+\>')
for subtest in self.get_subtests()[""]:
- subtest = "@".join(subtest.split("@")[:3])
- subtest = args_regex.sub(r'\\d+', subtest)
+ subtest = self.subtest_separator.join(subtest.split(self.subtest_separator)[:3])
+ subtest = re.sub(r'\<[^\>]+\>', r'\\d+', subtest)
doc_subtests.add(subtest)
doc_subtests = list(sorted(doc_subtests))
@@ -993,7 +1002,8 @@ class TestList:
# File handling methods
#
- def __add_file_documentation(self, fname, implemented_class, field_re):
+ def __add_file_documentation(self, fname, implemented_class, field_re,
+ test_tag, subtest_tag):
"""Adds the contents of test/subtest documentation form a file"""
@@ -1007,6 +1017,9 @@ class TestList:
cur_arg_element = 0
has_test_or_subtest = 0
+ test_regex = re.compile(test_tag + r':\s*(.*)')
+ subtest_regex = re.compile('^' + subtest_tag + r':\s*(.*)')
+
with open(fname, 'r', encoding='utf8') as handle:
arg_ref = None
current_test = ''
@@ -1041,7 +1054,7 @@ class TestList:
current_field = ''
# Check if it is a new TEST section
- match = re.match(r'^TEST:\s*(.*)', file_line)
+ match = test_regex.match(file_line)
if match:
has_test_or_subtest = 1
current_test = self.test_number
@@ -1063,7 +1076,7 @@ class TestList:
continue
# Check if it is a new SUBTEST section
- match = re.match(r'^SUBTESTS?:\s*(.*)', file_line)
+ match = subtest_regex.match(file_line)
if match:
has_test_or_subtest = 1
current_subtest = subtest_number
@@ -1228,7 +1241,7 @@ class TestList:
"""Generate testlists from the test documentation"""
test_prefix = os.path.commonprefix(self.get_subtests()[""])
- test_prefix = re.sub(r'^igt@', '', test_prefix)
+ test_prefix = re.sub(r'^' + self.main_name, '', test_prefix)
# NOTE: currently, it uses a comma for multi-value delimitter
test_subtests = self.get_subtests(sort_field, ",", with_order = True)
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 03/13] scripts/test_list.py: rename the internal summary value
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 01/13] tests/intel-ci/meson.build: Generate and store an intel-ci.testlist Mauro Carvalho Chehab
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 02/13] scripts/test_list.py: make the class more generic Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 17:31 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 04/13] scripts/igt_doc.py: pass a single file when checking docs Mauro Carvalho Chehab
` (12 subsequent siblings)
15 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
The sumary is used internally. So, it is not meant to be used as
a normal field. To avoid possible clashes in the future, rename
the internal usage to _summary_, as we're using _foo_ for internal
properties.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/test_list.py | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 18fdd619211a..8dca7fc7c49e 100755
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -429,8 +429,8 @@ class TestList:
for subtest in self.doc[test]["subtest"].keys():
summary = test_name
- if self.doc[test]["subtest"][subtest]["Summary"] != '':
- summary += self.subtest_separator + self.doc[test]["subtest"][subtest]["Summary"]
+ if self.doc[test]["subtest"][subtest]["_summary_"] != '':
+ summary += self.subtest_separator + self.doc[test]["subtest"][subtest]["_summary_"]
if not summary:
continue
@@ -441,10 +441,10 @@ class TestList:
if num_vars == 0:
subtest_dict = {}
- subtest_dict["Summary"] = summary
+ subtest_dict["_summary_"] = summary
for k in sorted(self.doc[test]["subtest"][subtest].keys()):
- if k in [ 'Summary', 'arg', 'subtest_line' ]:
+ if k in [ '_summary_', 'arg', 'subtest_line' ]:
continue
if not allow_inherit:
@@ -510,10 +510,10 @@ class TestList:
# Store the element
subtest_dict = {}
- subtest_dict["Summary"] = arg_summary
+ subtest_dict["_summary_"] = arg_summary
for field in sorted(self.doc[test]["subtest"][subtest].keys()):
- if field in [ 'Summary', 'arg', 'subtest_line' ]:
+ if field in [ '_summary_', 'arg', 'subtest_line' ]:
continue
sub_field = self.doc[test]["subtest"][subtest][field]
@@ -581,11 +581,11 @@ class TestList:
if self.__filter_subtest(self.doc[test], subtest, True):
continue
- summary = subtest["Summary"]
+ summary = subtest["_summary_"]
dic[summary] = {}
for field in sorted(subtest.keys()):
- if field in [ 'Summary', 'arg', 'subtest_line' ]:
+ if field in [ '_summary_', 'arg', 'subtest_line' ]:
continue
dic[summary][field] = subtest[field]
@@ -646,12 +646,12 @@ class TestList:
for subtest in subtest_array:
print()
- print(subtest["Summary"])
- print(len(subtest["Summary"]) * '=')
+ print(subtest["_summary_"])
+ print(len(subtest["_summary_"]) * '=')
print("")
for field in sorted(subtest.keys()):
- if field in [ 'Summary', 'arg', 'subtest_line' ]:
+ if field in [ '_summary_', 'arg', 'subtest_line' ]:
continue
print(f":{field}:", subtest[field])
@@ -857,7 +857,7 @@ class TestList:
subtest_array += self.expand_subtest(fname, test_name, test, True)
- subtest_array.sort(key = lambda x : x.get('Summary'))
+ subtest_array.sort(key = lambda x : x.get('_summary_'))
for subtest in subtest_array:
if self.__filter_subtest(self.doc[test], subtest, True):
@@ -873,27 +873,27 @@ class TestList:
if test_elem not in subtests:
subtests[test_elem] = []
if order:
- subtests[test_elem].append((subtest["Summary"], test_list))
+ subtests[test_elem].append((subtest["_summary_"], test_list))
else:
- subtests[test_elem].append(subtest["Summary"])
+ subtests[test_elem].append(subtest["_summary_"])
else:
if subtest[sort_field] not in subtests:
subtests[subtest[sort_field]] = []
if order:
- subtests[test_elem].append((subtest["Summary"], [subtest[sort_field]]))
+ subtests[test_elem].append((subtest["_summary_"], [subtest[sort_field]]))
else:
- subtests[subtest[sort_field]].append(subtest["Summary"])
+ subtests[subtest[sort_field]].append(subtest["_summary_"])
else:
if order:
- subtests[test_elem].append((subtest["Summary"], [subtest[sort_field]]))
+ subtests[test_elem].append((subtest["_summary_"], [subtest[sort_field]]))
else:
- subtests[""].append(subtest["Summary"])
+ subtests[""].append(subtest["_summary_"])
else:
if order:
- subtests[test_elem].append((subtest["Summary"], [subtest[sort_field]]))
+ subtests[test_elem].append((subtest["_summary_"], [subtest[sort_field]]))
else:
- subtests[""].append(subtest["Summary"])
+ subtests[""].append(subtest["_summary_"])
if order:
for group, tests in subtests.items():
@@ -1064,7 +1064,7 @@ class TestList:
self.doc[current_test] = {}
self.doc[current_test]["arg"] = {}
- self.doc[current_test]["Summary"] = match.group(1)
+ self.doc[current_test]["_summary_"] = match.group(1)
self.doc[current_test]["File"] = fname
self.doc[current_test]["subtest"] = {}
self.doc[current_test]["subtest_line"] = {}
@@ -1102,7 +1102,7 @@ class TestList:
continue
self.doc[current_test]["subtest"][current_subtest][field] = self.doc[current_test][field]
- self.doc[current_test]["subtest"][current_subtest]["Summary"] = match.group(1)
+ self.doc[current_test]["subtest"][current_subtest]["_summary_"] = match.group(1)
self.doc[current_test]["subtest"][current_subtest]["Description"] = ''
self.doc[current_test]["subtest_line"][current_subtest] = file_ln
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 04/13] scripts/igt_doc.py: pass a single file when checking docs
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (2 preceding siblings ...)
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 03/13] scripts/test_list.py: rename the internal summary value Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 05/13] scripts/test_list.py: document what BAT stands for Mauro Carvalho Chehab
` (11 subsequent siblings)
15 siblings, 0 replies; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
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
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 05/13] scripts/test_list.py: document what BAT stands for
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (3 preceding siblings ...)
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 04/13] scripts/igt_doc.py: pass a single file when checking docs Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 18:30 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 06/13] scripts/test_list.py: close config file before start processing Mauro Carvalho Chehab
` (10 subsequent siblings)
15 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
BAT means Basic Accetance Test, which is a set of tests that
are meant to test basic functionalities and provide a fast
feedback. Add some documentation where the term is present
at the code.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/test_list.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 1fd27ef560a7..0452be8d7994 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -1256,7 +1256,7 @@ class TestList:
testlist = test.lower()
if testlist == "":
fname = "other"
- elif testlist == "bat":
+ elif testlist == "bat": # Basic Acceptance Test
fname = "fast-feedback"
else:
fname = testlist
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 06/13] scripts/test_list.py: close config file before start processing
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (4 preceding siblings ...)
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 05/13] scripts/test_list.py: document what BAT stands for Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 18:38 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 07/13] scripts/test_list.py: don't rely on file name to parse config Mauro Carvalho Chehab
` (9 subsequent siblings)
15 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
Reduce the identation level of the code which parses the config
file, as this can be done after closing the file.
This is a preparation for the next patch that will offer a different
way to pass the configuration.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/test_list.py | 114 +++++++++++++++++++++----------------------
1 file changed, 57 insertions(+), 57 deletions(-)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 0452be8d7994..cfcf6712bdc0 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -274,71 +274,71 @@ class TestList:
with open(config_fname, 'r', encoding='utf8') as handle:
self.config = json.load(handle)
- self.__add_field(None, 0, 0, self.config["fields"])
+ self.__add_field(None, 0, 0, self.config["fields"])
- sublevel_count = [ 0 ] * self.level_count
+ sublevel_count = [ 0 ] * self.level_count
- for field, item in self.props.items():
- if "sublevel" in item["_properties_"]:
- level = item["_properties_"]["level"]
- sublevel = item["_properties_"]["sublevel"]
- if sublevel > sublevel_count[level - 1]:
- sublevel_count[level - 1] = sublevel
+ for field, item in self.props.items():
+ if "sublevel" in item["_properties_"]:
+ level = item["_properties_"]["level"]
+ sublevel = item["_properties_"]["sublevel"]
+ if sublevel > sublevel_count[level - 1]:
+ sublevel_count[level - 1] = sublevel
- field_lc = field.lower()
- self.field_list[field_lc] = field
- field_plural = _plural(field_lc)
- if field_lc != field_plural:
- self.field_list[field_plural] = field
+ field_lc = field.lower()
+ self.field_list[field_lc] = field
+ field_plural = _plural(field_lc)
+ if field_lc != field_plural:
+ self.field_list[field_plural] = field
- if include_plan:
- self.props["Class"] = {}
- self.props["Class"]["_properties_"] = {}
- self.props["Class"]["_properties_"]["level"] = 1
- self.props["Class"]["_properties_"]["sublevel"] = sublevel_count[0] + 1
+ if include_plan:
+ self.props["Class"] = {}
+ self.props["Class"]["_properties_"] = {}
+ self.props["Class"]["_properties_"]["level"] = 1
+ self.props["Class"]["_properties_"]["sublevel"] = sublevel_count[0] + 1
- # Remove non-multilevel items, as we're only interested on
- # hierarchical item levels here
- for field, item in self.props.items():
- if "sublevel" in item["_properties_"]:
- level = item["_properties_"]["level"]
- if sublevel_count[level - 1] == 1:
- del item["_properties_"]["level"]
- del item["_properties_"]["sublevel"]
- del self.props["_properties_"]
+ # Remove non-multilevel items, as we're only interested on
+ # hierarchical item levels here
+ for field, item in self.props.items():
+ if "sublevel" in item["_properties_"]:
+ level = item["_properties_"]["level"]
+ if sublevel_count[level - 1] == 1:
+ del item["_properties_"]["level"]
+ del item["_properties_"]["sublevel"]
+ del self.props["_properties_"]
- has_implemented = False
- if not self.filenames:
- self.filenames = []
- exclude_files = []
- files = self.config["files"]
- exclude_file_glob = self.config.get("exclude_files", [])
- for cfg_file in exclude_file_glob:
- cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
- for fname in glob.glob(cfg_file):
- exclude_files.append(fname)
+ has_implemented = False
+ if not self.filenames:
+ self.filenames = []
+ exclude_files = []
+ files = self.config["files"]
+ exclude_file_glob = self.config.get("exclude_files", [])
+ for cfg_file in exclude_file_glob:
+ cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
+ for fname in glob.glob(cfg_file):
+ exclude_files.append(fname)
- for cfg_file in files:
- cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
- for fname in glob.glob(cfg_file):
- if fname in exclude_files:
- continue
- self.filenames.append(fname)
- has_implemented = True
- else:
- for cfg_file in self.filenames:
- if cfg_file:
- has_implemented = True
+ for cfg_file in files:
+ cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
+ for fname in glob.glob(cfg_file):
+ if fname in exclude_files:
+ continue
+ self.filenames.append(fname)
+ has_implemented = True
+ else:
+ for cfg_file in self.filenames:
+ if cfg_file:
+ has_implemented = True
- has_planned = False
- if include_plan and "planning_files" in self.config:
- implemented_class = "Implemented"
- files = self.config["planning_files"]
- for cfg_file in files:
- cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
- for fname in glob.glob(cfg_file):
- self.plan_filenames.append(fname)
- has_planned = True
+ has_planned = False
+ if include_plan and "planning_files" in self.config:
+ implemented_class = "Implemented"
+ files = self.config["planning_files"]
+ for cfg_file in files:
+ cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
+ for fname in glob.glob(cfg_file):
+ self.plan_filenames.append(fname)
+ has_planned = True
planned_class = None
if has_implemented:
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 07/13] scripts/test_list.py: don't rely on file name to parse config
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (5 preceding siblings ...)
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 06/13] scripts/test_list.py: close config file before start processing Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 18:42 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 08/13] scripts/test_list.py: allow passing a config dict directly Mauro Carvalho Chehab
` (8 subsequent siblings)
15 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
Currently, config_fname should not be empty, as the class init
will fail. Make the logic more generic to prepare to optionally pass
the configuration dict directly.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/test_list.py | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index cfcf6712bdc0..5da471617268 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -255,7 +255,6 @@ class TestList:
self.filenames = file_list
self.plan_filenames = []
self.props = {}
- self.config_fname = config_fname
self.built_testlist = built_testlist
self.level_count = 0
self.field_list = {}
@@ -274,6 +273,9 @@ class TestList:
with open(config_fname, 'r', encoding='utf8') as handle:
self.config = json.load(handle)
+ config_origin = config_fname
+ cfg_path = os.path.realpath(os.path.dirname(config_fname)) + "/"
+
self.__add_field(None, 0, 0, self.config["fields"])
sublevel_count = [ 0 ] * self.level_count
@@ -314,12 +316,12 @@ class TestList:
files = self.config["files"]
exclude_file_glob = self.config.get("exclude_files", [])
for cfg_file in exclude_file_glob:
- cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
+ cfg_file = cfg_path + cfg_file
for fname in glob.glob(cfg_file):
exclude_files.append(fname)
for cfg_file in files:
- cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
+ cfg_file = cfg_path + cfg_file
for fname in glob.glob(cfg_file):
if fname in exclude_files:
continue
@@ -335,7 +337,7 @@ class TestList:
implemented_class = "Implemented"
files = self.config["planning_files"]
for cfg_file in files:
- cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
+ cfg_file = cfg_path + cfg_file
for fname in glob.glob(cfg_file):
self.plan_filenames.append(fname)
has_planned = True
@@ -363,12 +365,12 @@ class TestList:
continue
self.__add_file_documentation(fname, implemented_class, field_re,
- test_tag, subtest_tag)
+ test_tag, subtest_tag, config_origin)
if include_plan:
for fname in self.plan_filenames:
self.__add_file_documentation(fname, planned_class, field_re,
- test_tag, subtest_tag)
+ test_tag, subtest_tag, config_origin)
#
# ancillary methods
@@ -1003,7 +1005,7 @@ class TestList:
#
def __add_file_documentation(self, fname, implemented_class, field_re,
- test_tag, subtest_tag):
+ test_tag, subtest_tag, config_origin):
"""Adds the contents of test/subtest documentation form a file"""
@@ -1215,7 +1217,7 @@ class TestList:
file_line.rstrip(r"\n")
sys.exit(f"{fname}:{file_ln + 1}: Error: unrecognized line. Need to add field at %s?\n\t==> %s" %
- (self.config_fname, file_line))
+ (config_origin, file_line))
def show_subtests(self, sort_field):
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 08/13] scripts/test_list.py: allow passing a config dict directly
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (6 preceding siblings ...)
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 07/13] scripts/test_list.py: don't rely on file name to parse config Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 18:45 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 09/13] scripts/igt_doc.py: use field names when create a TestList instance Mauro Carvalho Chehab
` (7 subsequent siblings)
15 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
Make the logic more generic by allowing to pass a config dict
directly.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/test_list.py | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 5da471617268..9861306bd777 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -245,8 +245,10 @@ class TestList:
Description: test ioctls
"""
- def __init__(self, config_fname, include_plan = False, file_list = False,
+ def __init__(self, config_fname = None,
+ include_plan = False, file_list = None,
built_testlist = None,
+ config_dict = None, sources_path = None,
test_tag = "TEST", subtest_tag = "SUBTESTS?",
main_name = "igt", subtest_separator = "@"):
self.doc = {}
@@ -263,18 +265,34 @@ class TestList:
self.subtest_separator = subtest_separator
self.main_name = main_name
+ # Exclusive or: either one is needed
+ if bool(config_fname) == bool(config_dict):
+ sys.exit("Error: either config filename or config dict shall be used")
+
if self.main_name:
self.main_name += subtest_separator
- driver_name = re.sub(r'(.*/)?([^\/]+)/.*', r'\2', config_fname).capitalize()
-
implemented_class = None
- with open(config_fname, 'r', encoding='utf8') as handle:
- self.config = json.load(handle)
+ if config_fname:
+ with open(config_fname, 'r', encoding='utf8') as handle:
+ self.config = json.load(handle)
- config_origin = config_fname
- cfg_path = os.path.realpath(os.path.dirname(config_fname)) + "/"
+ config_origin = config_fname
+ cfg_path = os.path.realpath(os.path.dirname(config_fname)) + "/"
+ driver_name = re.sub(r'(.*/)?([^\/]+)/.*', r'\2', config_fname).capitalize()
+
+ else:
+ self.config = config_dict
+ config_origin = "config dict"
+ cfg_path = "./"
+ driver_name = main_name
+
+ if sources_path:
+ cfg_path = os.path.realpath(sources_path) + "/"
+
+ if not self.config:
+ sys.exit("Error: configuration is empty!")
self.__add_field(None, 0, 0, self.config["fields"])
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 09/13] scripts/igt_doc.py: use field names when create a TestList instance
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (7 preceding siblings ...)
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 08/13] scripts/test_list.py: allow passing a config dict directly Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 18:50 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 10/13] scripts/test_list.py: add a check before deleting properties Mauro Carvalho Chehab
` (6 subsequent siblings)
15 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
Makes the caller more generic by explicitly passing the field
name when calling TestList. This allows updating the class and
eventually re-ordering fields without the need of changes on
igt_doc.py.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/igt_doc.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
index c02029e03a31..4f4c5c755c44 100755
--- a/scripts/igt_doc.py
+++ b/scripts/igt_doc.py
@@ -48,8 +48,10 @@ parser.add_argument('--files', nargs='+',
parse_args = parser.parse_args()
-tests = TestList(parse_args.config, parse_args.include_plan, parse_args.files,
- parse_args.built_testlist)
+tests = TestList(config_fname = parse_args.config,
+ include_plan = parse_args.include_plan,
+ file_list = parse_args.files,
+ built_testlist = parse_args.built_testlist)
if parse_args.filter_field:
for filter_expr in parse_args.filter_field:
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 10/13] scripts/test_list.py: add a check before deleting properties
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (8 preceding siblings ...)
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 09/13] scripts/igt_doc.py: use field names when create a TestList instance Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 18:52 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 11/13] scripts/test_list.py: filename arguments for print_ methods are optional Mauro Carvalho Chehab
` (5 subsequent siblings)
15 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
If the config file doesn't have empty _properties_, the current
logic causes an error. Well, if one is passing a dictionary via
config_dict, it may end using a simplified dict without any
_properties_ on it.
Add an extra check to avoid an error.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/test_list.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 9861306bd777..6e3cab206e82 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -325,7 +325,8 @@ class TestList:
if sublevel_count[level - 1] == 1:
del item["_properties_"]["level"]
del item["_properties_"]["sublevel"]
- del self.props["_properties_"]
+ if "_properties_" in self.props:
+ del self.props["_properties_"]
has_implemented = False
if not self.filenames:
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 11/13] scripts/test_list.py: filename arguments for print_ methods are optional
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (9 preceding siblings ...)
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 10/13] scripts/test_list.py: add a check before deleting properties Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 18:55 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 12/13] scripts/test_list.py: skip some internal fields Mauro Carvalho Chehab
` (4 subsequent siblings)
15 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
Add a default to those, as the code doesn't need any arguments.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/test_list.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 6e3cab206e82..1551bc92c010 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -616,7 +616,7 @@ class TestList:
# Output methods
#
- def print_rest_flat(self, filename):
+ def print_rest_flat(self, filename = None):
"""Print tests and subtests ordered by tests"""
@@ -728,7 +728,7 @@ class TestList:
sheet[row].append('')
return sheet
- def print_nested_rest(self, filename):
+ def print_nested_rest(self, filename = None):
"""Print tests and subtests ordered by tests"""
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 12/13] scripts/test_list.py: skip some internal fields
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (10 preceding siblings ...)
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 11/13] scripts/test_list.py: filename arguments for print_ methods are optional Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 19:12 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 13/13] scripts/test_list.py: add support to return a string instead of print Mauro Carvalho Chehab
` (3 subsequent siblings)
15 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
both subtest_line and _summary_ are used internally at the script
logic. They shouldn't be part of the output.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/test_list.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 1551bc92c010..11aed63cb67a 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -661,6 +661,10 @@ class TestList:
continue
if field == "arg":
continue
+ if field == "_summary_":
+ continue
+ if field == "subtest_line":
+ continue
print(f":{field}: {self.doc[test][field]}")
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] [PATCH i-g-t v2 13/13] scripts/test_list.py: add support to return a string instead of print
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (11 preceding siblings ...)
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 12/13] scripts/test_list.py: skip some internal fields Mauro Carvalho Chehab
@ 2023-07-12 13:58 ` Mauro Carvalho Chehab
2023-07-12 14:44 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic Patchwork
` (2 subsequent siblings)
15 siblings, 0 replies; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-12 13:58 UTC (permalink / raw)
To: igt-dev
From: Mauro Carvalho Chehab <mchehab@kernel.org>
Sometimes, we don't want to print a testlist, but instead to return
it for post-processing. One such example is to add a Sphinx extension
to parse it and place the results on some existing ReST file.
Add support for it.
A side effect is that we don't need to redirect capture anymore to
to store the output on a file.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/test_list.py | 79 ++++++++++++++++++++------------------------
1 file changed, 36 insertions(+), 43 deletions(-)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 11aed63cb67a..402c69e93180 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -616,20 +616,13 @@ class TestList:
# Output methods
#
- def print_rest_flat(self, filename = None):
+ def print_rest_flat(self, filename = None, return_string = False):
"""Print tests and subtests ordered by tests"""
- handler = None
- if filename:
- original_stdout = sys.stdout
- handler = open(filename, "w", encoding='utf8') # pylint: disable=R1732
- sys.stdout = handler
-
- print("=" * len(self.title))
- print(self.title)
- print("=" * len(self.title))
- print()
+ out = "=" * len(self.title) + "\n"
+ out += self.title + "\n"
+ out += "=" * len(self.title) + "\n\n"
for test in sorted(self.doc.keys()):
fname = self.doc[test]["File"]
@@ -651,10 +644,9 @@ class TestList:
if not subtest_array:
continue
- print(len(name) * '=')
- print(name)
- print(len(name) * '=')
- print()
+ out += len(name) * '=' + "\n"
+ out += name + "\n"
+ out += len(name) * '=' + "\n\n"
for field in sorted(self.doc[test].keys()):
if field == "subtest":
@@ -666,29 +658,30 @@ class TestList:
if field == "subtest_line":
continue
- print(f":{field}: {self.doc[test][field]}")
+ out += f":{field}: {self.doc[test][field]}\n"
for subtest in subtest_array:
- print()
- print(subtest["_summary_"])
- print(len(subtest["_summary_"]) * '=')
- print("")
+ out += "\n" + subtest["_summary_"] + "\n"
+ out += len(subtest["_summary_"]) * '=' + "\n\n"
for field in sorted(subtest.keys()):
if field in [ '_summary_', 'arg', 'subtest_line' ]:
continue
- print(f":{field}:", subtest[field])
+ out += f":{field}:" + subtest[field] + "\n"
- print()
+ out += "\n"
- print()
- print()
+ out += "\n\n"
- if handler:
- handler.close()
- sys.stdout = original_stdout
+ if filename:
+ with open(filename, "w", encoding='utf8') as handle:
+ handle.write(out)
+ elif not return_string:
+ print(out)
+ else:
+ return out
def get_spreadsheet(self):
@@ -732,7 +725,7 @@ class TestList:
sheet[row].append('')
return sheet
- def print_nested_rest(self, filename = None):
+ def print_nested_rest(self, filename = None, return_string = False):
"""Print tests and subtests ordered by tests"""
@@ -742,10 +735,9 @@ class TestList:
handler = open(filename, "w", encoding='utf8') # pylint: disable=R1732
sys.stdout = handler
- print("=" * len(self.title))
- print(self.title)
- print("=" * len(self.title))
- print()
+ out = "=" * len(self.title) + "\n"
+ out += self.title + "\n"
+ out += "=" * len(self.title) + "\n\n"
# Identify the sort order for the fields
fields_order = []
@@ -789,14 +781,11 @@ class TestList:
title_str = fields_order[i] + ": " + fields[fields_order[i]]
- print(title_str)
- print(level_markers[marker] * len(title_str))
- print()
+ out += title_str + "\n"
+ out += level_markers[marker] * len(title_str) + "\n\n"
marker += 1
- print()
- print("``" + subtest + "``")
- print()
+ out += "\n``" + subtest + "``" + "\n\n"
# print non-hierarchy fields
for field in fields_order:
@@ -804,7 +793,7 @@ class TestList:
continue
if field in fields:
- print(f":{field}: {fields[field]}")
+ out += f":{field}: {fields[field]}" + "\n"
# Store current values
for i in range(cur_level, len(fields_order)):
@@ -816,11 +805,15 @@ class TestList:
else:
old_fields[i] = ''
- print()
+ out += "\n"
- if handler:
- handler.close()
- sys.stdout = original_stdout
+ if filename:
+ with open(filename, "w", encoding='utf8') as handle:
+ handle.write(out)
+ elif not return_string:
+ print(out)
+ else:
+ return out
def print_json(self, out_fname):
--
2.40.1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (12 preceding siblings ...)
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 13/13] scripts/test_list.py: add support to return a string instead of print Mauro Carvalho Chehab
@ 2023-07-12 14:44 ` Patchwork
2023-07-13 9:12 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic (rev2) Patchwork
2023-07-13 11:32 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic (rev3) Patchwork
15 siblings, 0 replies; 31+ messages in thread
From: Patchwork @ 2023-07-12 14:44 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: igt-dev
== Series Details ==
Series: Make test_list.py more generic
URL : https://patchwork.freedesktop.org/series/120622/
State : failure
== Summary ==
IGT patchset build failed on latest successful build
1016723d49ff0ce3326af31468245f7b56930cc4 lib/intel_batchbuffer: Inform about unsupported bpp
Installing tools/i915-perf/i915-perf-recorder to /opt/igt/bin
Installing tools/i915-perf/i915-perf-control to /opt/igt/bin
Installing tools/i915-perf/i915-perf-reader to /opt/igt/bin
Installing runner/igt_runner to /opt/igt/bin
Installing runner/igt_resume to /opt/igt/bin
Installing runner/igt_results to /opt/igt/bin
Installing runner/igt_comms_decoder to /opt/igt/bin
Installing assembler/intel-gen4asm to /opt/igt/bin
Installing assembler/intel-gen4disasm to /opt/igt/bin
Installing overlay/intel-gpu-overlay to /opt/igt/bin
Installing man/intel_audio_dump.1.gz to /opt/igt/share/man/man1
Installing man/intel_bios_dumper.1.gz to /opt/igt/share/man/man1
Installing man/intel_error_decode.1.gz to /opt/igt/share/man/man1
Installing man/intel_gpu_frequency.1.gz to /opt/igt/share/man/man1
Installing man/intel_gpu_top.1.gz to /opt/igt/share/man/man1
Installing man/intel_gtt.1.gz to /opt/igt/share/man/man1
Installing man/intel_infoframes.1.gz to /opt/igt/share/man/man1
Installing man/intel_lid.1.gz to /opt/igt/share/man/man1
Installing man/intel_panel_fitter.1.gz to /opt/igt/share/man/man1
Installing man/intel_reg.1.gz to /opt/igt/share/man/man1
Installing man/intel_stepping.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_large.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_large_gtt.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_large_map.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_small.1.gz to /opt/igt/share/man/man1
Installing man/intel_vbt_decode.1.gz to /opt/igt/share/man/man1
Installing /usr/src/igt-gpu-tools/lib/igt_list.h to /opt/igt/include/i915-perf
Installing /usr/src/igt-gpu-tools/lib/intel_chipset.h to /opt/igt/include/i915-perf
Installing /usr/src/igt-gpu-tools/lib/i915/perf.h to /opt/igt/include/i915-perf
Installing /usr/src/igt-gpu-tools/lib/i915/perf_data.h to /opt/igt/include/i915-perf
Installing /usr/src/igt-gpu-tools/lib/i915/perf_data_reader.h to /opt/igt/include/i915-perf
Installing /opt/igt/build/lib/i915-perf.pc to /opt/igt/lib/x86_64-linux-gnu/pkgconfig
Installing /usr/src/igt-gpu-tools/tests/1080p-left.png to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/1080p-right.png to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/pass.png to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/fast-feedback.testlist to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/meta.testlist to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/README to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/blacklist.txt to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/blacklist-pre-merge.txt to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/xe-fast-feedback.testlist to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/xe.blocklist.txt to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tools/intel_gpu_abrt to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/tools/intel-gfx-fw-info to /opt/igt/bin
Installing /opt/igt/build/assembler/intel-gen4asm.pc to /opt/igt/lib/x86_64-linux-gnu/pkgconfig
Installing /usr/src/igt-gpu-tools/scripts/code_cov_capture to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/scripts/code_cov_gather_on_build to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/scripts/code_cov_gather_on_test to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/scripts/code_cov_gen_report to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/scripts/code_cov_parse_info to /opt/igt/bin
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 01/13] tests/intel-ci/meson.build: Generate and store an intel-ci.testlist
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 01/13] tests/intel-ci/meson.build: Generate and store an intel-ci.testlist Mauro Carvalho Chehab
@ 2023-07-12 17:22 ` Kamil Konieczny
0 siblings, 0 replies; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-12 17:22 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: igt-dev
Hi Mauro,
On 2023-07-12 at 15:58:42 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> Store a sorted testlist with tests that could be used to test the
> DRM core and the Intel drivers in a format that it would be
> expected by igt_runner.
>
> This is a preparation to simplify test_list.py checks to make it
> more generic.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> ---
> tests/intel-ci/meson.build | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/tests/intel-ci/meson.build b/tests/intel-ci/meson.build
> index d5a6e4f47203..a1ec517f8da1 100644
> --- a/tests/intel-ci/meson.build
> +++ b/tests/intel-ci/meson.build
> @@ -9,4 +9,12 @@ intelci_files = [
> 'xe.blocklist.txt',
> ]
>
> +custom_target('intel-ci.testlist',
> + build_by_default : true,
> + command : ['sort', testlist_files],
> + install : true,
> + install_dir : datadir,
> + capture : true,
> + output : 'intel-ci.testlist')
> +
> install_data(sources : intelci_files, install_dir : datadir)
This looks ok, you can add my r-b, but please fix compilation error
(from local run, GitLab report is strange):
[305/310] Generating docs/testplan/xe_tests.rst with a custom command
FAILED: docs/testplan/xe_tests.rst
/home/kamil/ramdisk/tmp-build/scripts/igt_doc.py --config /home/kamil/ramdisk/tmp-build/tests/xe/xe_test_config.json --rest docs/testplan/xe_tests.rst --check-testlist --built-testlist /home/kamil/ramdisk/tmp-build/build/tests/intel-ci/intel-ci.testlist
Traceback (most recent call last):
File "/home/kamil/ramdisk/tmp-build/scripts/igt_doc.py", line 67, in <module>
tests.check_tests()
File "/home/kamil/ramdisk/tmp-build/scripts/test_list.py", line 970, in check_tests
with open(self.built_testlist, 'r', encoding='utf8') as handle:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/kamil/ramdisk/tmp-build/build/tests/intel-ci/intel-ci.testlist'
Regards,
Kamil
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 02/13] scripts/test_list.py: make the class more generic
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 02/13] scripts/test_list.py: make the class more generic Mauro Carvalho Chehab
@ 2023-07-12 17:29 ` Kamil Konieczny
0 siblings, 0 replies; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-12 17:29 UTC (permalink / raw)
To: igt-dev
Hi Mauro,
On 2023-07-12 at 15:58:43 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> Currently, the class is meant to be used only on IGT. However, it
> could also be used on other projects. It actually makes sense to
> port it to the Kernel, in order to document KUnit and Kselftests.
>
> Make the class more generic by allowing the constructor to pass
> three additional arguments:
> - The tag name for the test group ("TEST");
> - The tag name for the subtest group ("SUBTEST");
> - the prefix name for the tests;
> - the separator between testa and subtests.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> ---
> scripts/test_list.py | 43 ++++++++++++++++++++++++++++---------------
> 1 file changed, 28 insertions(+), 15 deletions(-)
>
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index 4f580fb3de58..18fdd619211a 100755
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -101,8 +101,8 @@ class TestList:
>
> """
> Parse and handle test lists with test/subtest documentation, in the
> - form of C comments, with two meta-tags (TEST and SUBTEST), and a set of
> - `field: value` items:
> + form of C comments, with two meta-tags (by default, TEST and SUBTEST),
> + and a set of `field: value` items:
>
> /**
> * TEST: Check if new IGT test documentation logic functionality is working
> @@ -246,7 +246,9 @@ class TestList:
> """
>
> def __init__(self, config_fname, include_plan = False, file_list = False,
> - igt_build_path = None):
> + igt_build_path = None,
> + test_tag = "TEST", subtest_tag = "SUBTESTS?",
> + main_name = "igt", subtest_separator = "@"):
> self.doc = {}
> self.test_number = 0
> self.config = None
> @@ -259,6 +261,11 @@ class TestList:
> self.field_list = {}
> self.title = None
> self.filters = {}
> + self.subtest_separator = subtest_separator
> + self.main_name = main_name
> +
> + if self.main_name:
> + self.main_name += subtest_separator
>
> driver_name = re.sub(r'(.*/)?([^\/]+)/.*', r'\2', config_fname).capitalize()
>
> @@ -355,11 +362,13 @@ class TestList:
> if fname == '':
> continue
>
> - self.__add_file_documentation(fname, implemented_class, field_re)
> + self.__add_file_documentation(fname, implemented_class, field_re,
> + test_tag, subtest_tag)
>
> if include_plan:
> for fname in self.plan_filenames:
> - self.__add_file_documentation(fname, planned_class, field_re)
> + self.__add_file_documentation(fname, planned_class, field_re,
> + test_tag, subtest_tag)
>
> #
> # ancillary methods
> @@ -421,7 +430,7 @@ class TestList:
> for subtest in self.doc[test]["subtest"].keys():
> summary = test_name
> if self.doc[test]["subtest"][subtest]["Summary"] != '':
> - summary += '@' + self.doc[test]["subtest"][subtest]["Summary"]
> + summary += self.subtest_separator + self.doc[test]["subtest"][subtest]["Summary"]
> if not summary:
> continue
>
> @@ -551,7 +560,7 @@ class TestList:
>
> name = re.sub(r'.*/', '', fname)
> name = re.sub(r'\.[\w+]$', '', name)
> - name = "igt@" + name
> + name = self.main_name + name
>
> if not subtest_only:
> test_dict[name] = {}
> @@ -606,7 +615,7 @@ class TestList:
>
> name = re.sub(r'.*/', '', fname)
> name = re.sub(r'\.[ch]', '', name)
> - name = "igt@" + name
> + name = self.main_name + name
>
> tmp_subtest = self.expand_subtest(fname, name, test, False)
>
> @@ -844,7 +853,7 @@ class TestList:
>
> test_name = re.sub(r'.*/', '', fname)
> test_name = re.sub(r'\.[ch]', '', test_name)
> - test_name = "igt@" + test_name
> + test_name = self.main_name + test_name
>
> subtest_array += self.expand_subtest(fname, test_name, test, True)
>
> @@ -941,8 +950,8 @@ class TestList:
> args_regex = re.compile(r'\<[^\>]+\>')
>
> for subtest in self.get_subtests()[""]:
> - subtest = "@".join(subtest.split("@")[:3])
> - subtest = args_regex.sub(r'\\d+', subtest)
> + subtest = self.subtest_separator.join(subtest.split(self.subtest_separator)[:3])
> + subtest = re.sub(r'\<[^\>]+\>', r'\\d+', subtest)
> doc_subtests.add(subtest)
>
> doc_subtests = list(sorted(doc_subtests))
> @@ -993,7 +1002,8 @@ class TestList:
> # File handling methods
> #
>
> - def __add_file_documentation(self, fname, implemented_class, field_re):
> + def __add_file_documentation(self, fname, implemented_class, field_re,
> + test_tag, subtest_tag):
>
> """Adds the contents of test/subtest documentation form a file"""
>
> @@ -1007,6 +1017,9 @@ class TestList:
> cur_arg_element = 0
> has_test_or_subtest = 0
>
> + test_regex = re.compile(test_tag + r':\s*(.*)')
--------------------------------------------- ^^^^
Too many spaces.
With that fixed you can add my r-b.
Regards,
Kamil
> + subtest_regex = re.compile('^' + subtest_tag + r':\s*(.*)')
> +
> with open(fname, 'r', encoding='utf8') as handle:
> arg_ref = None
> current_test = ''
> @@ -1041,7 +1054,7 @@ class TestList:
> current_field = ''
>
> # Check if it is a new TEST section
> - match = re.match(r'^TEST:\s*(.*)', file_line)
> + match = test_regex.match(file_line)
> if match:
> has_test_or_subtest = 1
> current_test = self.test_number
> @@ -1063,7 +1076,7 @@ class TestList:
> continue
>
> # Check if it is a new SUBTEST section
> - match = re.match(r'^SUBTESTS?:\s*(.*)', file_line)
> + match = subtest_regex.match(file_line)
> if match:
> has_test_or_subtest = 1
> current_subtest = subtest_number
> @@ -1228,7 +1241,7 @@ class TestList:
> """Generate testlists from the test documentation"""
>
> test_prefix = os.path.commonprefix(self.get_subtests()[""])
> - test_prefix = re.sub(r'^igt@', '', test_prefix)
> + test_prefix = re.sub(r'^' + self.main_name, '', test_prefix)
>
> # NOTE: currently, it uses a comma for multi-value delimitter
> test_subtests = self.get_subtests(sort_field, ",", with_order = True)
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 03/13] scripts/test_list.py: rename the internal summary value
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 03/13] scripts/test_list.py: rename the internal summary value Mauro Carvalho Chehab
@ 2023-07-12 17:31 ` Kamil Konieczny
0 siblings, 0 replies; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-12 17:31 UTC (permalink / raw)
To: igt-dev
Hi Mauro,
On 2023-07-12 at 15:58:44 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> The sumary is used internally. So, it is not meant to be used as
> a normal field. To avoid possible clashes in the future, rename
> the internal usage to _summary_, as we're using _foo_ for internal
> properties.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
> scripts/test_list.py | 44 ++++++++++++++++++++++----------------------
> 1 file changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index 18fdd619211a..8dca7fc7c49e 100755
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -429,8 +429,8 @@ class TestList:
>
> for subtest in self.doc[test]["subtest"].keys():
> summary = test_name
> - if self.doc[test]["subtest"][subtest]["Summary"] != '':
> - summary += self.subtest_separator + self.doc[test]["subtest"][subtest]["Summary"]
> + if self.doc[test]["subtest"][subtest]["_summary_"] != '':
> + summary += self.subtest_separator + self.doc[test]["subtest"][subtest]["_summary_"]
> if not summary:
> continue
>
> @@ -441,10 +441,10 @@ class TestList:
> if num_vars == 0:
> subtest_dict = {}
>
> - subtest_dict["Summary"] = summary
> + subtest_dict["_summary_"] = summary
>
> for k in sorted(self.doc[test]["subtest"][subtest].keys()):
> - if k in [ 'Summary', 'arg', 'subtest_line' ]:
> + if k in [ '_summary_', 'arg', 'subtest_line' ]:
> continue
>
> if not allow_inherit:
> @@ -510,10 +510,10 @@ class TestList:
>
> # Store the element
> subtest_dict = {}
> - subtest_dict["Summary"] = arg_summary
> + subtest_dict["_summary_"] = arg_summary
>
> for field in sorted(self.doc[test]["subtest"][subtest].keys()):
> - if field in [ 'Summary', 'arg', 'subtest_line' ]:
> + if field in [ '_summary_', 'arg', 'subtest_line' ]:
> continue
>
> sub_field = self.doc[test]["subtest"][subtest][field]
> @@ -581,11 +581,11 @@ class TestList:
> if self.__filter_subtest(self.doc[test], subtest, True):
> continue
>
> - summary = subtest["Summary"]
> + summary = subtest["_summary_"]
>
> dic[summary] = {}
> for field in sorted(subtest.keys()):
> - if field in [ 'Summary', 'arg', 'subtest_line' ]:
> + if field in [ '_summary_', 'arg', 'subtest_line' ]:
> continue
> dic[summary][field] = subtest[field]
>
> @@ -646,12 +646,12 @@ class TestList:
> for subtest in subtest_array:
>
> print()
> - print(subtest["Summary"])
> - print(len(subtest["Summary"]) * '=')
> + print(subtest["_summary_"])
> + print(len(subtest["_summary_"]) * '=')
> print("")
>
> for field in sorted(subtest.keys()):
> - if field in [ 'Summary', 'arg', 'subtest_line' ]:
> + if field in [ '_summary_', 'arg', 'subtest_line' ]:
> continue
>
> print(f":{field}:", subtest[field])
> @@ -857,7 +857,7 @@ class TestList:
>
> subtest_array += self.expand_subtest(fname, test_name, test, True)
>
> - subtest_array.sort(key = lambda x : x.get('Summary'))
> + subtest_array.sort(key = lambda x : x.get('_summary_'))
>
> for subtest in subtest_array:
> if self.__filter_subtest(self.doc[test], subtest, True):
> @@ -873,27 +873,27 @@ class TestList:
> if test_elem not in subtests:
> subtests[test_elem] = []
> if order:
> - subtests[test_elem].append((subtest["Summary"], test_list))
> + subtests[test_elem].append((subtest["_summary_"], test_list))
> else:
> - subtests[test_elem].append(subtest["Summary"])
> + subtests[test_elem].append(subtest["_summary_"])
> else:
> if subtest[sort_field] not in subtests:
> subtests[subtest[sort_field]] = []
> if order:
> - subtests[test_elem].append((subtest["Summary"], [subtest[sort_field]]))
> + subtests[test_elem].append((subtest["_summary_"], [subtest[sort_field]]))
> else:
> - subtests[subtest[sort_field]].append(subtest["Summary"])
> + subtests[subtest[sort_field]].append(subtest["_summary_"])
> else:
> if order:
> - subtests[test_elem].append((subtest["Summary"], [subtest[sort_field]]))
> + subtests[test_elem].append((subtest["_summary_"], [subtest[sort_field]]))
> else:
> - subtests[""].append(subtest["Summary"])
> + subtests[""].append(subtest["_summary_"])
>
> else:
> if order:
> - subtests[test_elem].append((subtest["Summary"], [subtest[sort_field]]))
> + subtests[test_elem].append((subtest["_summary_"], [subtest[sort_field]]))
> else:
> - subtests[""].append(subtest["Summary"])
> + subtests[""].append(subtest["_summary_"])
>
> if order:
> for group, tests in subtests.items():
> @@ -1064,7 +1064,7 @@ class TestList:
>
> self.doc[current_test] = {}
> self.doc[current_test]["arg"] = {}
> - self.doc[current_test]["Summary"] = match.group(1)
> + self.doc[current_test]["_summary_"] = match.group(1)
> self.doc[current_test]["File"] = fname
> self.doc[current_test]["subtest"] = {}
> self.doc[current_test]["subtest_line"] = {}
> @@ -1102,7 +1102,7 @@ class TestList:
> continue
> self.doc[current_test]["subtest"][current_subtest][field] = self.doc[current_test][field]
>
> - self.doc[current_test]["subtest"][current_subtest]["Summary"] = match.group(1)
> + self.doc[current_test]["subtest"][current_subtest]["_summary_"] = match.group(1)
> self.doc[current_test]["subtest"][current_subtest]["Description"] = ''
> self.doc[current_test]["subtest_line"][current_subtest] = file_ln
>
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 05/13] scripts/test_list.py: document what BAT stands for
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 05/13] scripts/test_list.py: document what BAT stands for Mauro Carvalho Chehab
@ 2023-07-12 18:30 ` Kamil Konieczny
0 siblings, 0 replies; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-12 18:30 UTC (permalink / raw)
To: igt-dev
Hi Mauro,
On 2023-07-12 at 15:58:46 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> BAT means Basic Accetance Test, which is a set of tests that
> are meant to test basic functionalities and provide a fast
> feedback. Add some documentation where the term is present
> at the code.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
> scripts/test_list.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index 1fd27ef560a7..0452be8d7994 100644
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -1256,7 +1256,7 @@ class TestList:
> testlist = test.lower()
> if testlist == "":
> fname = "other"
> - elif testlist == "bat":
> + elif testlist == "bat": # Basic Acceptance Test
> fname = "fast-feedback"
> else:
> fname = testlist
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 06/13] scripts/test_list.py: close config file before start processing
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 06/13] scripts/test_list.py: close config file before start processing Mauro Carvalho Chehab
@ 2023-07-12 18:38 ` Kamil Konieczny
2023-07-13 5:47 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-12 18:38 UTC (permalink / raw)
To: igt-dev
Hi Mauro,
On 2023-07-12 at 15:58:47 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> Reduce the identation level of the code which parses the config
> file, as this can be done after closing the file.
----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Where it is? Maybe should be dropped?
>
> This is a preparation for the next patch that will offer a different
> way to pass the configuration.
Could you change description? Now it is a little confusing,
you only change indentation but it state:
v2 06/13 scripts/test_list.py: close config file before start processing
------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Maybe something like: change indentation of code
Regards,
Kamil
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> ---
> scripts/test_list.py | 114 +++++++++++++++++++++----------------------
> 1 file changed, 57 insertions(+), 57 deletions(-)
>
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index 0452be8d7994..cfcf6712bdc0 100644
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -274,71 +274,71 @@ class TestList:
> with open(config_fname, 'r', encoding='utf8') as handle:
> self.config = json.load(handle)
>
> - self.__add_field(None, 0, 0, self.config["fields"])
> + self.__add_field(None, 0, 0, self.config["fields"])
>
> - sublevel_count = [ 0 ] * self.level_count
> + sublevel_count = [ 0 ] * self.level_count
>
> - for field, item in self.props.items():
> - if "sublevel" in item["_properties_"]:
> - level = item["_properties_"]["level"]
> - sublevel = item["_properties_"]["sublevel"]
> - if sublevel > sublevel_count[level - 1]:
> - sublevel_count[level - 1] = sublevel
> + for field, item in self.props.items():
> + if "sublevel" in item["_properties_"]:
> + level = item["_properties_"]["level"]
> + sublevel = item["_properties_"]["sublevel"]
> + if sublevel > sublevel_count[level - 1]:
> + sublevel_count[level - 1] = sublevel
>
> - field_lc = field.lower()
> - self.field_list[field_lc] = field
> - field_plural = _plural(field_lc)
> - if field_lc != field_plural:
> - self.field_list[field_plural] = field
> + field_lc = field.lower()
> + self.field_list[field_lc] = field
> + field_plural = _plural(field_lc)
> + if field_lc != field_plural:
> + self.field_list[field_plural] = field
>
> - if include_plan:
> - self.props["Class"] = {}
> - self.props["Class"]["_properties_"] = {}
> - self.props["Class"]["_properties_"]["level"] = 1
> - self.props["Class"]["_properties_"]["sublevel"] = sublevel_count[0] + 1
> + if include_plan:
> + self.props["Class"] = {}
> + self.props["Class"]["_properties_"] = {}
> + self.props["Class"]["_properties_"]["level"] = 1
> + self.props["Class"]["_properties_"]["sublevel"] = sublevel_count[0] + 1
>
> - # Remove non-multilevel items, as we're only interested on
> - # hierarchical item levels here
> - for field, item in self.props.items():
> - if "sublevel" in item["_properties_"]:
> - level = item["_properties_"]["level"]
> - if sublevel_count[level - 1] == 1:
> - del item["_properties_"]["level"]
> - del item["_properties_"]["sublevel"]
> - del self.props["_properties_"]
> + # Remove non-multilevel items, as we're only interested on
> + # hierarchical item levels here
> + for field, item in self.props.items():
> + if "sublevel" in item["_properties_"]:
> + level = item["_properties_"]["level"]
> + if sublevel_count[level - 1] == 1:
> + del item["_properties_"]["level"]
> + del item["_properties_"]["sublevel"]
> + del self.props["_properties_"]
>
> - has_implemented = False
> - if not self.filenames:
> - self.filenames = []
> - exclude_files = []
> - files = self.config["files"]
> - exclude_file_glob = self.config.get("exclude_files", [])
> - for cfg_file in exclude_file_glob:
> - cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
> - for fname in glob.glob(cfg_file):
> - exclude_files.append(fname)
> + has_implemented = False
> + if not self.filenames:
> + self.filenames = []
> + exclude_files = []
> + files = self.config["files"]
> + exclude_file_glob = self.config.get("exclude_files", [])
> + for cfg_file in exclude_file_glob:
> + cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
> + for fname in glob.glob(cfg_file):
> + exclude_files.append(fname)
>
> - for cfg_file in files:
> - cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
> - for fname in glob.glob(cfg_file):
> - if fname in exclude_files:
> - continue
> - self.filenames.append(fname)
> - has_implemented = True
> - else:
> - for cfg_file in self.filenames:
> - if cfg_file:
> - has_implemented = True
> + for cfg_file in files:
> + cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
> + for fname in glob.glob(cfg_file):
> + if fname in exclude_files:
> + continue
> + self.filenames.append(fname)
> + has_implemented = True
> + else:
> + for cfg_file in self.filenames:
> + if cfg_file:
> + has_implemented = True
>
> - has_planned = False
> - if include_plan and "planning_files" in self.config:
> - implemented_class = "Implemented"
> - files = self.config["planning_files"]
> - for cfg_file in files:
> - cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
> - for fname in glob.glob(cfg_file):
> - self.plan_filenames.append(fname)
> - has_planned = True
> + has_planned = False
> + if include_plan and "planning_files" in self.config:
> + implemented_class = "Implemented"
> + files = self.config["planning_files"]
> + for cfg_file in files:
> + cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
> + for fname in glob.glob(cfg_file):
> + self.plan_filenames.append(fname)
> + has_planned = True
>
> planned_class = None
> if has_implemented:
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 07/13] scripts/test_list.py: don't rely on file name to parse config
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 07/13] scripts/test_list.py: don't rely on file name to parse config Mauro Carvalho Chehab
@ 2023-07-12 18:42 ` Kamil Konieczny
0 siblings, 0 replies; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-12 18:42 UTC (permalink / raw)
To: igt-dev
Hi Mauro,
On 2023-07-12 at 15:58:48 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> Currently, config_fname should not be empty, as the class init
> will fail. Make the logic more generic to prepare to optionally pass
> the configuration dict directly.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
> scripts/test_list.py | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index cfcf6712bdc0..5da471617268 100644
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -255,7 +255,6 @@ class TestList:
> self.filenames = file_list
> self.plan_filenames = []
> self.props = {}
> - self.config_fname = config_fname
> self.built_testlist = built_testlist
> self.level_count = 0
> self.field_list = {}
> @@ -274,6 +273,9 @@ class TestList:
> with open(config_fname, 'r', encoding='utf8') as handle:
> self.config = json.load(handle)
>
> + config_origin = config_fname
> + cfg_path = os.path.realpath(os.path.dirname(config_fname)) + "/"
> +
> self.__add_field(None, 0, 0, self.config["fields"])
>
> sublevel_count = [ 0 ] * self.level_count
> @@ -314,12 +316,12 @@ class TestList:
> files = self.config["files"]
> exclude_file_glob = self.config.get("exclude_files", [])
> for cfg_file in exclude_file_glob:
> - cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
> + cfg_file = cfg_path + cfg_file
> for fname in glob.glob(cfg_file):
> exclude_files.append(fname)
>
> for cfg_file in files:
> - cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
> + cfg_file = cfg_path + cfg_file
> for fname in glob.glob(cfg_file):
> if fname in exclude_files:
> continue
> @@ -335,7 +337,7 @@ class TestList:
> implemented_class = "Implemented"
> files = self.config["planning_files"]
> for cfg_file in files:
> - cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
> + cfg_file = cfg_path + cfg_file
> for fname in glob.glob(cfg_file):
> self.plan_filenames.append(fname)
> has_planned = True
> @@ -363,12 +365,12 @@ class TestList:
> continue
>
> self.__add_file_documentation(fname, implemented_class, field_re,
> - test_tag, subtest_tag)
> + test_tag, subtest_tag, config_origin)
>
> if include_plan:
> for fname in self.plan_filenames:
> self.__add_file_documentation(fname, planned_class, field_re,
> - test_tag, subtest_tag)
> + test_tag, subtest_tag, config_origin)
>
> #
> # ancillary methods
> @@ -1003,7 +1005,7 @@ class TestList:
> #
>
> def __add_file_documentation(self, fname, implemented_class, field_re,
> - test_tag, subtest_tag):
> + test_tag, subtest_tag, config_origin):
>
> """Adds the contents of test/subtest documentation form a file"""
>
> @@ -1215,7 +1217,7 @@ class TestList:
>
> file_line.rstrip(r"\n")
> sys.exit(f"{fname}:{file_ln + 1}: Error: unrecognized line. Need to add field at %s?\n\t==> %s" %
> - (self.config_fname, file_line))
> + (config_origin, file_line))
>
> def show_subtests(self, sort_field):
>
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 08/13] scripts/test_list.py: allow passing a config dict directly
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 08/13] scripts/test_list.py: allow passing a config dict directly Mauro Carvalho Chehab
@ 2023-07-12 18:45 ` Kamil Konieczny
0 siblings, 0 replies; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-12 18:45 UTC (permalink / raw)
To: igt-dev
Hi Mauro,
On 2023-07-12 at 15:58:49 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> Make the logic more generic by allowing to pass a config dict
> directly.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
> scripts/test_list.py | 32 +++++++++++++++++++++++++-------
> 1 file changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index 5da471617268..9861306bd777 100644
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -245,8 +245,10 @@ class TestList:
> Description: test ioctls
> """
>
> - def __init__(self, config_fname, include_plan = False, file_list = False,
> + def __init__(self, config_fname = None,
> + include_plan = False, file_list = None,
> built_testlist = None,
> + config_dict = None, sources_path = None,
> test_tag = "TEST", subtest_tag = "SUBTESTS?",
> main_name = "igt", subtest_separator = "@"):
> self.doc = {}
> @@ -263,18 +265,34 @@ class TestList:
> self.subtest_separator = subtest_separator
> self.main_name = main_name
>
> + # Exclusive or: either one is needed
> + if bool(config_fname) == bool(config_dict):
> + sys.exit("Error: either config filename or config dict shall be used")
> +
> if self.main_name:
> self.main_name += subtest_separator
>
> - driver_name = re.sub(r'(.*/)?([^\/]+)/.*', r'\2', config_fname).capitalize()
> -
> implemented_class = None
>
> - with open(config_fname, 'r', encoding='utf8') as handle:
> - self.config = json.load(handle)
> + if config_fname:
> + with open(config_fname, 'r', encoding='utf8') as handle:
> + self.config = json.load(handle)
>
> - config_origin = config_fname
> - cfg_path = os.path.realpath(os.path.dirname(config_fname)) + "/"
> + config_origin = config_fname
> + cfg_path = os.path.realpath(os.path.dirname(config_fname)) + "/"
> + driver_name = re.sub(r'(.*/)?([^\/]+)/.*', r'\2', config_fname).capitalize()
> +
> + else:
> + self.config = config_dict
> + config_origin = "config dict"
> + cfg_path = "./"
> + driver_name = main_name
> +
> + if sources_path:
> + cfg_path = os.path.realpath(sources_path) + "/"
> +
> + if not self.config:
> + sys.exit("Error: configuration is empty!")
>
> self.__add_field(None, 0, 0, self.config["fields"])
>
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 09/13] scripts/igt_doc.py: use field names when create a TestList instance
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 09/13] scripts/igt_doc.py: use field names when create a TestList instance Mauro Carvalho Chehab
@ 2023-07-12 18:50 ` Kamil Konieczny
0 siblings, 0 replies; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-12 18:50 UTC (permalink / raw)
To: igt-dev
Hi Mauro,
On 2023-07-12 at 15:58:50 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> Makes the caller more generic by explicitly passing the field
> name when calling TestList. This allows updating the class and
> eventually re-ordering fields without the need of changes on
> igt_doc.py.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
> scripts/igt_doc.py | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
> index c02029e03a31..4f4c5c755c44 100755
> --- a/scripts/igt_doc.py
> +++ b/scripts/igt_doc.py
> @@ -48,8 +48,10 @@ parser.add_argument('--files', nargs='+',
>
> parse_args = parser.parse_args()
>
> -tests = TestList(parse_args.config, parse_args.include_plan, parse_args.files,
> - parse_args.built_testlist)
> +tests = TestList(config_fname = parse_args.config,
> + include_plan = parse_args.include_plan,
> + file_list = parse_args.files,
> + built_testlist = parse_args.built_testlist)
>
> if parse_args.filter_field:
> for filter_expr in parse_args.filter_field:
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 10/13] scripts/test_list.py: add a check before deleting properties
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 10/13] scripts/test_list.py: add a check before deleting properties Mauro Carvalho Chehab
@ 2023-07-12 18:52 ` Kamil Konieczny
0 siblings, 0 replies; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-12 18:52 UTC (permalink / raw)
To: igt-dev
Hi Mauro,
On 2023-07-12 at 15:58:51 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> If the config file doesn't have empty _properties_, the current
> logic causes an error. Well, if one is passing a dictionary via
> config_dict, it may end using a simplified dict without any
> _properties_ on it.
>
> Add an extra check to avoid an error.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
> scripts/test_list.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index 9861306bd777..6e3cab206e82 100644
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -325,7 +325,8 @@ class TestList:
> if sublevel_count[level - 1] == 1:
> del item["_properties_"]["level"]
> del item["_properties_"]["sublevel"]
> - del self.props["_properties_"]
> + if "_properties_" in self.props:
> + del self.props["_properties_"]
>
> has_implemented = False
> if not self.filenames:
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 11/13] scripts/test_list.py: filename arguments for print_ methods are optional
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 11/13] scripts/test_list.py: filename arguments for print_ methods are optional Mauro Carvalho Chehab
@ 2023-07-12 18:55 ` Kamil Konieczny
0 siblings, 0 replies; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-12 18:55 UTC (permalink / raw)
To: igt-dev
Hi Mauro,
On 2023-07-12 at 15:58:52 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> Add a default to those, as the code doesn't need any arguments.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
> scripts/test_list.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index 6e3cab206e82..1551bc92c010 100644
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -616,7 +616,7 @@ class TestList:
> # Output methods
> #
>
> - def print_rest_flat(self, filename):
> + def print_rest_flat(self, filename = None):
>
> """Print tests and subtests ordered by tests"""
>
> @@ -728,7 +728,7 @@ class TestList:
> sheet[row].append('')
> return sheet
>
> - def print_nested_rest(self, filename):
> + def print_nested_rest(self, filename = None):
>
> """Print tests and subtests ordered by tests"""
>
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 12/13] scripts/test_list.py: skip some internal fields
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 12/13] scripts/test_list.py: skip some internal fields Mauro Carvalho Chehab
@ 2023-07-12 19:12 ` Kamil Konieczny
2023-07-13 5:52 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-12 19:12 UTC (permalink / raw)
To: igt-dev
Hi Mauro,
On 2023-07-12 at 15:58:53 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> both subtest_line and _summary_ are used internally at the script
> logic. They shouldn't be part of the output.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> ---
> scripts/test_list.py | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/scripts/test_list.py b/scripts/test_list.py
> index 1551bc92c010..11aed63cb67a 100644
> --- a/scripts/test_list.py
> +++ b/scripts/test_list.py
> @@ -661,6 +661,10 @@ class TestList:
> continue
> if field == "arg":
> continue
> + if field == "_summary_":
> + continue
> + if field == "subtest_line":
Maybe also _subtest_line_?
With or without this,
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> + continue
>
> print(f":{field}: {self.doc[test][field]}")
>
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 06/13] scripts/test_list.py: close config file before start processing
2023-07-12 18:38 ` Kamil Konieczny
@ 2023-07-13 5:47 ` Mauro Carvalho Chehab
2023-07-13 10:20 ` Kamil Konieczny
0 siblings, 1 reply; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-13 5:47 UTC (permalink / raw)
To: Kamil Konieczny; +Cc: igt-dev
On Wed, 12 Jul 2023 20:38:59 +0200
Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:
> Hi Mauro,
>
> On 2023-07-12 at 15:58:47 +0200, Mauro Carvalho Chehab wrote:
> > From: Mauro Carvalho Chehab <mchehab@kernel.org>
> >
> > Reduce the identation level of the code which parses the config
> > file, as this can be done after closing the file.
> ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Where it is? Maybe should be dropped?
>
> >
> > This is a preparation for the next patch that will offer a different
> > way to pass the configuration.
>
> Could you change description? Now it is a little confusing,
> you only change indentation but it state:
>
> v2 06/13 scripts/test_list.py: close config file before start processing
> ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Maybe something like: change indentation of code
I opted to describe the functional change, and not the physical one.
This is something I don't like on python: changing indentation actuall
changes the code itself, as it doesn't have explicit block markups like
C's { } or Pascal's begin ... end.
What was happening before was equivalent to this (in C code format):
fp = fopen(...)
if (!fp) exit(); // implicit, as this is python normal behavior
{
fread()
// do a lot of things (unrelated to fp itself)
}
fclose(fp)
After the change, the code is it now:
fp = fopen(...)
if (!fp) exit();
fread()
fclose(fp)
// do a lot of things
Yeah, as a side effect, we have one less level of indentation, which is
indeed a good thing.
Regards,
Mauro
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 12/13] scripts/test_list.py: skip some internal fields
2023-07-12 19:12 ` Kamil Konieczny
@ 2023-07-13 5:52 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 31+ messages in thread
From: Mauro Carvalho Chehab @ 2023-07-13 5:52 UTC (permalink / raw)
To: Kamil Konieczny; +Cc: igt-dev
On Wed, 12 Jul 2023 21:12:13 +0200
Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:
> Hi Mauro,
>
> On 2023-07-12 at 15:58:53 +0200, Mauro Carvalho Chehab wrote:
> > From: Mauro Carvalho Chehab <mchehab@kernel.org>
> >
> > both subtest_line and _summary_ are used internally at the script
> > logic. They shouldn't be part of the output.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> > ---
> > scripts/test_list.py | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/scripts/test_list.py b/scripts/test_list.py
> > index 1551bc92c010..11aed63cb67a 100644
> > --- a/scripts/test_list.py
> > +++ b/scripts/test_list.py
> > @@ -661,6 +661,10 @@ class TestList:
> > continue
> > if field == "arg":
> > continue
> > + if field == "_summary_":
> > + continue
> > + if field == "subtest_line":
>
> Maybe also _subtest_line_?
Not needed, but maybe I should rename:
arg -> _arg_
subtest_line -> _subtest_line_
and use a regex or add those internal fields into a list.
For now, I'll keep it as-is on this patch, but I think on a cleanup
patch to handle those internal fields (either on this series or on a
new one).
> With or without this,
>
> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
>
> > + continue
> >
> > print(f":{field}: {self.doc[test][field]}")
> >
> > --
> > 2.40.1
> >
^ permalink raw reply [flat|nested] 31+ messages in thread
* [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic (rev2)
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (13 preceding siblings ...)
2023-07-12 14:44 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic Patchwork
@ 2023-07-13 9:12 ` Patchwork
2023-07-13 11:32 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic (rev3) Patchwork
15 siblings, 0 replies; 31+ messages in thread
From: Patchwork @ 2023-07-13 9:12 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: igt-dev
== Series Details ==
Series: Make test_list.py more generic (rev2)
URL : https://patchwork.freedesktop.org/series/120622/
State : failure
== Summary ==
IGT patchset build failed on latest successful build
39f5aba75797f2c00a93ff9ee22cafd5526457cf test/i915/gem_create: Skip the test if the PAT index is set on a non MTL device
Installing tools/i915-perf/i915-perf-recorder to /opt/igt/bin
Installing tools/i915-perf/i915-perf-control to /opt/igt/bin
Installing tools/i915-perf/i915-perf-reader to /opt/igt/bin
Installing runner/igt_runner to /opt/igt/bin
Installing runner/igt_resume to /opt/igt/bin
Installing runner/igt_results to /opt/igt/bin
Installing runner/igt_comms_decoder to /opt/igt/bin
Installing assembler/intel-gen4asm to /opt/igt/bin
Installing assembler/intel-gen4disasm to /opt/igt/bin
Installing overlay/intel-gpu-overlay to /opt/igt/bin
Installing man/intel_audio_dump.1.gz to /opt/igt/share/man/man1
Installing man/intel_bios_dumper.1.gz to /opt/igt/share/man/man1
Installing man/intel_error_decode.1.gz to /opt/igt/share/man/man1
Installing man/intel_gpu_frequency.1.gz to /opt/igt/share/man/man1
Installing man/intel_gpu_top.1.gz to /opt/igt/share/man/man1
Installing man/intel_gtt.1.gz to /opt/igt/share/man/man1
Installing man/intel_infoframes.1.gz to /opt/igt/share/man/man1
Installing man/intel_lid.1.gz to /opt/igt/share/man/man1
Installing man/intel_panel_fitter.1.gz to /opt/igt/share/man/man1
Installing man/intel_reg.1.gz to /opt/igt/share/man/man1
Installing man/intel_stepping.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_large.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_large_gtt.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_large_map.1.gz to /opt/igt/share/man/man1
Installing man/intel_upload_blit_small.1.gz to /opt/igt/share/man/man1
Installing man/intel_vbt_decode.1.gz to /opt/igt/share/man/man1
Installing /usr/src/igt-gpu-tools/lib/igt_list.h to /opt/igt/include/i915-perf
Installing /usr/src/igt-gpu-tools/lib/intel_chipset.h to /opt/igt/include/i915-perf
Installing /usr/src/igt-gpu-tools/lib/i915/perf.h to /opt/igt/include/i915-perf
Installing /usr/src/igt-gpu-tools/lib/i915/perf_data.h to /opt/igt/include/i915-perf
Installing /usr/src/igt-gpu-tools/lib/i915/perf_data_reader.h to /opt/igt/include/i915-perf
Installing /opt/igt/build/lib/i915-perf.pc to /opt/igt/lib/x86_64-linux-gnu/pkgconfig
Installing /usr/src/igt-gpu-tools/tests/1080p-left.png to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/1080p-right.png to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/pass.png to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/fast-feedback.testlist to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/meta.testlist to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/README to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/blacklist.txt to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/blacklist-pre-merge.txt to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/xe-fast-feedback.testlist to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tests/intel-ci/xe.blocklist.txt to /opt/igt/share/igt-gpu-tools
Installing /usr/src/igt-gpu-tools/tools/intel_gpu_abrt to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/tools/intel-gfx-fw-info to /opt/igt/bin
Installing /opt/igt/build/assembler/intel-gen4asm.pc to /opt/igt/lib/x86_64-linux-gnu/pkgconfig
Installing /usr/src/igt-gpu-tools/scripts/code_cov_capture to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/scripts/code_cov_gather_on_build to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/scripts/code_cov_gather_on_test to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/scripts/code_cov_gen_report to /opt/igt/bin
Installing /usr/src/igt-gpu-tools/scripts/code_cov_parse_info to /opt/igt/bin
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [igt-dev] [PATCH i-g-t v2 06/13] scripts/test_list.py: close config file before start processing
2023-07-13 5:47 ` Mauro Carvalho Chehab
@ 2023-07-13 10:20 ` Kamil Konieczny
0 siblings, 0 replies; 31+ messages in thread
From: Kamil Konieczny @ 2023-07-13 10:20 UTC (permalink / raw)
To: igt-dev
Hi Mauro,
On 2023-07-13 at 07:47:15 +0200, Mauro Carvalho Chehab wrote:
> On Wed, 12 Jul 2023 20:38:59 +0200
> Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:
>
> > Hi Mauro,
> >
> > On 2023-07-12 at 15:58:47 +0200, Mauro Carvalho Chehab wrote:
> > > From: Mauro Carvalho Chehab <mchehab@kernel.org>
> > >
> > > Reduce the identation level of the code which parses the config
> > > file, as this can be done after closing the file.
> > ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > Where it is? Maybe should be dropped?
> >
> > >
> > > This is a preparation for the next patch that will offer a different
> > > way to pass the configuration.
> >
> > Could you change description? Now it is a little confusing,
> > you only change indentation but it state:
> >
> > v2 06/13 scripts/test_list.py: close config file before start processing
> > ------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >
> > Maybe something like: change indentation of code
>
> I opted to describe the functional change, and not the physical one.
>
> This is something I don't like on python: changing indentation actuall
> changes the code itself, as it doesn't have explicit block markups like
> C's { } or Pascal's begin ... end.
>
> What was happening before was equivalent to this (in C code format):
>
> fp = fopen(...)
> if (!fp) exit(); // implicit, as this is python normal behavior
> {
> fread()
> // do a lot of things (unrelated to fp itself)
> }
> fclose(fp)
>
> After the change, the code is it now:
>
> fp = fopen(...)
> if (!fp) exit();
> fread()
> fclose(fp)
> // do a lot of things
>
> Yeah, as a side effect, we have one less level of indentation, which is
> indeed a good thing.
>
> Regards,
> Mauro
Thank you for explanation, I missed this in those massive un-indentation.
Regards,
Kamil
^ permalink raw reply [flat|nested] 31+ messages in thread
* [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic (rev3)
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
` (14 preceding siblings ...)
2023-07-13 9:12 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic (rev2) Patchwork
@ 2023-07-13 11:32 ` Patchwork
15 siblings, 0 replies; 31+ messages in thread
From: Patchwork @ 2023-07-13 11:32 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: igt-dev
== Series Details ==
Series: Make test_list.py more generic (rev3)
URL : https://patchwork.freedesktop.org/series/120622/
State : failure
== Summary ==
IGT patchset build failed on latest successful build
6f68af5bc4c508fee58b7eb8eae61c7463b521a3 tests/gem_ccs: Avoid writing png twice
Tail of build.log:
[1578/1614] Linking target runner/testdata/skippers.
[1579/1614] Linking target tools/intel_dp_compliance.
[1580/1614] Linking target tools/intel_l3_parity.
[1581/1614] Linking target tools/amd_hdmi_compliance.
[1582/1614] Linking target runner/igt_resume.
[1583/1614] Linking target runner/testdata/abort-dynamic.
[1584/1614] Linking target runner/testdata/abort-fixture.
[1585/1614] Linking target runner/testdata/dynamic.
[1586/1614] Linking target runner/igt_comms_decoder.
[1587/1614] Linking target runner/igt_runner.
[1588/1614] Linking target runner/igt_results.
[1589/1614] Linking target runner/runner_json_test.
[1590/1614] Compiling C object 'lib/76b5a35@@i915_perf@sha/meson-generated_.._i915_perf_metrics_mtlgt3.c.o'.
[1591/1614] Compiling C object 'lib/76b5a35@@i915_perf@sha/meson-generated_.._i915_perf_metrics_acmgt1.c.o'.
[1592/1614] Compiling C object 'runner/527aa9f@@runner_test@exe/runner_tests.c.o'.
[1593/1614] Linking target runner/runner_test.
[1594/1614] Compiling C object 'lib/76b5a35@@i915_perf@sha/meson-generated_.._i915_perf_metrics_acmgt2.c.o'.
[1595/1614] Compiling C object 'lib/76b5a35@@i915_perf@sha/meson-generated_.._i915_perf_metrics_acmgt3.c.o'.
[1596/1614] Linking target lib/libi915_perf.so.1.5.
[1597/1614] Generating symbol file 'lib/76b5a35@@i915_perf@sha/libi915_perf.so.1.5.symbols'.
[1598/1614] Linking target tools/i915-perf/i915-perf-configs.
[1599/1614] Linking target tools/i915-perf/i915-perf-reader.
[1600/1614] Linking target tools/i915-perf/i915-perf-recorder.
[1601/1614] Linking target tests/gem_barrier_race.
[1602/1614] Linking target tests/core_hotunplug.
[1603/1614] Linking target tests/perf.
[1604/1614] Generating core_hotunplug.testlist with a meson_exe.py custom command.
[1605/1614] Generating gem_barrier_race.testlist with a meson_exe.py custom command.
[1606/1614] Generating perf.testlist with a meson_exe.py custom command.
[1607/1614] Generating xe_tests.rst with a custom command.
FAILED: docs/testplan/xe_tests.rst
/usr/src/igt-gpu-tools/scripts/igt_doc.py --config /usr/src/igt-gpu-tools/tests/xe/xe_test_config.json --rest docs/testplan/xe_tests.rst --check-testlist --built-testlist /opt/igt/build/tests/intel-ci/intel-ci.testlist
Traceback (most recent call last):
File "/usr/src/igt-gpu-tools/scripts/igt_doc.py", line 67, in <module>
tests.check_tests()
File "/usr/src/igt-gpu-tools/scripts/test_list.py", line 970, in check_tests
with open(self.built_testlist, 'r', encoding='utf8') as handle:
FileNotFoundError: [Errno 2] No such file or directory: '/opt/igt/build/tests/intel-ci/intel-ci.testlist'
[1608/1614] Generating kms_tests.rst with a custom command.
[1609/1614] Generating i915_tests.rst with a custom command.
FAILED: docs/testplan/i915_tests.rst
/usr/src/igt-gpu-tools/scripts/igt_doc.py --config /usr/src/igt-gpu-tools/tests/i915/i915_test_config.json --rest docs/testplan/i915_tests.rst --check-testlist --built-testlist /opt/igt/build/tests/intel-ci/intel-ci.testlist
Traceback (most recent call last):
File "/usr/src/igt-gpu-tools/scripts/igt_doc.py", line 67, in <module>
tests.check_tests()
File "/usr/src/igt-gpu-tools/scripts/test_list.py", line 970, in check_tests
with open(self.built_testlist, 'r', encoding='utf8') as handle:
FileNotFoundError: [Errno 2] No such file or directory: '/opt/igt/build/tests/intel-ci/intel-ci.testlist'
[1610/1614] Generating intel-ci.testlist with a meson_exe.py custom command.
ninja: build stopped: subcommand failed.
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2023-07-13 11:32 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-12 13:58 [igt-dev] [PATCH i-g-t v2 00/13] Make test_list.py more generic Mauro Carvalho Chehab
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 01/13] tests/intel-ci/meson.build: Generate and store an intel-ci.testlist Mauro Carvalho Chehab
2023-07-12 17:22 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 02/13] scripts/test_list.py: make the class more generic Mauro Carvalho Chehab
2023-07-12 17:29 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 03/13] scripts/test_list.py: rename the internal summary value Mauro Carvalho Chehab
2023-07-12 17:31 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 04/13] scripts/igt_doc.py: pass a single file when checking docs Mauro Carvalho Chehab
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 05/13] scripts/test_list.py: document what BAT stands for Mauro Carvalho Chehab
2023-07-12 18:30 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 06/13] scripts/test_list.py: close config file before start processing Mauro Carvalho Chehab
2023-07-12 18:38 ` Kamil Konieczny
2023-07-13 5:47 ` Mauro Carvalho Chehab
2023-07-13 10:20 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 07/13] scripts/test_list.py: don't rely on file name to parse config Mauro Carvalho Chehab
2023-07-12 18:42 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 08/13] scripts/test_list.py: allow passing a config dict directly Mauro Carvalho Chehab
2023-07-12 18:45 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 09/13] scripts/igt_doc.py: use field names when create a TestList instance Mauro Carvalho Chehab
2023-07-12 18:50 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 10/13] scripts/test_list.py: add a check before deleting properties Mauro Carvalho Chehab
2023-07-12 18:52 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 11/13] scripts/test_list.py: filename arguments for print_ methods are optional Mauro Carvalho Chehab
2023-07-12 18:55 ` Kamil Konieczny
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 12/13] scripts/test_list.py: skip some internal fields Mauro Carvalho Chehab
2023-07-12 19:12 ` Kamil Konieczny
2023-07-13 5:52 ` Mauro Carvalho Chehab
2023-07-12 13:58 ` [igt-dev] [PATCH i-g-t v2 13/13] scripts/test_list.py: add support to return a string instead of print Mauro Carvalho Chehab
2023-07-12 14:44 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic Patchwork
2023-07-13 9:12 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic (rev2) Patchwork
2023-07-13 11:32 ` [igt-dev] ✗ Fi.CI.BUILD: failure for Make test_list.py more generic (rev3) Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox