[igt-dev] [PATCH i-g-t v3 3/4] scripts/test_list.py: use a compiled regex for check
Mauro Carvalho Chehab
mauro.chehab at linux.intel.com
Thu Apr 13 09:21:58 UTC 2023
From: Mauro Carvalho Chehab <mchehab at kernel.org>
Speed up even further the logic for --check-testlist by
pre-compiling the regex that will be used to validate the
results.
Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
---
scripts/test_list.py | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/scripts/test_list.py b/scripts/test_list.py
index 287351e717b3..96d8883db122 100755
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -820,10 +820,18 @@ class TestList:
run_missing = []
doc_uneeded = []
+ test_regex = r""
+ for doc_test in doc_subtests:
+ if test_regex != r"":
+ test_regex += r"|"
+ test_regex += r'^' + doc_test + r'$'
+
+ test_regex = re.compile(test_regex)
+
for doc_test in doc_subtests:
found = False
for run_test in run_subtests:
- if re.match(r'^' + doc_test + r'$', run_test):
+ if re.match(test_regex, run_test):
found = True
break
if not found:
@@ -831,10 +839,8 @@ class TestList:
for run_test in run_subtests:
found = False
- for doc_test in doc_subtests:
- if re.match(r'^' + doc_test + r'$', run_test):
- found = True
- break
+ if re.match(test_regex, run_test):
+ found = True
if not found:
run_missing.append(run_test)
--
2.39.2
More information about the igt-dev
mailing list