From 1d13369d906bb9e201817a76aac164df825bc736 Mon Sep 17 00:00:00 2001 From: "Thing-han, Lim" <15379156+potsrevennil@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:03:44 +0800 Subject: [PATCH] fail the tests script if running the binary failed Signed-off-by: Thing-han, Lim <15379156+potsrevennil@users.noreply.github.com> --- scripts/tests | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/tests b/scripts/tests index 7c3671566..a69599082 100755 --- a/scripts/tests +++ b/scripts/tests @@ -42,7 +42,7 @@ def base_run(bin, force_qemu, verbose, extra_make_args=[]): stdout=subprocess.DEVNULL if not verbose else None, ) if p.returncode != 0: - logging.error("make failed") + logging.error(f"make failed: {p.returncode}") sys.exit(1) result = subprocess.run( @@ -51,6 +51,12 @@ def base_run(bin, force_qemu, verbose, extra_make_args=[]): universal_newlines=False, ) + if result.returncode != 0: + logging.error( + f"Emulating {bin} failed: {result.returncode} {result.stderr.decode()}" + ) + sys.exit(1) + else: logging.debug(f"Running {bin} natively") @@ -63,7 +69,7 @@ def base_run(bin, force_qemu, verbose, extra_make_args=[]): ) if p.returncode != 0: - logging.error("make failed") + logging.error(f"make failed: {p.returncode}") sys.exit(1) result = subprocess.run( @@ -72,6 +78,12 @@ def base_run(bin, force_qemu, verbose, extra_make_args=[]): universal_newlines=False, ) + if result.returncode != 0: + logging.error( + f"Running {bin} natively failed: {result.returncode} {result.stderr.decode()}" + ) + sys.exit(1) + return result.stdout