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 5/6] scripts/test_list.py: add a method to return an spreadsheet-like array
Date: Mon, 22 May 2023 16:22:00 +0200	[thread overview]
Message-ID: <20230522142201.2527800-6-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20230522142201.2527800-1-mauro.chehab@linux.intel.com>

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

It can be useful to convert the contents of the tests into a
spreadsheet. Add a method for doing that at the TestList class.

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

diff --git a/scripts/test_list.py b/scripts/test_list.py
index 654ccd8692d4..58a2457d6e77 100755
--- a/scripts/test_list.py
+++ b/scripts/test_list.py
@@ -651,6 +651,48 @@ class TestList:
             handler.close()
             sys.stdout = original_stdout
 
+    def get_spreadsheet(self):
+
+        """
+        Return a bidimentional array with the test contents.
+
+        Its output is similar to a spreadsheet, so it can be used by a
+        separate python file that would create a workbook's sheet.
+        """
+
+        sheet = []
+        row = 0
+        sheet.append([])
+        sheet[row].append('Test name')
+
+        subtest_dict = self.expand_dictionary(True)
+
+                # Identify the sort order for the fields
+        fields_order = []
+        fields = sorted(self.props.items(), key = _sort_per_level)
+        for item in fields:
+            fields_order.append(item[0])
+            sheet[row].append(item[0])
+
+        # Receives a flat subtest dictionary, with wildcards expanded
+        subtest_dict = self.expand_dictionary(True)
+
+        subtests = sorted(subtest_dict.items(),
+                          key = lambda x: _sort_using_array(x, fields_order))
+
+        for subtest, fields in subtests:
+            row += 1
+            sheet.append([])
+
+            sheet[row].append(subtest)
+
+            for field in fields_order:
+                if field in fields:
+                    sheet[row].append(fields[field])
+                else:
+                    sheet[row].append('')
+        return sheet
+
     def print_nested_rest(self, filename):
 
         """Print tests and subtests ordered by tests"""
-- 
2.40.1

  parent reply	other threads:[~2023-05-22 14:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 14:21 [igt-dev] [PATCH i-g-t 0/6] Add a method to create spreadsheets Mauro Carvalho Chehab
2023-05-22 14:21 ` [igt-dev] [PATCH i-g-t 1/6] scripts/test_list.py: add support to define a name at the config file Mauro Carvalho Chehab
2023-05-26 11:56   ` Kamil Konieczny
2023-05-22 14:21 ` [igt-dev] [PATCH i-g-t 2/6] kms_test_config.json: add a name for the KMS Intel testset Mauro Carvalho Chehab
2023-05-26 11:57   ` Kamil Konieczny
2023-05-22 14:21 ` [igt-dev] [PATCH i-g-t 3/6] i915_test_config.json: add a driver name Mauro Carvalho Chehab
2023-05-26 11:57   ` Kamil Konieczny
2023-05-22 14:21 ` [igt-dev] [PATCH i-g-t 4/6] xe_test_config.json: " Mauro Carvalho Chehab
2023-05-26 11:59   ` Kamil Konieczny
2023-05-22 14:22 ` Mauro Carvalho Chehab [this message]
2023-05-26 12:18   ` [igt-dev] [PATCH i-g-t 5/6] scripts/test_list.py: add a method to return an spreadsheet-like array Kamil Konieczny
2023-05-22 14:22 ` [igt-dev] [PATCH i-g-t 6/6] scripts/doc_to_xls.py: add an script to generate a doc spreadsheet Mauro Carvalho Chehab
2023-05-26 12:20   ` Kamil Konieczny
2023-05-26 13:37     ` Mauro Carvalho Chehab
2023-05-22 17:03 ` [igt-dev] ✓ Fi.CI.BAT: success for Add a method to create spreadsheets Patchwork
2023-05-23  0:23 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-05-26 14:33 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add a method to create spreadsheets (rev2) 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=20230522142201.2527800-6-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