From 9496b4fd5c014451c908e13735f9ad0868d4bfd5 Mon Sep 17 00:00:00 2001 From: Chase Qi Date: Wed, 29 Mar 2017 17:34:55 +0800 Subject: automated: android: add ping test Change-Id: I97485048d10f78fd64c76c6a1aee89c87e2cab48 Signed-off-by: Chase Qi --- automated/android/ping/ping.sh | 40 ++++++++++++++++++++++++++++++++++++++++ automated/android/ping/ping.yaml | 28 ++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100755 automated/android/ping/ping.sh create mode 100644 automated/android/ping/ping.yaml (limited to 'automated') 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 ] [-t ] [-S ]" 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 -- cgit v1.2.3