[igt-dev] [PATCH i-g-t 1/5] scripts/test_list.py: better expand subtests

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Tue Nov 28 10:48:56 UTC 2023


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

Use a better regex when splitting subtests, as used when reading
testlists.

Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
---
 scripts/test_list.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/test_list.py b/scripts/test_list.py
index 13f788783483..5ff2b18c2dd8 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -1010,6 +1010,9 @@ class TestList:
 
         order = None
 
+        if expand:
+            expand = re.compile(expand)
+
         if sort_field:
             if sort_field.lower() not in self.field_list:
                 sys.exit(f"Field '{sort_field}' is not defined")
@@ -1039,8 +1042,7 @@ class TestList:
             if sort_field:
                 if sort_field in subtest:
                     if expand:
-                        test_list = subtest[sort_field].split(expand)
-                        test_list = [s.strip() for s in test_list]
+                        test_list = expand.split(subtest[sort_field])
 
                         for test_elem in test_list:
                             if test_elem not in subtests:
@@ -1407,7 +1409,7 @@ class TestList:
 
 
         # NOTE: currently, it uses a comma for multi-value delimitter
-        test_subtests = self.get_subtests(sort_field, ",", with_order = True)
+        test_subtests = self.get_subtests(sort_field, ",\s*", with_order = True)
 
         if not os.path.exists(directory):
             os.makedirs(directory)
-- 
2.42.0



More information about the igt-dev mailing list