summaryrefslogtreecommitdiff
path: root/automated
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2017-03-22 14:38:53 +0800
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-03-22 14:53:42 +0000
commit7c42868d583d7b7464162a189c0cabc4051960cb (patch)
tree7b4ad3feb6c322ca89df05040671882567d53ae6 /automated
parent6ee3e9d1f293c2d51736b8ba053e66bd873ad232 (diff)
downloadtest-definitions-pipe-7c42868d583d7b7464162a189c0cabc4051960cb.tar.gz
automated: android-test-lib: add adb_shell_which()
Change-Id: Ieec3d241a33c5d9a645a2e5ca2c1aeab96cc955d Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'automated')
-rwxr-xr-xautomated/lib/android-test-lib14
1 files changed, 14 insertions, 0 deletions
diff --git a/automated/lib/android-test-lib b/automated/lib/android-test-lib
index 3fe6831..8a11279 100755
--- a/automated/lib/android-test-lib
+++ b/automated/lib/android-test-lib
@@ -141,3 +141,17 @@ adb_pull() {
info_msg "Pulling ${remote} from devcie ${ANDROID_SERIAL}"
adb pull "${remote}" "${local}"
}
+
+adb_shell_which() {
+ [ "$#" -ne 1 ] && error_msg "Usage: adb_shell_which <cmd>"
+ cmd="$1"
+ # Only latest version adb able to return exit code.
+ # Check if output of which is empty is a more reliable way.
+ which_output="$(adb shell "which ${cmd}")"
+ info_msg "Output of which: *${which_output}*"
+ if [ -n "${which_output}" ]; then
+ return 0
+ else
+ return 1
+ fi
+}