Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 2/5] scripts/test_list.py: speedup update testlist logic
Date: Thu,  2 Nov 2023 14:06:24 +0100	[thread overview]
Message-ID: <20231102130957.307435-3-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20231102130957.307435-1-mauro.chehab@linux.intel.com>

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

Compile the expand regex to speed it up the parsing of
test lists.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 scripts/test_list.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/scripts/test_list.py b/scripts/test_list.py
index bd609feeb1f1..252fda576c92 100644
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -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):
-- 
2.41.0

  parent reply	other threads:[~2023-11-02 13:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 13:06 [igt-dev] [PATCH i-g-t 0/5] Fix a series of issues while handling testlist Mauro Carvalho Chehab
2023-11-02 13:06 ` [igt-dev] [PATCH i-g-t 1/5] scripts/test_list.py: better parse list of tests Mauro Carvalho Chehab
2023-11-02 14:57   ` Kamil Konieczny
2023-11-02 13:06 ` Mauro Carvalho Chehab [this message]
2023-11-02 14:37   ` [igt-dev] [PATCH i-g-t 2/5] scripts/test_list.py: speedup update testlist logic Kamil Konieczny
2023-11-02 13:06 ` [igt-dev] [PATCH i-g-t 3/5] intel/*.json: better handle FULL testlist Mauro Carvalho Chehab
2023-11-02 14:39   ` Kamil Konieczny
2023-11-02 13:06 ` [igt-dev] [PATCH i-g-t 4/5] scripts/test_list.py: fix regex filtering logic Mauro Carvalho Chehab
2023-11-02 14:49   ` Kamil Konieczny
2023-11-02 13:06 ` [igt-dev] [PATCH i-g-t 5/5] scripts/test_list.py: use different types for include/exclude Mauro Carvalho Chehab
2023-11-02 14:52   ` Kamil Konieczny

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=20231102130957.307435-3-mauro.chehab@linux.intel.com \
    --to=mauro.chehab@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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