blob: 0a8de78c870f456145ea41e6f792616d1efe00da (
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
57
58
59
60
61
62
63
64
|
#!/bin/sh -e
LEVEL="0"
TEST_SUITE="regression"
OUTPUT="$(pwd)/output"
BOOT_TIMEOUT="300"
LOGFILE="${OUTPUT}/xtest-${TEST_SUITE}-stdout.log"
RESULT_FILE="${OUTPUT}/result.txt"
usage() {
echo "Usage: $0 [-s <android_serial>] [-t <boot_timeout>] [-l <level>] [-T <test_suite>]" 1>&2
exit 1
}
while getopts ":s:t:l:T:" o; do
case "$o" in
s) ANDROID_SERIAL="${OPTARG}" ;;
t) BOOT_TIMEOUT="${OPTARG}" ;;
l) LEVEL="${OPTARG}" ;;
T) TEST_SUITE="${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}"
# Run test.
info_msg "About to run optee-xtest on device ${ANDROID_SERIAL}"
if ! adb_shell_which "tee-supplicant"; then
report_fail "check-tee-supplicant-existence"
exit 0
fi
adb shell "echo 'tee-supplicant &' | su"
if ! adb_shell_which "xtest"; then
report_fail "check-xtest-existence"
exit 0
fi
adb shell "echo xtest -l ${LEVEL} -t ${TEST_SUITE} 2>&1 | su" | tee "${LOGFILE}"
# Parse xtest test log.
grep "^XTEST_TEE" "${LOGFILE}" \
| sed 's/OK/pass/; s/FAILED/fail/; s/SKIPPED/skip/' \
| awk '{printf("%s %s\n", $1, $2)}' \
| tee -a "${RESULT_FILE}"
# Parse test pass/fail/skip stats.
for i in "subtests" "test cases"; do
grep -E "^[0-9]+ $i of which [0-9]+ failed" "${LOGFILE}" \
| awk -v tc="$(echo "$i" | sed 's/ /-/')" \
'{printf("%s-fail-rate pass %s/%s\n"), tc, $(NF-1), $1}' \
| tee -a "${RESULT_FILE}"
done
grep -E "^[0-9]+ test case was skipped" "${LOGFILE}" \
| awk '{printf("test-skipped pass %s\n", $1)}' \
| tee -a "${RESULT_FILE}"
|