summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2017-03-29 17:34:55 +0800
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-03-29 11:34:31 +0000
commit9496b4fd5c014451c908e13735f9ad0868d4bfd5 (patch)
tree81e6abedd1068c032dbba7fde22295a22166f943
parent9ad14134d69c00629290b96978704b0b0d6a4538 (diff)
automated: android: add ping test
Change-Id: I97485048d10f78fd64c76c6a1aee89c87e2cab48 Signed-off-by: Chase Qi <chase.qi@linaro.org>
-rwxr-xr-xautomated/android/ping/ping.sh40
-rw-r--r--automated/android/ping/ping.yaml28
2 files changed, 68 insertions, 0 deletions
diff --git a/automated/android/ping/ping.sh b/automated/android/ping/ping.sh
new file mode 100755
index 0000000..d98b150
--- /dev/null
+++ b/automated/android/ping/ping.sh
@@ -0,0 +1,40 @@
+#!/bin/sh -e
+# shellcheck disable=SC1091
+
+OUTPUT="$(pwd)/output"
+LOGFILE="${OUTPUT}/ping.log"
+RESULT_FILE="${OUTPUT}/result.txt"
+export RESULT_FILE
+ANDROID_SERIAL=""
+BOOT_TIMEOUT="300"
+SERVER="www.google.com"
+
+usage() {
+ echo "Usage: $0 [-s <android_serial>] [-t <boot_timeout>] [-S <server>]" 1>&2
+ exit 1
+}
+
+while getopts ":s:t:S:" o; do
+ case "$o" in
+ s) ANDROID_SERIAL="${OPTARG}" ;;
+ t) BOOT_TIMEOUT="${OPTARG}" ;;
+ S) SERVER="${OPTARG}" ;;
+ *) usage ;;
+ esac
+done
+
+. ../../lib/sh-test-lib
+. ../../lib/android-test-lib
+
+initialize_adb
+wait_boot_completed "${BOOT_TIMEOUT}"
+create_out_dir "${OUTPUT}"
+
+info_msg "device-${ANDROID_SERIAL}: About to ping ${SERVER}..."
+adb shell 'ping -c 10 '"${SERVER}"'; echo exitcode: $?' | tee "${LOGFILE}"
+
+if grep -q "exitcode: 0" "${LOGFILE}"; then
+ report_pass "ping"
+else
+ report_fail "ping"
+fi
diff --git a/automated/android/ping/ping.yaml b/automated/android/ping/ping.yaml
new file mode 100644
index 0000000..fd9d11d
--- /dev/null
+++ b/automated/android/ping/ping.yaml
@@ -0,0 +1,28 @@
+metadata:
+ name: ping
+ format: "Lava-Test Test Definition 1.0"
+ description: "ping test"
+ maintainer:
+ - yongqin.liu@linaro.org
+ - chase.qi@linaro.org
+ os:
+ - android
+ scope:
+ - performance
+ devices:
+ - juno
+ - hi6220-hikey
+
+params:
+ # Specify device serial no. when more than one device connected.
+ ANDROID_SERIAL: ""
+ # Specify timeout in seconds for wait_boot_completed.
+ BOOT_TIMEOUT: "300"
+ # Specify the server to ping.
+ SERVER: "www.google.com"
+
+run:
+ steps:
+ - cd ./automated/android/ping
+ - ./ping.sh -s "${ANDROID_SERIAL}" -t "${BOOT_TIMEOUT}" -S "${SERVER}"
+ - ../../utils/send-to-lava.sh ./output/result.txt