[igt-dev] [PATCH i-g-t 4/5] scripts/test_list.py: fix regex filtering logic

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Thu Nov 2 13:06:26 UTC 2023


From: Mauro Carvalho Chehab <mchehab at kernel.org>

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.

Signed-off-by: Mauro Carvalho Chehab <mchehab at 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 252fda576c92..a7758d5ecb91 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -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
-- 
2.41.0



More information about the igt-dev mailing list