summaryrefslogtreecommitdiff
path: root/automated/lib
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2017-02-21 17:47:55 +0800
committerChase Qi <chase.qi@linaro.org>2017-02-22 16:42:19 +0800
commite2c463022339b75844ac63f577593ea847090eba (patch)
tree942cb8cc597accb61eaf331b2551d61a91723de9 /automated/lib
parentc3bf081318aceef63cedb4521c50d99044180e09 (diff)
downloadtest-definitions-pipe-e2c463022339b75844ac63f577593ea847090eba.tar.gz
automated: improve android-test-lib
Change-Id: I6b7eafea28b6bea74a75c31cbb60f6dba2012795 Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'automated/lib')
-rwxr-xr-xautomated/lib/android-test-lib34
1 files changed, 27 insertions, 7 deletions
diff --git a/automated/lib/android-test-lib b/automated/lib/android-test-lib
index b66d0da..c179a27 100755
--- a/automated/lib/android-test-lib
+++ b/automated/lib/android-test-lib
@@ -23,8 +23,8 @@ initialize_adb() {
}
wait_boot_completed() {
- timeout="$1"
[ "$#" -ne 1 ] && error_msg "Usage: wait_for_boot_completed timeout_in_seconds"
+ timeout="$1"
end=$(( $(date +%s) + timeout ))
boot_completed=false
@@ -45,8 +45,8 @@ wait_boot_completed() {
}
wait_homescreen() {
- timeout="$1"
[ "$#" -ne 1 ] && error_msg "Usage: wait_homescreen timeout_in_seconds"
+ timeout="$1"
end=$(( $(date +%s) + timeout ))
homescreen_displayed=false
@@ -78,13 +78,21 @@ detect_abi() {
info_msg "ABI: ${abi}"
}
+# install() push binary or script file to '/system/bin' so that you can run it
+# without absolute/relative path. If '/system' is always read-only(like LCR),
+# please use adb_push() instead to push binary or file to somewhere that 'rw'
+# permission granted, like '/data/local/tmp', and run it from there.
install() {
+ [ "$#" -ne 1 ] && error_msg "Usage: install <file_path>"
file_path="$1"
file_name="$(basename "${file_path}")"
if adb -s "${SN}" shell mount | grep system | grep -q ro; then
# Remounts the /system partition on the device read-write
info_msg "/system partition is read-only, remounting it read-write..."
+ # Because of https://bugs.linaro.org/show_bug.cgi?id=2888, this
+ # function wouldn't work in LAVA v2 LXC until the bug get addressed.
+ adb root
adb -s "${SN}" remount
fi
@@ -93,10 +101,22 @@ install() {
adb -s "${SN}" shell chmod 755 "/system/bin/${file_name}"
}
-pull_output() {
- device_output="$1"
- host_output="$2"
+adb_push() {
+ [ "$#" -ne 2 ] && error_msg "Usage: adb_push <local> <remote>"
+ local="$1"
+ remote="$2"
+
+ adb -s "${SN}" shell mkdir -p "${remote}"
+ info_msg "Pushing ${local} to devcie ${SN}"
+ adb -s "${SN}" push "${local}" "${remote}"
+ adb -s "${SN}" shell chmod -R 755 "${remote}"
+}
+
+adb_pull() {
+ [ "$#" -ne 2 ] && error_msg "Usage: adb_pull <remote> <local>"
+ remote="$1"
+ local="$2"
- info_msg "Pulling output from devcie ${SN}"
- adb -s "${SN}" pull "${device_output}" "${host_output}"
+ info_msg "Pulling ${remote} from devcie ${SN}"
+ adb -s "${SN}" pull "${remote}" "${local}"
}