[igt-dev] [PATCH i-g-t] scripts/test_list.py: add support to exclude files

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Fri May 5 06:19:56 UTC 2023


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

Specially when using wildcards, it is interesting to have a
way to exclude some files. This is needed to support some kms
helper functions that, instead of being part of the IGT library,
are stored inside the tests sub-directories.

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

diff --git a/scripts/test_list.py b/scripts/test_list.py
index 2a53d782a4a0..c9dbf144da1e 100755
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -208,6 +208,7 @@ class TestList:
 
     {
         "files": [ "tests/driver/*.c" ],
+        "exclude_files": [ "tests/driver/*-helper.c" ],
         "fields": {
             "Category": {
                 "Sub-category": {
@@ -302,10 +303,19 @@ class TestList:
             has_implemented = False
             if not self.filenames:
                 self.filenames = []
+                exclude_files = []
                 files = self.config["files"]
+                exclude_file_glob = self.config.get("exclude_files", [])
+                for cfg_file in exclude_file_glob:
+                    cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
+                    for fname in glob.glob(cfg_file):
+                        exclude_files.append(fname)
+
                 for cfg_file in files:
                     cfg_file = os.path.realpath(os.path.dirname(config_fname)) + "/" + cfg_file
                     for fname in glob.glob(cfg_file):
+                        if fname in exclude_files:
+                            continue
                         self.filenames.append(fname)
                         has_implemented = True
             else:
-- 
2.40.1



More information about the igt-dev mailing list