[igt-dev] [PATCH i-g-t 7/7] scripts/igt_doc.py: add error handler for subprocess
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Wed Feb 22 07:31:28 UTC 2023
On Tue, Feb 21, 2023 at 09:35:41AM +0100, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>
>
> Handle exceptions when trying to excecute IGT runner.
Type - excecute.
Rest is ok. Fix nit and:
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
--
Zbigniew
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab at 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
>
More information about the igt-dev
mailing list