From 34f694a06a0ba2fac36d50cea50dda6d2215afc5 Mon Sep 17 00:00:00 2001 From: Chase Qi Date: Mon, 27 Mar 2017 12:42:22 +0800 Subject: android-test-lib: run 'adb shell which' with root permission Root permission is required to locate some commands. For example: T440 test-definitions # adb shell which tee-supplicant T440 test-definitions # adb shell "echo which tee-supplicant | su" /system/bin/tee-supplicant T440 test-definitions # adb shell ls -l /system/bin/tee-supplicant ls: /system/bin/tee-supplicant: Permission denied Change-Id: I129d55d12b081ad4e5cf4c4fd72d1f905223b9a4 Signed-off-by: Chase Qi --- automated/lib/android-test-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'automated/lib') diff --git a/automated/lib/android-test-lib b/automated/lib/android-test-lib index a4fd136..7330c8b 100755 --- a/automated/lib/android-test-lib +++ b/automated/lib/android-test-lib @@ -153,7 +153,7 @@ adb_shell_which() { 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}")" + which_output="$(adb shell "echo which ${cmd} | su")" info_msg "Output of which: *${which_output}*" if [ -n "${which_output}" ]; then return 0 -- cgit v1.2.3