From 85bf6634783828083f3e36313640053b86841f1c Mon Sep 17 00:00:00 2001 From: Al Semjonovs Date: Thu, 15 Sep 2022 09:32:26 -0600 Subject: zephyr: Check if rdb tool is available before trying to upload Check if rdb tool is available before trying to upload test results. BUG=None BRANCH=NONE TEST=in chroot ./twister -T zephyr/test outside chroot (no rdb) ./twister -T zephyr/test Signed-off-by: Al Semjonovs Change-Id: I86863c3e55aca13ccada01db083fa0192c20f0c4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3900051 Commit-Queue: Jeremy Bettis Reviewed-by: Jeremy Bettis --- util/twister_launcher.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/twister_launcher.py b/util/twister_launcher.py index 6fd871d31b..c30c6191f8 100755 --- a/util/twister_launcher.py +++ b/util/twister_launcher.py @@ -69,6 +69,7 @@ import shlex import subprocess import sys from pathlib import Path +from shutil import which def find_checkout() -> Path: @@ -134,6 +135,11 @@ def find_modules(mod_dir: Path) -> list: return modules +def is_tool(name): + """Check if 'name' is on PATH and marked executable.""" + return which(name) is not None + + def is_rdb_login(): """Checks if user is logged into rdb""" cmd = ["rdb", "auth-info"] @@ -298,7 +304,7 @@ def main(): else: print("TEST EXECUTION FAILED") - if intercepted_args.upload_cros_rdb: + if is_tool("rdb") and intercepted_args.upload_cros_rdb: upload_results(ec_base) sys.exit(result.returncode) -- cgit v1.2.1