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 7/7] scripts/igt_doc.py: add error handler for subprocess
Date: Tue, 21 Feb 2023 09:35:41 +0100	[thread overview]
Message-ID: <20230221083541.1079643-8-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20230221083541.1079643-1-mauro.chehab@linux.intel.com>

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

Handle exceptions when trying to excecute IGT runner.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 scripts/igt_doc.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
index 9280be743524..c6b0ed30fcbc 100755
--- a/scripts/igt_doc.py
+++ b/scripts/igt_doc.py
@@ -697,14 +697,15 @@ class TestList:
             doc_subtests[i] = re.sub(r'\<[^\>]+\>', r'\\d+', doc_subtests[i])
 
         # Get a list of tests from
-        result = subprocess.run([ f"{IGT_BUILD_PATH}/{IGT_RUNNER}",  # pylint: disable=W1510
-                                "-L", "-t",  self.min_test_prefix,
-                                f"{IGT_BUILD_PATH}/tests"],
-                                capture_output = True, text = True)
-        if result.returncode:
-            print( result.stdout)
-            print("Error:", result.stderr)
-            sys.exit(result.returncode)
+        try:
+            result = subprocess.run([ f"{IGT_BUILD_PATH}/{IGT_RUNNER}",
+                                    "-L", "-t",  self.min_test_prefix,
+                                    f"{IGT_BUILD_PATH}/tests"], check = True,
+                                    capture_output = True, text = True)
+        except subprocess.CalledProcessError as sub_err:
+            print(sub_err.stderr)
+            print("Error:", sub_err)
+            sys.exit(1)
 
         run_subtests = sorted(result.stdout.splitlines())
 
-- 
2.39.2

      parent reply	other threads:[~2023-02-21  8:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21  8:35 [igt-dev] [PATCH i-g-t 0/7] Improve scripts/igt_doc.py script Mauro Carvalho Chehab
2023-02-21  8:35 ` [igt-dev] [PATCH i-g-t 1/7] scripts/igt_doc.py: beautify its code Mauro Carvalho Chehab
2023-02-21  8:35 ` [igt-dev] [PATCH i-g-t 2/7] scripts/igt_doc.py: add JSON file output Mauro Carvalho Chehab
2023-02-21  8:35 ` [igt-dev] [PATCH i-g-t 3/7] scripts/igt_doc.py: dynamically create fields array from a JSON file Mauro Carvalho Chehab
2023-02-21  8:35 ` [igt-dev] [PATCH i-g-t 4/7] scripts/igt_doc.py: add support to specify numeric values Mauro Carvalho Chehab
2023-02-21  8:35 ` [igt-dev] [PATCH i-g-t 5/7] scripts/igt_doc.py: add support to produce hierarchical output Mauro Carvalho Chehab
2023-02-21  8:35 ` [igt-dev] [PATCH i-g-t 6/7] scripts/igt_doc.py: improve --show-subtests logic Mauro Carvalho Chehab
2023-02-21  8:35 ` Mauro Carvalho Chehab [this message]

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=20230221083541.1079643-8-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