Skip to content

Commit

Permalink
fail the tests script if running the binary failed
Browse files Browse the repository at this point in the history
Signed-off-by: Thing-han, Lim <[email protected]>
  • Loading branch information
potsrevennil committed Jun 20, 2024
1 parent 129808c commit 1d13369
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions scripts/tests
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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")

Expand All @@ -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(
Expand All @@ -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


Expand Down

0 comments on commit 1d13369

Please sign in to comment.