summaryrefslogtreecommitdiff
path: root/automated
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2017-03-20 15:38:59 +0800
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-03-27 13:16:59 +0000
commit9968eb96755f2eabf22d1b55d6b98bae3d16f1d9 (patch)
tree9b94023cf917989ea8140814c376108ae9e5960a /automated
parent460f28ff83e923fddf709c258ec4c9b310eb4542 (diff)
automated: android: add optee xtest
Change-Id: Ib542b90c1866edc7dfae6a1091ffb4b88230e32a Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'automated')
-rwxr-xr-xautomated/android/optee/optee-xtest.sh64
-rwxr-xr-xautomated/android/optee/optee-xtest.yaml30
2 files changed, 94 insertions, 0 deletions
diff --git a/automated/android/optee/optee-xtest.sh b/automated/android/optee/optee-xtest.sh
new file mode 100755
index 0000000..0a8de78
--- /dev/null
+++ b/automated/android/optee/optee-xtest.sh
@@ -0,0 +1,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}"
diff --git a/automated/android/optee/optee-xtest.yaml b/automated/android/optee/optee-xtest.yaml
new file mode 100755
index 0000000..bdf32da
--- /dev/null
+++ b/automated/android/optee/optee-xtest.yaml
@@ -0,0 +1,30 @@
+metadata:
+ name: optee-xtest
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "OP-TEE sanity test suite"
+ maintainer:
+ - chase.qi@linaro.org
+ os:
+ - android
+ scope:
+ - functional
+ - performance
+ devices:
+ - hi6220-hikey
+ - juno
+
+params:
+ # Test suite level: [0-15]
+ LEVEL: "0"
+ # Available test suite: regression, benchmark
+ TEST_SUITE: "regression"
+ # 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/optee
+ - ./optee-xtest.sh -l "${LEVEL}" -T "${TEST_SUITE}" -s "${ANDROID_SERIAL}" -t "${BOOT_TIMEOUT}"
+ - ../../utils/send-to-lava.sh ./output/result.txt