From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: tomasz.mistat@intel.com, jari.tahvanainen@intel.com
Subject: [igt-dev] [PATCH i-g-t v2 1/6] test_list.py: add support for reading testlist regular expressions
Date: Thu, 7 Sep 2023 00:05:53 +0200 [thread overview]
Message-ID: <20230906220642.507532-2-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20230906220642.507532-1-mauro.chehab@linux.intel.com>
From: Mauro Carvalho Chehab <mchehab@kernel.org>
If defined, use testlist and blocklist files to update the
fields that use it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
scripts/test_list.py | 75 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 2171f8b50617..c1518a904baf 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -260,6 +260,8 @@ class TestList:
self.igt_build_path = igt_build_path
self.level_count = 0
self.field_list = {}
+ self.testlist = {}
+ self.blocklist = {}
self.title = None
self.filters = {}
self.subtest_separator = subtest_separator
@@ -327,6 +329,23 @@ class TestList:
if sublevel_count[level - 1] == 1:
del item["_properties_"]["level"]
del item["_properties_"]["sublevel"]
+
+ # Read testlist files if any
+ if "testlists" in item["_properties_"]:
+ testlist = {}
+ for name in item["_properties_"]["testlists"].keys():
+ self.read_testlist(testlist, name, cfg_path + item["_properties_"]["testlists"][name])
+
+ item["_properties_"]["testlist"] = testlist
+
+ # Read blocklist files if any
+ if "blocklists" in item["_properties_"]:
+ blocklist = {}
+ for name in item["_properties_"]["blocklists"].keys():
+ self.read_testlist(blocklist, name, cfg_path + item["_properties_"]["blocklists"][name])
+
+ item["_properties_"]["blocklist"] = blocklist
+
if "_properties_" in self.props:
del self.props["_properties_"]
@@ -427,6 +446,19 @@ class TestList:
self.__add_field(key, sublevel, hierarchy_level, field[key])
+ def read_testlist(self, testlist, name, filename):
+ base = r"^\s*({}[^\s\{}]+)(\S*)\s*(\#.*)?$"
+ regex = re.compile(base.format(self.main_name, self.subtest_separator))
+
+ testlist[name] = []
+ with open(filename, 'r', newline = '', encoding = 'utf8') as fp:
+ for line in fp:
+ match = regex.match(line)
+ if match:
+ test = match.group(1)
+ subtest = match.group(2)
+ testlist[name].append(re.compile(f"{test}{subtest}"))
+
def __filter_subtest(self, test, subtest, field_not_found_value):
""" Apply filter criteria to subtests """
@@ -444,6 +476,45 @@ class TestList:
# None of the filtering rules were applied
return False
+ def update_testlist_field(self, subtest_dict):
+ for field in self.props.keys():
+ if "_properties_" not in self.props[field]:
+ continue
+
+ if "testlist" not in self.props[field]["_properties_"]:
+ continue
+
+ testname = subtest_dict["_summary_"]
+
+ value = subtest_dict.get(field)
+ if value:
+ values = set(re.split(",\s*", value))
+ else:
+ values = set()
+
+ for names, regex_array in self.props[field]["_properties_"]["testlist"].items():
+ name = set(re.split(",\s*", names))
+ for regex in regex_array:
+ if regex.match(testname):
+ values.update(name)
+ break
+
+ # If test is at a global blocklist, ignore it
+ set_full_if_empty = True
+ if "blocklist" in self.props[field]["_properties_"]:
+ for names, regex_array in self.props[field]["_properties_"]["testlist"].items():
+ deleted_names = set(re.split(",\s*", names))
+ for regex in regex_array:
+ if regex.match(testname):
+ if sorted(deleted_names) == sorted(values):
+ set_full_if_empty = False
+ values.discard(deleted_names)
+
+ if set_full_if_empty and not values:
+ values = set(["FULL"])
+
+ subtest_dict[field] = ", ".join(sorted(values))
+
def expand_subtest(self, fname, test_name, test, allow_inherit, with_lines = False, with_subtest_nr = False):
"""Expand subtest wildcards providing an array with subtests"""
@@ -476,6 +547,8 @@ class TestList:
subtest_dict[k] = self.doc[test]["subtest"][subtest][k]
+ self.update_testlist_field(subtest_dict)
+
if with_lines:
subtest_dict["line"] = file_ln
@@ -549,6 +622,8 @@ class TestList:
subtest_dict[field] = sub_field
+ self.update_testlist_field(subtest_dict)
+
if with_lines:
subtest_dict["line"] = file_ln
--
2.41.0
next prev parent reply other threads:[~2023-09-06 22:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 22:05 [igt-dev] [PATCH i-g-t v2 0/6] Xe: set Run type from testlist instead of defining it Mauro Carvalho Chehab
2023-09-06 22:05 ` Mauro Carvalho Chehab [this message]
2023-09-06 22:05 ` [igt-dev] [PATCH i-g-t v2 2/6] xe_test_config.json: add testlists and blocklists Mauro Carvalho Chehab
2023-09-06 22:05 ` [igt-dev] [PATCH i-g-t v2 3/6] kms_test_config.json: " Mauro Carvalho Chehab
2023-09-06 22:05 ` [igt-dev] [PATCH i-g-t v2 4/6] tests: Intel Xe: drop Run type field Mauro Carvalho Chehab
2023-09-06 22:05 ` [igt-dev] [PATCH i-g-t v2 5/6] tests: Intel KMS: " Mauro Carvalho Chehab
2023-09-06 22:05 ` [igt-dev] [PATCH i-g-t v2 6/6] scripts/test_list.py: move "FULL" testlist to config file Mauro Carvalho Chehab
2023-09-06 23:24 ` [igt-dev] ✗ Fi.CI.BAT: failure for Xe: set Run type from testlist instead of defining it Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230906220642.507532-2-mauro.chehab@linux.intel.com \
--to=mauro.chehab@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jari.tahvanainen@intel.com \
--cc=tomasz.mistat@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox