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 v2 4/4] scripts/test_list.py: produce alphabetically ordered testlists
Date: Tue, 20 Jun 2023 10:55:22 +0200	[thread overview]
Message-ID: <20230620085522.3984101-5-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20230620085522.3984101-1-mauro.chehab@linux.intel.com>

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

Before start handling the subtest arrays, order it, in order
it alphabetically.

This should produce a better ordered testlist.

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

diff --git a/scripts/test_list.py b/scripts/test_list.py
index 76fdcf3dbb4f..a55d2977c7c3 100755
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -838,6 +838,7 @@ class TestList:
                     if "order" in self.props[sort_field]["_properties_"]:
                         order = self.props[sort_field]["_properties_"]["order"]
 
+        subtest_array = []
         for test in sorted(self.doc.keys()):
             fname = self.doc[test]["File"]
 
@@ -845,44 +846,46 @@ class TestList:
             test_name = re.sub(r'\.[ch]', '', test_name)
             test_name = "igt@" + test_name
 
-            subtest_array = self.expand_subtest(fname, test_name, test, True)
+            subtest_array += self.expand_subtest(fname, test_name, test, True)
 
-            for subtest in subtest_array:
-                if self.__filter_subtest(test, subtest, True):
-                    continue
+        subtest_array.sort(key = lambda x : x.get('Summary'))
 
-                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]
+        for subtest in subtest_array:
+            if self.__filter_subtest(test, subtest, True):
+                continue
 
-                            for test_elem in test_list:
-                                if test_elem not in subtests:
-                                    subtests[test_elem] = []
-                                if order:
-                                    subtests[test_elem].append((subtest["Summary"], test_list))
-                                else:
-                                    subtests[test_elem].append(subtest["Summary"])
-                        else:
-                            if subtest[sort_field] not in subtests:
-                                subtests[subtest[sort_field]] = []
-                                if order:
-                                    subtests[test_elem].append((subtest["Summary"], [subtest[sort_field]]))
-                                else:
-                                    subtests[subtest[sort_field]].append(subtest["Summary"])
+            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]
+
+                        for test_elem in test_list:
+                            if test_elem not in subtests:
+                                subtests[test_elem] = []
+                            if order:
+                                subtests[test_elem].append((subtest["Summary"], test_list))
+                            else:
+                                subtests[test_elem].append(subtest["Summary"])
                     else:
-                        if order:
-                            subtests[test_elem].append((subtest["Summary"], [subtest[sort_field]]))
-                        else:
-                            subtests[""].append(subtest["Summary"])
-
+                        if subtest[sort_field] not in subtests:
+                            subtests[subtest[sort_field]] = []
+                            if order:
+                                subtests[test_elem].append((subtest["Summary"], [subtest[sort_field]]))
+                            else:
+                                subtests[subtest[sort_field]].append(subtest["Summary"])
                 else:
                     if order:
                         subtests[test_elem].append((subtest["Summary"], [subtest[sort_field]]))
                     else:
                         subtests[""].append(subtest["Summary"])
 
+            else:
+                if order:
+                    subtests[test_elem].append((subtest["Summary"], [subtest[sort_field]]))
+                else:
+                    subtests[""].append(subtest["Summary"])
+
         if order:
             for group, tests in subtests.items():
                 prefix_tests = []
-- 
2.40.1

  parent reply	other threads:[~2023-06-20  8:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20  8:55 [igt-dev] [PATCH i-g-t v2 0/4] generate an ordered testlist for Xe driver Mauro Carvalho Chehab
2023-06-20  8:55 ` [igt-dev] [PATCH i-g-t v2 1/4] scripts/test_list.py: add support for ordering testlists Mauro Carvalho Chehab
2023-06-21 16:44   ` Kamil Konieczny
2023-06-20  8:55 ` [igt-dev] [PATCH i-g-t v2 2/4] xe_test_config.json: add an order for run type Mauro Carvalho Chehab
2023-06-21 16:45   ` Kamil Konieczny
2023-06-20  8:55 ` [igt-dev] [PATCH i-g-t v2 3/4] tests/xe: add run type fields to order testlists Mauro Carvalho Chehab
2023-06-21 16:46   ` Kamil Konieczny
2023-06-20  8:55 ` Mauro Carvalho Chehab [this message]
2023-06-21 16:48   ` [igt-dev] [PATCH i-g-t v2 4/4] scripts/test_list.py: produce alphabetically ordered testlists Kamil Konieczny
2023-06-20 10:54 ` [igt-dev] ✓ Fi.CI.BAT: success for generate an ordered testlist for Xe driver (rev2) Patchwork
2023-06-20 15:43 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20230620085522.3984101-5-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