Fix a series of issues while handling testlist
cover Fix a series of issues while handling testlist
From: Mauro Carvalho Chehab <[email protected]>
There is still a huge gap between what igt_runner and test_list.py generates. Those are related to several issues:
- The properties related to input file test list parsing are not grouped altogether and have weird names. A better namespace for JSON config for such options needs to be defined.
- FULL testlist is currently just the tests that don't belong to other testlists;
- i915 and Xe has a different set of FULL testlist;
- case-insensitive regex were not applied the right way, as we need to be able to define what kind of match applies for include and exclude files.
Mauro Carvalho Chehab (5):
scripts/test_list.py: better parse list of tests scripts/test_list.py: speedup update testlist logic intel/*.json: better handle FULL testlist scripts/test_list.py: fix regex filtering logic scripts/test_list.py: use different types for include/exclude
scripts/test_list.py | 84 ++++++++++++++++++-------------- tests/intel/kms_test_config.json | 28 ++++++----- tests/intel/xe_test_config.json | 17 ++++--- 3 files changed, 73 insertions(+), 56 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/5 scripts/test_list.py: better parse list of tests
From: Mauro Carvalho Chehab <[email protected]>
The JSON config items for using a list of tests to fill a field is confusing:
- there are several fields defined under __properties__, but they're not grouped altogether;
- the names of such fields are badly defined;
- the "FULL" testlist is not really a list of all tests, as it currently exclude tests used on other platforms.
Rewrite the logic to group them into a dict inside a field, like:
{ "Field": {
"_properties_": {
"update-from-file": {
"type": "subtest-match", # or "regex", "regex-ignorecase"
"default-if-not-excluded": "not on testlists",
"append-value-if-not-excluded": "FULL",
"include": [
{ "BAT": "../ci-dir/driver-bat.testlist" },
{ "func1": "../ci-dir/driver-func1.testlist" },
],
"exclude": [
{ "Xe BAT, FULL": "../ci-dir/driver.blocklist" }
{ "func1, FULL": "../ci-dir/driver-func1.blocklist" }
]
}
}
}This will update all tests from ../ci-dir/driver-bat.testlist setting "Field" with "BAT", excluding the ones at ../ci-dir/driver.blocklist. Similarly, the "func1" value will be parsed.
The "FULL" testlist will contain all tests but the ones inside the
two exclude lists: ../ci-dir/driver.blocklist and ../ci-dir/driver-func1.blocklist.
--- scripts/test_list.py | 70 ++++++++++++++++++-------------- tests/intel/kms_test_config.json | 28 +++++++------ tests/intel/xe_test_config.json | 16 ++++---- 3 files changed, 63 insertions(+), 51 deletions(-)
scripts/test_list.py +39 -31
@@ -328,23 +328,25 @@ class TestList: del item["_properties_"]["level"] del item["_properties_"]["sublevel"] - # Read testlist files if any - if "include" in item["_properties_"]: - testlist = {} - for value in item["_properties_"]["include"]: - for name in value.keys(): - self.read_testlist(field, item, testlist, name, cfg_path + value[name]) + update = self.props[field]["_properties_"].get("update-from-file") + if update: + # Read testlist files if any + if "include" in update: + testlist = {} + for value in update["include"]: + for name in value.keys(): + self.read_testlist(update, field, item, testlist, name, cfg_path + value[name]) - item["_properties_"]["include"] = testlist + update["include"] = testlist - # Read blocklist files if any - if "exclude" in item["_properties_"]: - testlist = {} - for value in item["_properties_"]["exclude"]: - for name in value.keys(): - self.read_testlist(field, item, testlist, name, cfg_path + value[name]) + # Read blocklist files if any + if "exclude" in update: + testlist = {} + for value in update["exclude"]: + for name in value.keys(): + self.read_testlist(update, field, item, testlist, name, cfg_path + value[name]) - item["_properties_"]["exclude"] = testlist + update["exclude"] = testlist if "_properties_" in self.props: del self.props["_properties_"]
@@ -446,9 +448,9 @@ class TestList: self.__add_field(key, sublevel, hierarchy_level, field[key]) - def read_testlist(self, field, item, testlist, name, filename): + def read_testlist(self, update, field, item, testlist, name, filename): - match_type = item["_properties_"].get("match-type", "subtest-match") + match_type = update.get("type", "subtest-match") match_type_regex = set(["regex", "regex-ignorecase"]) match_type_str = set(["subtest-match"])
@@ -514,10 +516,13 @@ class TestList: if "_properties_" not in self.props[field]: continue - if "include" not in self.props[field]["_properties_"]: + update = self.props[field]["_properties_"].get("update-from-file") + if not update: continue - default_value = self.props[field]["_properties_"].get("default-testlist") + match_type = update.get("type", "subtest-match") + default_value = update.get("default--if-not-excluded") + append_value = update.get("append-value-if-not-excluded") testname = subtest_dict["_summary_"]
@@ -527,7 +532,11 @@ class TestList: else: values = set() - for names, regex_array in self.props[field]["_properties_"]["include"].items(): + if append_value: + include_names = set(re.split(",\s*", append_value)) + values.update(include_names) + + for names, regex_array in update.get("include", {}).items(): name = set(re.split(",\s*", names)) for regex in regex_array: if regex.fullmatch(testname):
@@ -535,20 +544,19 @@ class TestList: break # If test is at a global blocklist, ignore it - set_full_if_empty = True - if "exclude" in self.props[field]["_properties_"]: - for names, regex_array in self.props[field]["_properties_"]["exclude"].items(): - deleted_names = set(re.split(",\s*", names)) - for regex in regex_array: - if regex.fullmatch(testname): - if sorted(deleted_names) == sorted(values): - set_full_if_empty = False - values.discard(deleted_names) + set_default = True + for names, regex_array in update.get("exclude", {}).items(): + deleted_names = set(re.split(",\s*", names)) + for regex in regex_array: + if regex.fullmatch(testname): + if sorted(deleted_names) == sorted(values): + set_default = False + values -= deleted_names - if default_value and set_full_if_empty and not values: - values = set([default_value]) + if default_value and set_default and not values: + values.update([default_value]) - if values: + if values or self.props[field]["_properties_"].get("mandatory"): subtest_dict[field] = ", ".join(sorted(values)) def expand_subtest(self, fname, test_name, test, allow_inherit, with_lines = False, with_subtest_nr = False):
tests/intel/kms_test_config.json +15 -13
@@ -22,20 +22,22 @@ "Run type": { "_properties_": { "description": "Defines what category of testlist it belongs", - "default-testlist": "FULL", - "match-type": "subtest-match", - "include": [ - { "i915 BAT": "../intel-ci/fast-feedback.testlist" }, - { "i915 BAT chamelium": "../intel-ci/fast-feedback-chamelium-only.testlist" }, - { "i915 chamelium": "../intel-ci/chamelium-only.testlist" }, + "update-from-file": { + "append-value-if-not-excluded": "FULL", + "match-type": "subtest-match", + "include": [ + { "i915 BAT": "../intel-ci/fast-feedback.testlist" }, + { "i915 BAT chamelium": "../intel-ci/fast-feedback-chamelium-only.testlist" }, + { "i915 chamelium": "../intel-ci/chamelium-only.testlist" }, - { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" }, - { "Xe BAT chamelium": "../intel-ci/xe-fast-feedback-chamelium-only.testlist" } - ], - "exclude": [ - { "i915 BAT, i915 BAT chamelium, i915 chamelium": "../intel-ci/blacklist.txt" }, - { "Xe BAT, Xe BAT chamelium": "../intel-ci/xe.blocklist.txt" } - ] + { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" }, + { "Xe BAT chamelium": "../intel-ci/xe-fast-feedback-chamelium-only.testlist" } + ], + "exclude": [ + { "i915 BAT, i915 BAT chamelium, i915 chamelium, FULL": "../intel-ci/blacklist.txt" }, + { "Xe BAT, Xe BAT chamelium, FULL": "../intel-ci/xe.blocklist.txt" } + ] + } } } },
tests/intel/xe_test_config.json +9 -7
@@ -33,13 +33,15 @@ "mandatory": true, "description": "Defines what category of testlist it belongs", "default-testlist": "FULL", - "match-type": "subtest-match", - "include": [ - { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" } - ], - "exclude": [ - { "Xe BAT": "../intel-ci/xe.blocklist.txt" } - ], + "update-from-file": { + "type": "subtest-match", + "include": [ + { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" } + ], + "exclude": [ + { "Xe BAT": "../intel-ci/xe.blocklist.txt" } + ], + }, "order": [ "boot", "__all__",
Signature · 1 line
2.41.0
Re: [igt-dev] [PATCH i-g-t 1/5] scripts/test_list.py: better parse list of tests
Hi Mauro,
Quoted 31 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
The JSON config items for using a list of tests to fill a field is confusing:
- there are several fields defined under__properties__, but they're not grouped altogether;
- the names of such fields are badly defined;
- the "FULL" testlist is not really a list of all tests, as it currently exclude tests used on other platforms.Rewrite the logic to group them into a dict inside a field, like:
{ "Field": { "_properties_": { "update-from-file": { "type": "subtest-match", # or "regex", "regex-ignorecase" "default-if-not-excluded": "not on testlists", "append-value-if-not-excluded": "FULL", "include": [ { "BAT": "../ci-dir/driver-bat.testlist" }, { "func1": "../ci-dir/driver-func1.testlist" }, ], "exclude": [ { "Xe BAT, FULL": "../ci-dir/driver.blocklist" } { "func1, FULL": "../ci-dir/driver-func1.blocklist" } ] } } }
Quoted 8 lines
This will update all tests from ../ci-dir/driver-bat.testlist setting "Field" with "BAT", excluding the ones at ../ci-dir/driver.blocklist. Similarly, the "func1" value will be parsed.
The "FULL" testlist will contain all tests but the ones inside the
two exclude lists: ../ci-dir/driver.blocklist and ../ci-dir/driver-func1.blocklist.Signed-off-by Mauro Carvalho Chehab <[email protected]>
Quoted 193 lines
--- scripts/test_list.py | 70 ++++++++++++++++++-------------- tests/intel/kms_test_config.json | 28 +++++++------ tests/intel/xe_test_config.json | 16 ++++---- 3 files changed, 63 insertions(+), 51 deletions(-)scripts/test_list.py +39
-31@@ -328,23 +328,25 @@ class TestList: del item["_properties_"]["level"] del item["_properties_"]["sublevel"] - # Read testlist files if any - if "include" in item["_properties_"]: - testlist = {} - for value in item["_properties_"]["include"]: - for name in value.keys(): - self.read_testlist(field, item, testlist, name, cfg_path + value[name]) + update = self.props[field]["_properties_"].get("update-from-file") + if update: + # Read testlist files if any + if "include" in update: + testlist = {} + for value in update["include"]: + for name in value.keys(): + self.read_testlist(update, field, item, testlist, name, cfg_path + value[name]) - item["_properties_"]["include"] = testlist + update["include"] = testlist - # Read blocklist files if any - if "exclude" in item["_properties_"]: - testlist = {} - for value in item["_properties_"]["exclude"]: - for name in value.keys(): - self.read_testlist(field, item, testlist, name, cfg_path + value[name]) + # Read blocklist files if any + if "exclude" in update: + testlist = {} + for value in update["exclude"]: + for name in value.keys(): + self.read_testlist(update, field, item, testlist, name, cfg_path + value[name]) - item["_properties_"]["exclude"] = testlist + update["exclude"] = testlist if "_properties_" in self.props: del self.props["_properties_"]@@ -446,9 +448,9 @@ class TestList: self.__add_field(key, sublevel, hierarchy_level, field[key]) - def read_testlist(self, field, item, testlist, name, filename): + def read_testlist(self, update, field, item, testlist, name, filename): - match_type = item["_properties_"].get("match-type", "subtest-match") + match_type = update.get("type", "subtest-match") match_type_regex = set(["regex", "regex-ignorecase"]) match_type_str = set(["subtest-match"])@@ -514,10 +516,13 @@ class TestList: if "_properties_" not in self.props[field]: continue - if "include" not in self.props[field]["_properties_"]: + update = self.props[field]["_properties_"].get("update-from-file") + if not update: continue - default_value = self.props[field]["_properties_"].get("default-testlist") + match_type = update.get("type", "subtest-match") + default_value = update.get("default--if-not-excluded") + append_value = update.get("append-value-if-not-excluded") testname = subtest_dict["_summary_"]@@ -527,7 +532,11 @@ class TestList: else: values = set() - for names, regex_array in self.props[field]["_properties_"]["include"].items(): + if append_value: + include_names = set(re.split(",\s*", append_value)) + values.update(include_names) + + for names, regex_array in update.get("include", {}).items(): name = set(re.split(",\s*", names)) for regex in regex_array: if regex.fullmatch(testname):@@ -535,20 +544,19 @@ class TestList: break # If test is at a global blocklist, ignore it - set_full_if_empty = True - if "exclude" in self.props[field]["_properties_"]: - for names, regex_array in self.props[field]["_properties_"]["exclude"].items(): - deleted_names = set(re.split(",\s*", names)) - for regex in regex_array: - if regex.fullmatch(testname): - if sorted(deleted_names) == sorted(values): - set_full_if_empty = False - values.discard(deleted_names) + set_default = True + for names, regex_array in update.get("exclude", {}).items(): + deleted_names = set(re.split(",\s*", names)) + for regex in regex_array: + if regex.fullmatch(testname): + if sorted(deleted_names) == sorted(values): + set_default = False + values -= deleted_names - if default_value and set_full_if_empty and not values: - values = set([default_value]) + if default_value and set_default and not values: + values.update([default_value]) - if values: + if values or self.props[field]["_properties_"].get("mandatory"): subtest_dict[field] = ", ".join(sorted(values)) def expand_subtest(self, fname, test_name, test, allow_inherit, with_lines = False, with_subtest_nr = False):tests/intel/kms_test_config.json +15
-13@@ -22,20 +22,22 @@ "Run type": { "_properties_": { "description": "Defines what category of testlist it belongs", - "default-testlist": "FULL", - "match-type": "subtest-match", - "include": [ - { "i915 BAT": "../intel-ci/fast-feedback.testlist" }, - { "i915 BAT chamelium": "../intel-ci/fast-feedback-chamelium-only.testlist" }, - { "i915 chamelium": "../intel-ci/chamelium-only.testlist" }, + "update-from-file": { + "append-value-if-not-excluded": "FULL", + "match-type": "subtest-match", + "include": [ + { "i915 BAT": "../intel-ci/fast-feedback.testlist" }, + { "i915 BAT chamelium": "../intel-ci/fast-feedback-chamelium-only.testlist" }, + { "i915 chamelium": "../intel-ci/chamelium-only.testlist" }, - { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" }, - { "Xe BAT chamelium": "../intel-ci/xe-fast-feedback-chamelium-only.testlist" } - ], - "exclude": [ - { "i915 BAT, i915 BAT chamelium, i915 chamelium": "../intel-ci/blacklist.txt" }, - { "Xe BAT, Xe BAT chamelium": "../intel-ci/xe.blocklist.txt" } - ] + { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" }, + { "Xe BAT chamelium": "../intel-ci/xe-fast-feedback-chamelium-only.testlist" } + ], + "exclude": [ + { "i915 BAT, i915 BAT chamelium, i915 chamelium, FULL": "../intel-ci/blacklist.txt" }, + { "Xe BAT, Xe BAT chamelium, FULL": "../intel-ci/xe.blocklist.txt" } + ] + } } } },tests/intel/xe_test_config.json +9
-7@@ -33,13 +33,15 @@ "mandatory": true, "description": "Defines what category of testlist it belongs", "default-testlist": "FULL", - "match-type": "subtest-match", - "include": [ - { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" } - ], - "exclude": [ - { "Xe BAT": "../intel-ci/xe.blocklist.txt" } - ], + "update-from-file": { + "type": "subtest-match", + "include": [ + { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" } + ], + "exclude": [ + { "Xe BAT": "../intel-ci/xe.blocklist.txt" } + ], + }, "order": [ "boot", "__all__",Signature · 1 line
2.41.0
PATCH 2/5 scripts/test_list.py: speedup update testlist logic
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
Compile the expand regex to speed it up the parsing of test lists.
--- scripts/test_list.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
scripts/test_list.py +6 -4
@@ -512,6 +512,8 @@ class TestList: return False def update_testlist_field(self, subtest_dict): + expand = re.compile(",\s*") + for field in self.props.keys(): if "_properties_" not in self.props[field]: continue
@@ -528,16 +530,16 @@ class TestList: value = subtest_dict.get(field) if value: - values = set(re.split(",\s*", value)) + values = set(expand.split(value)) else: values = set() if append_value: - include_names = set(re.split(",\s*", append_value)) + include_names = set(expand.split(append_value)) values.update(include_names) for names, regex_array in update.get("include", {}).items(): - name = set(re.split(",\s*", names)) + name = set(expand.split(names)) for regex in regex_array: if regex.fullmatch(testname): values.update(name)
@@ -546,7 +548,7 @@ class TestList: # If test is at a global blocklist, ignore it set_default = True for names, regex_array in update.get("exclude", {}).items(): - deleted_names = set(re.split(",\s*", names)) + deleted_names = set(expand.split(names)) for regex in regex_array: if regex.fullmatch(testname): if sorted(deleted_names) == sorted(values):
Signature · 1 line
2.41.0
Re: [igt-dev] [PATCH i-g-t 2/5] scripts/test_list.py: speedup update testlist logic
Hi Mauro,
Quoted 6 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
Compile the expand regex to speed it up the parsing of test lists.
Signed-off-by Mauro Carvalho Chehab <[email protected]>
Quoted 49 lines
--- scripts/test_list.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)scripts/test_list.py +6
-4@@ -512,6 +512,8 @@ class TestList: return False def update_testlist_field(self, subtest_dict): + expand = re.compile(",\s*") + for field in self.props.keys(): if "_properties_" not in self.props[field]: continue@@ -528,16 +530,16 @@ class TestList: value = subtest_dict.get(field) if value: - values = set(re.split(",\s*", value)) + values = set(expand.split(value)) else: values = set() if append_value: - include_names = set(re.split(",\s*", append_value)) + include_names = set(expand.split(append_value)) values.update(include_names) for names, regex_array in update.get("include", {}).items(): - name = set(re.split(",\s*", names)) + name = set(expand.split(names)) for regex in regex_array: if regex.fullmatch(testname): values.update(name)@@ -546,7 +548,7 @@ class TestList: # If test is at a global blocklist, ignore it set_default = True for names, regex_array in update.get("exclude", {}).items(): - deleted_names = set(re.split(",\s*", names)) + deleted_names = set(expand.split(names)) for regex in regex_array: if regex.fullmatch(testname): if sorted(deleted_names) == sorted(values):Signature · 1 line
2.41.0
PATCH 3/5 intel/*.json: better handle FULL testlist
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
On KMS, the FULL testlist for i915 and Xe may be different, as they have different blocklists.
Rename FULL to Xe FULL or i915 FULL, accordingly.
--- tests/intel/kms_test_config.json | 6 +++--- tests/intel/xe_test_config.json | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-)
tests/intel/kms_test_config.json +3 -3
@@ -23,7 +23,7 @@ "_properties_": { "description": "Defines what category of testlist it belongs", "update-from-file": { - "append-value-if-not-excluded": "FULL", + "append-value-if-not-excluded": "Xe FULL, i915 FULL", "match-type": "subtest-match", "include": [ { "i915 BAT": "../intel-ci/fast-feedback.testlist" },
@@ -34,8 +34,8 @@ { "Xe BAT chamelium": "../intel-ci/xe-fast-feedback-chamelium-only.testlist" } ], "exclude": [ - { "i915 BAT, i915 BAT chamelium, i915 chamelium, FULL": "../intel-ci/blacklist.txt" }, - { "Xe BAT, Xe BAT chamelium, FULL": "../intel-ci/xe.blocklist.txt" } + { "i915 BAT, i915 BAT chamelium, i915 chamelium, i915 FULL": "../intel-ci/blacklist.txt" }, + { "Xe BAT, Xe BAT chamelium, Xe FULL": "../intel-ci/xe.blocklist.txt" } ] } }
tests/intel/xe_test_config.json +3 -2
@@ -35,12 +35,13 @@ "default-testlist": "FULL", "update-from-file": { "type": "subtest-match", + "append-value-if-not-excluded": "Xe FULL", "include": [ { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" } ], "exclude": [ - { "Xe BAT": "../intel-ci/xe.blocklist.txt" } - ], + { "Xe BAT, Xe FULL": "../intel-ci/xe.blocklist.txt" } + ] }, "order": [ "boot",
Signature · 1 line
2.41.0
Re: [igt-dev] [PATCH i-g-t 3/5] intel/*.json: better handle FULL testlist
Hi Mauro,
Quoted 8 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
On KMS, the FULL testlist for i915 and Xe may be different, as they have different blocklists.
Rename FULL to Xe FULL or i915 FULL, accordingly.
Signed-off-by Mauro Carvalho Chehab <[email protected]>
Quoted 52 lines
--- tests/intel/kms_test_config.json | 6 +++--- tests/intel/xe_test_config.json | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-)tests/intel/kms_test_config.json +3
-3@@ -23,7 +23,7 @@ "_properties_": { "description": "Defines what category of testlist it belongs", "update-from-file": { - "append-value-if-not-excluded": "FULL", + "append-value-if-not-excluded": "Xe FULL, i915 FULL", "match-type": "subtest-match", "include": [ { "i915 BAT": "../intel-ci/fast-feedback.testlist" },@@ -34,8 +34,8 @@ { "Xe BAT chamelium": "../intel-ci/xe-fast-feedback-chamelium-only.testlist" } ], "exclude": [ - { "i915 BAT, i915 BAT chamelium, i915 chamelium, FULL": "../intel-ci/blacklist.txt" }, - { "Xe BAT, Xe BAT chamelium, FULL": "../intel-ci/xe.blocklist.txt" } + { "i915 BAT, i915 BAT chamelium, i915 chamelium, i915 FULL": "../intel-ci/blacklist.txt" }, + { "Xe BAT, Xe BAT chamelium, Xe FULL": "../intel-ci/xe.blocklist.txt" } ] } }tests/intel/xe_test_config.json +3
-2@@ -35,12 +35,13 @@ "default-testlist": "FULL", "update-from-file": { "type": "subtest-match", + "append-value-if-not-excluded": "Xe FULL", "include": [ { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" } ], "exclude": [ - { "Xe BAT": "../intel-ci/xe.blocklist.txt" } - ], + { "Xe BAT, Xe FULL": "../intel-ci/xe.blocklist.txt" } + ] }, "order": [ "boot",Signature · 1 line
2.41.0
PATCH 4/5 scripts/test_list.py: fix regex filtering logic
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
Normal regular expressions don't seek from the beginning. However, Python re.match is actually an alias for:
/^<regex/
Seeking from the beginning. Fix it by using, instead, re.search(), which handles regular expressions the standard way.
--- scripts/test_list.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/test_list.py +2 -2
@@ -500,10 +500,10 @@ class TestList: for filter_field, regex in self.filters.items(): if filter_field in subtest: - if not regex.match(subtest[filter_field]): + if not regex.search(subtest[filter_field]): return True elif filter_field in test: - if not regex.match(test[filter_field]): + if not regex.search(test[filter_field]): return True else: return field_not_found_value
Signature · 1 line
2.41.0
Re: [igt-dev] [PATCH i-g-t 4/5] scripts/test_list.py: fix regex filtering logic
Hi Mauro,
Quoted 5 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
Normal regular expressions don't seek from the beginning. However, Python re.match is actually an alias for:
Quoted 7 lines
/^<regex/Seeking from the beginning. Fix it by using, instead,
re.search(), which handles regular expressions the standard way.Signed-off-by Mauro Carvalho Chehab <[email protected]>
Quoted 24 lines
--- scripts/test_list.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)scripts/test_list.py +2
-2@@ -500,10 +500,10 @@ class TestList: for filter_field, regex in self.filters.items(): if filter_field in subtest: - if not regex.match(subtest[filter_field]): + if not regex.search(subtest[filter_field]): return True elif filter_field in test: - if not regex.match(test[filter_field]): + if not regex.search(test[filter_field]): return True else: return field_not_found_valueSignature · 1 line
2.41.0
PATCH 5/5 scripts/test_list.py: use different types for include/exclude
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
The type of match for include/exclude may be different. So, split it into two separate arguments.
--- scripts/test_list.py | 12 +++++++----- tests/intel/kms_test_config.json | 2 +- tests/intel/xe_test_config.json | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-)
scripts/test_list.py +7 -5
@@ -335,7 +335,9 @@ class TestList: testlist = {} for value in update["include"]: for name in value.keys(): - self.read_testlist(update, field, item, testlist, name, cfg_path + value[name]) + match_type = update.get("include-type", "subtest-match") + + self.read_testlist(update, match_type, field, item, testlist, name, cfg_path + value[name]) update["include"] = testlist
@@ -344,7 +346,9 @@ class TestList: testlist = {} for value in update["exclude"]: for name in value.keys(): - self.read_testlist(update, field, item, testlist, name, cfg_path + value[name]) + match_type = update.get("exclude-type", "subtest-match") + + self.read_testlist(update, match_type, field, item, testlist, name, cfg_path + value[name]) update["exclude"] = testlist
@@ -448,9 +452,7 @@ class TestList: self.__add_field(key, sublevel, hierarchy_level, field[key]) - def read_testlist(self, update, field, item, testlist, name, filename): - - match_type = update.get("type", "subtest-match") + def read_testlist(self, update, match_type, field, item, testlist, name, filename): match_type_regex = set(["regex", "regex-ignorecase"]) match_type_str = set(["subtest-match"])
tests/intel/kms_test_config.json +1 -1
@@ -24,7 +24,7 @@ "description": "Defines what category of testlist it belongs", "update-from-file": { "append-value-if-not-excluded": "Xe FULL, i915 FULL", - "match-type": "subtest-match", + "exclude-type": "regex-ignorecase", "include": [ { "i915 BAT": "../intel-ci/fast-feedback.testlist" }, { "i915 BAT chamelium": "../intel-ci/fast-feedback-chamelium-only.testlist" },
tests/intel/xe_test_config.json +1 -1
@@ -34,7 +34,7 @@ "description": "Defines what category of testlist it belongs", "default-testlist": "FULL", "update-from-file": { - "type": "subtest-match", + "exclude-type": "regex-ignorecase", "append-value-if-not-excluded": "Xe FULL", "include": [ { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" }
Signature · 1 line
2.41.0
Re: [igt-dev] [PATCH i-g-t 5/5] scripts/test_list.py: use different types for include/exclude
Hi Mauro,
Quoted 6 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
The type of match for
include/excludemay be different. So, split it into two separate arguments.Signed-off-by Mauro Carvalho Chehab <[email protected]>
Quoted 72 lines
--- scripts/test_list.py | 12 +++++++----- tests/intel/kms_test_config.json | 2 +- tests/intel/xe_test_config.json | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-)scripts/test_list.py +7
-5@@ -335,7 +335,9 @@ class TestList: testlist = {} for value in update["include"]: for name in value.keys(): - self.read_testlist(update, field, item, testlist, name, cfg_path + value[name]) + match_type = update.get("include-type", "subtest-match") + + self.read_testlist(update, match_type, field, item, testlist, name, cfg_path + value[name]) update["include"] = testlist@@ -344,7 +346,9 @@ class TestList: testlist = {} for value in update["exclude"]: for name in value.keys(): - self.read_testlist(update, field, item, testlist, name, cfg_path + value[name]) + match_type = update.get("exclude-type", "subtest-match") + + self.read_testlist(update, match_type, field, item, testlist, name, cfg_path + value[name]) update["exclude"] = testlist@@ -448,9 +452,7 @@ class TestList: self.__add_field(key, sublevel, hierarchy_level, field[key]) - def read_testlist(self, update, field, item, testlist, name, filename): - - match_type = update.get("type", "subtest-match") + def read_testlist(self, update, match_type, field, item, testlist, name, filename): match_type_regex = set(["regex", "regex-ignorecase"]) match_type_str = set(["subtest-match"])tests/intel/kms_test_config.json +1
-1@@ -24,7 +24,7 @@ "description": "Defines what category of testlist it belongs", "update-from-file": { "append-value-if-not-excluded": "Xe FULL, i915 FULL", - "match-type": "subtest-match", + "exclude-type": "regex-ignorecase", "include": [ { "i915 BAT": "../intel-ci/fast-feedback.testlist" }, { "i915 BAT chamelium": "../intel-ci/fast-feedback-chamelium-only.testlist" },tests/intel/xe_test_config.json +1
-1@@ -34,7 +34,7 @@ "description": "Defines what category of testlist it belongs", "default-testlist": "FULL", "update-from-file": { - "type": "subtest-match", + "exclude-type": "regex-ignorecase", "append-value-if-not-excluded": "Xe FULL", "include": [ { "Xe BAT": "../intel-ci/xe-fast-feedback.testlist" }Signature · 1 line
2.41.0