From ebce5ab5a68fd829cb2a545e006663a99c53b065 Mon Sep 17 00:00:00 2001 From: Chase Qi Date: Mon, 20 Mar 2017 21:09:12 +0800 Subject: automated: android: add stringbench test Change-Id: Iadb21d6f75c5b40a614d5f29d697933286e78808 Signed-off-by: Chase Qi --- automated/android/stringbench/stringbench.sh | 56 ++++++++++++++++++++++++++ automated/android/stringbench/stringbench.yaml | 30 ++++++++++++++ 2 files changed, 86 insertions(+) create mode 100755 automated/android/stringbench/stringbench.sh create mode 100644 automated/android/stringbench/stringbench.yaml (limited to 'automated') diff --git a/automated/android/stringbench/stringbench.sh b/automated/android/stringbench/stringbench.sh new file mode 100755 index 0000000..95a1ccb --- /dev/null +++ b/automated/android/stringbench/stringbench.sh @@ -0,0 +1,56 @@ +#!/bin/sh -ex + +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE +ANDROID_SERIAL="" +BOOT_TIMEOUT="300" + +usage() { + echo "Usage: $0 [-s ] [-t ]" 1>&2 + exit 1 +} + +while getopts ":s:t:" o; do + case "$o" in + # Specify device serial number when more than one device connected. + s) ANDROID_SERIAL="${OPTARG}" ;; + t) BOOT_TIMEOUT="${OPTARG}" ;; + *) usage ;; + esac +done + +# shellcheck disable=SC1091 +. ../../lib/sh-test-lib +# shellcheck disable=SC1091 +. ../../lib/android-test-lib + +initialize_adb +wait_boot_completed "${BOOT_TIMEOUT}" +create_out_dir "${OUTPUT}" + +parser() { + logfile="$1" + case "$2" in + stringbench) prefix="32bit" ;; + stringbench64) prefix="64bit" ;; + esac + + while read -r line; do + test_case_id=$(echo "${line}" | cut -d: -f1 | tr -c '[:alnum:]:.' '_' | tr -s '_' | sed 's/_$//') + test_case_id="${prefix}_${test_case_id}" + measurement=$(echo "${line}" | awk '{print $(NF-1)}') + units=$(echo "${line}" | awk '{print $NF}') + add_metric "${test_case_id}" "pass" "${measurement}" "${units}" + done < "${logfile}" +} + +for test in stringbench stringbench64; do + info_msg "device-${ANDROID_SERIAL}: About to run ${test}" + if ! adb_shell_which "${test}"; then + report_fail "check-${test}-existence" + exit 0 + fi + adb shell "${test}" | tee "${OUTPUT}/${test}.log" + parser "${OUTPUT}/${test}.log" "${test}" +done diff --git a/automated/android/stringbench/stringbench.yaml b/automated/android/stringbench/stringbench.yaml new file mode 100644 index 0000000..ec58bce --- /dev/null +++ b/automated/android/stringbench/stringbench.yaml @@ -0,0 +1,30 @@ +metadata: + name: stringbench + format: "Lava-Test-Shell Test Definition 1.0" + description: "Run stringbench command to benchmark the performance of + string relevant feature of bionic. In the feature this test + should be upstream to bionic-benchmarks. + The source can be viewed here: + https://android-git.linaro.org/git/platform/external/stringbench.git" + 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" + +run: + steps: + - cd ./automated/android/stringbench + - ./stringbench.sh -s "${ANDROID_SERIAL}" -t "${BOOT_TIMEOUT}" + - ../../utils/send-to-lava.sh ./output/result.txt -- cgit v1.2.3