[PATCH i-g-t v2 4/4] scripts/igt_doc.py: fix intelci testlist join logic

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Thu Feb 22 11:45:28 UTC 2024


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

Joining testlists shall take into account default values for GPUs
that are defined only on some JSON config files.

Add a logic to propagate such values.

Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
---
 scripts/igt_doc.py | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
index 2417081b80be..295589c002c6 100755
--- a/scripts/igt_doc.py
+++ b/scripts/igt_doc.py
@@ -190,10 +190,10 @@ class IntelciTestlist:
     def __init__(self):
         self.testlists = {}
         self.gpu_set = set()
+        self.default_gpu = "default"
 
     def add(self, testlist, gpu_set):
-        self.gpu_set.update(gpu_set)
-
+        # Handle GPUs found at the set to be added
         for driver, gpus in testlist.items():
             if driver not in self.testlists:
                 self.testlists[driver] = {}
@@ -208,6 +208,26 @@ class IntelciTestlist:
 
                     self.testlists[driver][gpu][run_type].update(testlist[driver][gpu][run_type])
 
+        # Apply default values to gpus that aren't in common
+        if self.gpu_set:
+            not_intersecting_gpus = self.gpu_set.symmetric_difference(gpu_set)
+
+            for driver in self.testlists.keys():
+                for gpu in not_intersecting_gpus:
+                    if gpu not in self.testlists[driver]:
+                        self.testlists[driver][gpu] = {}
+
+                    for run_type in self.testlists[driver][gpu].keys():
+                        if run_type not in self.testlists[driver][self.default_gpu]:
+                            continue
+
+                        default_list = self.testlists[driver][self.default_gpu][run_type]
+
+                        self.testlists[driver][gpu][run_type].update(default_list)
+
+        self.gpu_set.update(gpu_set)
+
+
     def write(self, directory):
         '''Create testlist directory (if needed) and files'''
 
-- 
2.43.2



More information about the igt-dev mailing list