diff options
author | Chase Qi <chase.qi@linaro.org> | 2017-05-09 17:48:09 +0800 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2017-05-10 09:02:28 +0000 |
commit | 77c0b4c3beb3715430b923ba32d5d58d5aca18e2 (patch) | |
tree | bb418a32ab77c55757b79f1213858425cb9cc8a1 | |
parent | 4b017cb3c6fe0da68168f25f17a64a3e8776646e (diff) |
automated: android: add pm-qa test
Change-Id: Ibd4368cdc5ec7e0f2e0098125e9cc50f33f555c2
Signed-off-by: Chase Qi <chase.qi@linaro.org>
-rwxr-xr-x | automated/android/pm-qa/device-script.sh | 41 | ||||
-rwxr-xr-x | automated/android/pm-qa/pm-qa.sh | 71 | ||||
-rw-r--r-- | automated/android/pm-qa/pm-qa.yaml | 35 |
3 files changed, 147 insertions, 0 deletions
diff --git a/automated/android/pm-qa/device-script.sh b/automated/android/pm-qa/device-script.sh new file mode 100755 index 0000000..8772c1b --- /dev/null +++ b/automated/android/pm-qa/device-script.sh @@ -0,0 +1,41 @@ +#!/system/bin/sh +set -x + +TEST_DIR="/data/local/tmp/pm-qa" +export PATH="$PATH":"$TEST_DIR" + +test_func(){ + tests="$1" + + for test in $tests; do + var="${test}_sanity.sh" + subDir="${TEST_DIR}/${test}" + cd "$subDir" || continue + + /system/bin/sh "$var" + if [ $? -ne 1 ]; then + continue + fi + + filelist=$(find . -name "*.sh" | sort) + for file in $filelist; do + path="$file" + /system/bin/sh "$path" + done + cd .. + done + + # Find instances of cpuidle_killer and kill + # all pids associated with it until a better + # solution comes up. + pids=$(pidof "cpuidle_killer") + + for pid in $pids; do + kill -9 "$pid" + done + + echo "pm-qa=pass" +} + +test_func "$1" +exit diff --git a/automated/android/pm-qa/pm-qa.sh b/automated/android/pm-qa/pm-qa.sh new file mode 100755 index 0000000..de969f6 --- /dev/null +++ b/automated/android/pm-qa/pm-qa.sh @@ -0,0 +1,71 @@ +#!/bin/sh -e +# shellcheck disable=SC1090 + +SKIP_INSTALL="false" +ANDROID_SERIAL="" +BOOT_TIMEOUT="300" + +TEST_DIR=$(dirname "$(realpath "$0")") +OUTPUT="${TEST_DIR}/output" +RESULT_FILE="${OUTPUT}/result.txt" +LOGFILE="${OUTPUT}/device-stdout.log" + +BRANCH="android-arm64" +TESTS="cpufreq cpuidle cpuhotplug thermal cputopology" + +. "${TEST_DIR}/../../lib/sh-test-lib" +. "${TEST_DIR}/../../lib/android-test-lib" + +usage() { + echo "Usage: $0 [-S <skip_install>] [-s <android_serial>] [-t <boot_timeout>] [-b <branch>] [-T <tests>]" 1>&2 + exit 1 +} + +while getopts ":S:s:t:b:T:" o; do + case "$o" in + S) SKIP_INSTALL="${OPTARG}" ;; + s) ANDROID_SERIAL="${OPTARG}" ;; + t) BOOT_TIMEOUT="${OPTARG}" ;; + b) BRANCH="${OPTARG}" ;; + T) TESTS="${OPTARG}" ;; + *) usage ;; + esac +done + +initialize_adb +wait_boot_completed "${BOOT_TIMEOUT}" +adb_root + +create_out_dir "${OUTPUT}" +install_deps "git wget" "${SKIP_INSTALL}" + +rm -rf pm-qa +git clone https://git.linaro.org/power/pm-qa.git +cd pm-qa +git checkout "${BRANCH}" +cp "${TEST_DIR}"/device-script.sh ./ +# If awk doesn't exist on the target, replace it with 'buysbox awk'. +if ! adb_shell_which awk; then + info_msg "awk NOT found, replacing it with 'busybox awk'..." + cp "${TEST_DIR}/../../bin/arm64/busybox" ./ + find . -name '*.sh' -exec sed -i 's/awk/busybox awk/g' '{}' \; +fi +cd ../ + +# glmark2 is required to heat GPU. Install it if it is not installed. +if ! adb shell pm list packages | grep 'glmark2'; then + # The following link isn't available publicly. + # Please copy the apk to the current directory for local run. + info_msg "GLMark2 NOT installed, installing it..." + test -f GLMark2.apk || wget http://testdata.validation.linaro.org/apks/GLMark2.apk + adb install GLMark2.apk +fi + +adb_push "pm-qa" "/data/local/tmp/pm-qa" +info_msg "device-${ANDROID_SERIAL}: About to run pm-qa test..." +adb shell /data/local/tmp/pm-qa/device-script.sh "${TESTS}" \ + | tee "${LOGFILE}" + +grep -E "^[a-z0-9_]+: (pass|fail|skip)$" "${LOGFILE}" \ + | sed 's/://g' \ + | tee -a "${RESULT_FILE}" diff --git a/automated/android/pm-qa/pm-qa.yaml b/automated/android/pm-qa/pm-qa.yaml new file mode 100644 index 0000000..90b5a82 --- /dev/null +++ b/automated/android/pm-qa/pm-qa.yaml @@ -0,0 +1,35 @@ +metadata: + name: pm-qa + format: "Lava-Test-Shell Test Definition 1.0" + description: "Test power management (PM-QA). Currently, the test runs + cpufreq, cpuidle, cpuhotplug, thermal and cputopology by + default and individual test can be run by setting TESTS + parameter in test job definition too. Test case documentation + available in wiki: https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/PmQaSpecification" + maintainer: + - lisa.nguyen@linaro.org + - chase.qi@linaro.org + os: + - android + scope: + - functional + - performance + devices: + - juno + - hi6220-hikey + - apq8016-sbc + +params: + SKIP_INSTALL: "false" + ANDROID_SERIAL: "" + BOOT_TIMEOUT: "300" + BRANCH: "android-arm64" + TESTS: "cpufreq cpuidle cpuhotplug thermal cputopology" + +run: + steps: + - cd ./automated/android/pm-qa/ + - ./pm-qa.sh -S "${SKIP_INSTALL}" -s "${ANDROID_SERIAL}" -t "${BOOT_TIMEOUT}" -b "${BRANCH}" -T "${TESTS}" + +parse: + pattern: "^(?P<test_case_id>[a-z]+_[0-9]+):\\s+(?P<result>pass|fail|skip)" |