[igt-dev] [PATCH i-g-t] scripts/igt_doc.py: improve check tool to look at the right files

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Tue Mar 28 13:54:34 UTC 2023


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

We can't rely only at the prefix, as a test list could include files
from other places.

So, add a logic to look into the files listed at the configuration
file.

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

diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
index 92d925c451ed..f52d458bec60 100755
--- a/scripts/igt_doc.py
+++ b/scripts/igt_doc.py
@@ -757,11 +757,18 @@ class TestList:
 
         """Compare documented subtests with the IGT test list"""
 
+        test_prefixes = {}
+
+        for cfg_file in self.config["files"]:
+            prefix = "^igt@" + re.sub(r"(.*/)?(.*)\.[ch]",r"\2", cfg_file)
+            test_prefixes[prefix] = 1
+
         doc_subtests = sorted(self.get_subtests()[""])
 
         for i in range(0, len(doc_subtests)): # pylint: disable=C0200
             doc_subtests[i] = re.sub(r'\<[^\>]+\>', r'\\d+', doc_subtests[i])
 
+        # Just to optimize the runner
         test_prefix = os.path.commonprefix(doc_subtests)
 
         # Get a list of tests from
@@ -775,7 +782,17 @@ class TestList:
             print("Error:", sub_err)
             sys.exit(1)
 
-        run_subtests = sorted(result.stdout.splitlines())
+        run_subtests = []
+        for subtest in result.stdout.splitlines():
+            found = 0
+            for prefix in test_prefixes.keys():
+                if re.match(prefix, subtest):
+                    found = 1
+                    break
+            if found:
+                run_subtests.append(subtest)
+
+        run_subtests = sorted(run_subtests)
 
         # Compare arrays
 
-- 
2.39.2



More information about the igt-dev mailing list