From 0729429901be04ba1d62377b97771c10744ce351 Mon Sep 17 00:00:00 2001 From: Vishal Bhoj Date: Tue, 5 Dec 2017 17:46:23 +0530 Subject: android: stop the lava job if device is not present Change-Id: Ia2e69c4e480c8e461792022e55568c387a350fab Signed-off-by: Vishal Bhoj --- automated/lib/android-test-lib | 2 +- automated/lib/sh-test-lib | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/automated/lib/android-test-lib b/automated/lib/android-test-lib index 633dd45..a904411 100755 --- a/automated/lib/android-test-lib +++ b/automated/lib/android-test-lib @@ -33,7 +33,7 @@ initialize_adb() { set -x adb_debug_info adb start-server - timeout 600 adb wait-for-device || error_msg "Device NOT found!" + timeout 600 adb wait-for-device || error_fatal "Device NOT found!" adb devices if [ -z "${ANDROID_SERIAL}" ]; then diff --git a/automated/lib/sh-test-lib b/automated/lib/sh-test-lib index ed0d96e..a948e7a 100755 --- a/automated/lib/sh-test-lib +++ b/automated/lib/sh-test-lib @@ -3,6 +3,17 @@ LANG=C export LANG +error_fatal() { + msg="$1" + [ -z "${msg}" ] && msg="Unknown error" + if which lava-test-raise;then + lava-test-raise msg + else + printf "FATAL ERROR: %s\n" "${msg}" >&2 + fi + exit 1 +} + error_msg() { msg="$1" [ -z "${msg}" ] && msg="Unknown error" -- cgit v1.2.3