summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2018-11-15 00:08:34 +0000
committerLinaro Code Review <review@review.linaro.org>2018-11-15 00:08:34 +0000
commit6071dd4c6f7827c0e5de40fe5029ff2b28401882 (patch)
tree35cf1647b13214a2a7319b83d8c753eba7d9b9ab
parent509ddb3a96eaf8eae575a05f240db34ee5a35036 (diff)
parent34ae057bc74246ef35bcb86d869f14e57d6db87b (diff)
Merge "linux: add test case to install android platform tools"
-rwxr-xr-xautomated/linux/android-platform-tools/install.sh56
-rw-r--r--automated/linux/android-platform-tools/install.yaml26
2 files changed, 82 insertions, 0 deletions
diff --git a/automated/linux/android-platform-tools/install.sh b/automated/linux/android-platform-tools/install.sh
new file mode 100755
index 0000000..39f1f8a
--- /dev/null
+++ b/automated/linux/android-platform-tools/install.sh
@@ -0,0 +1,56 @@
+#!/bin/sh -ex
+# shellcheck disable=SC1090
+# shellcheck disable=SC1091
+
+TEST_DIR=$(dirname "$(realpath "$0")")
+OUTPUT="${TEST_DIR}/output"
+export RESULT_FILE="${OUTPUT}/result.txt"
+LINK="https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
+
+usage() {
+ echo "Usage: $0 [-l <link>]" 1>&2
+ exit 1
+}
+
+while getopts "l:h" opt; do
+ case "$opt" in
+ l) LINK="${OPTARG}" ;;
+ *) usage ;;
+ esac
+done
+
+. "${TEST_DIR}/../../lib/sh-test-lib"
+create_out_dir "${OUTPUT}"
+
+install_deps "wget unzip"
+cd /opt/
+rm -rf platform-tools*
+wget -S --progress=dot:giga "${LINK}"
+unzip -q "$(basename "${LINK}")"
+cd platform-tools
+
+install() {
+ tool="$1"
+ tool_path="$(realpath ./"${tool}")"
+
+ if command -v "${tool}"; then
+ remove_pkgs "${tool}"
+ if command -v "${tool}"; then
+ rm -f /usr/bin/"${tool}"
+ fi
+ fi
+ ln -s "${tool_path}" "/usr/bin/"
+ tool_link="$(realpath "$(which "${tool}")")"
+ if [ "${tool_link}" = "${tool_path}" ]; then
+ report_pass "install-${tool}"
+ else
+ report_fail "install-${tool}"
+ exit 1
+ fi
+}
+
+install fastboot
+fastboot --version
+
+install adb
+adb version
diff --git a/automated/linux/android-platform-tools/install.yaml b/automated/linux/android-platform-tools/install.yaml
new file mode 100644
index 0000000..11cfd6d
--- /dev/null
+++ b/automated/linux/android-platform-tools/install.yaml
@@ -0,0 +1,26 @@
+metadata:
+ name: install-android-platform-tools
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Install android platform tools provided by Google from
+ https://developer.android.com/studio/releases/platform-tools"
+ maintainer:
+ - chase.qi@linaro.org
+ os:
+ - ubuntu
+ - debian
+ devices:
+ - lxc
+
+ scope:
+ - functional
+
+params:
+ # Link examples
+ # https://dl.google.com/android/repository/platform-tools_r28.0.0-linux.zip
+ LINK: "https://dl.google.com/android/repository/platform-tools-latest-linux.zip"
+
+run:
+ steps:
+ - cd automated/linux/android-platform-tools
+ - if ! ./install.sh -l "${LINK}"; then command -v lava-test-raise && lava-test-raise "Failed to install android platform tools!"; fi
+ - ../../utils/send-to-lava.sh ./output/result.txt