From 31bfa4b90711310425efe45e8999080ff19d7b76 Mon Sep 17 00:00:00 2001 From: Vyacheslav Yurkov Date: Thu, 31 Aug 2023 20:41:31 +0200 Subject: [PATCH] test: helper: Print stdout on timeout Signed-off-by: Vyacheslav Yurkov --- test/helper.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/helper.py b/test/helper.py index b067d6e3..91a4773b 100644 --- a/test/helper.py +++ b/test/helper.py @@ -66,8 +66,14 @@ def run(command, *, timeout=30): logger = logger_from_command(command) logger.info('running: %s', command) - proc = subprocess.run(shlex.split(command), capture_output=True, text=True, check=False, - timeout=timeout) + try: + proc = subprocess.run(shlex.split(command), capture_output=True, text=True, check=False, + timeout=timeout) + except subprocess.TimeoutExpired as e: + for line in e.output.splitlines(): + if line: + logger.info('stdout: %s', line) + raise for line in proc.stdout.splitlines(): if line: