From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 902EE10E069 for ; Fri, 10 Mar 2023 19:42:01 +0000 (UTC) From: =?UTF-8?q?Zbigniew=20Kempczy=C5=84ski?= To: igt-dev@lists.freedesktop.org Date: Fri, 10 Mar 2023 20:41:12 +0100 Message-Id: <20230310194125.14781-7-zbigniew.kempczynski@intel.com> In-Reply-To: <20230310194125.14781-1-zbigniew.kempczynski@intel.com> References: <20230310194125.14781-1-zbigniew.kempczynski@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t v2 06/19] scripts/igt_doc.py: add error handler for subprocess List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: From: Mauro Carvalho Chehab Handle exceptions when trying to excecute IGT runner. Signed-off-by: Mauro Carvalho Chehab --- 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 712e22c9d3..c06c6e4eae 100755 --- a/scripts/igt_doc.py +++ b/scripts/igt_doc.py @@ -754,14 +754,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.34.1