blob: 95a1ccbd26c6e69039e3feca1facbda410bd560a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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 <android_serial>] [-t <boot_timeout>]" 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
|