summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2016-07-08 11:58:11 +0800
committerChase Qi <chase.qi@linaro.org>2016-07-13 20:35:18 +0800
commit4b26efa2ecc4b9f459e842f5ac400cfdd15f3f3a (patch)
treeab7fd54c472508c7b116c5e30d075ab6c30e611a /android
parent0f087f91770e8e90e4d18a7bd488fd4e489f202f (diff)
android: add optee-xtest test suite
Change-Id: I71b00fffbc025ffb2f9171f3cfd5987d98e85ce2 Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'android')
-rwxr-xr-xandroid/optee-xtest.yaml24
-rwxr-xr-xandroid/scripts/optee-xtest.sh90
2 files changed, 114 insertions, 0 deletions
diff --git a/android/optee-xtest.yaml b/android/optee-xtest.yaml
new file mode 100755
index 0000000..0dce7da
--- /dev/null
+++ b/android/optee-xtest.yaml
@@ -0,0 +1,24 @@
+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"
+
+run:
+ steps:
+ - './android/scripts/optee-xtest.sh ${LEVEL} ${TEST_SUITE}'
diff --git a/android/scripts/optee-xtest.sh b/android/scripts/optee-xtest.sh
new file mode 100755
index 0000000..4c2cda6
--- /dev/null
+++ b/android/scripts/optee-xtest.sh
@@ -0,0 +1,90 @@
+#!/system/bin/sh
+#
+# Run OP-TEE sanity test suite.
+#
+# Copyright (C) 2010 - 2016, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Chase Qi <chase.qi@linaro.org>
+
+LEVEL="$1"
+TEST_SUITE="$2"
+
+pass_fail_parser() {
+ local field="$1"
+ # Collect test case ID and case name, then join them with minus.
+ grep "^\* XTEST_TEE" "${TEST_SUITE}"_output.txt \
+ | cut -d "_" -f"${field}"- \
+ | sed 's/ /-/g' > "${TEST_SUITE}"_case_list.txt
+
+ # Get test result for each test case, update result file and send to LAVA.
+ rm -f "${TEST_SUITE}"_result.txt
+ while read line; do
+ test_id=$(echo "${line}" | awk -F'-' '{ print $1 }')
+ test_case="${line}"
+ test_result=$(grep -m 1 "^XTEST_TEE.*${test_id} [OK|FAILED]" \
+ "${TEST_SUITE}"_output.txt | awk '{ print $2 }')
+
+ if [ "${test_result}" = "OK" ]; then
+ echo "${test_case} pass" >> "${TEST_SUITE}"_result.txt
+ lava-test-case "${test_case}" --result "pass"
+ else
+ echo "${test_case} fail" >> "${TEST_SUITE}"_result.txt
+ lava-test-case "${test_case}" --result "fail"
+ fi
+ done < "${TEST_SUITE}"_case_list.txt
+
+ rm -f "${TEST_SUITE}"_case_list.txt
+}
+
+benchmark_parser() {
+ while read line; do
+ test_id=$(echo "${line}" | awk -F'-' '{ print $1 }')
+ test_case=$(echo "${line}" | awk '{ print $1 }')
+ test_result=$(echo "${line}" | awk '{ print $2 }')
+ sed -n "/^\* XTEST.*_${test_id}/,/XTEST.*_${test_id} [OK|FAILED]/p" \
+ "${TEST_SUITE}"_output.txt > "${test_id}"_benchmark_raw.txt
+
+ grep "[0-9].*|" "${test_id}"_benchmark_raw.txt \
+ | awk -v test_case="${test_case}" '{data_size=$1; speed=$NF; \
+ print test_case"-"data_size" "speed; }' \
+ > "${test_id}"_benchmark.txt
+ rm -f "${test_id}"_benchmark_raw.txt
+
+ while read line; do
+ test_case=$(echo "${line}" | awk '{ print $1 }')
+ test_measurement=$(echo "${line}" | awk '{ print $2 }')
+ lava-test-case "${test_case}" --result "${test_result}" \
+ --measurement "${test_measurement}" --units "kB/s"
+ done < "${test_id}"_benchmark.txt
+ done < "${TEST_SUITE}"_result.txt
+}
+
+# Run xtest
+xtest -l "${LEVEL}" -t "${TEST_SUITE}" 2>&1 | tee "${TEST_SUITE}"_output.txt
+if [ $? -eq 0 ]; then
+ lava-test-case "optee-xtest-run" --result "pass"
+else
+ lava-test-case "optee-xtest-run" --result "fail"
+fi
+
+# Parse test result.
+if [ "${TEST_SUITE}" = "regression" ]; then
+ pass_fail_parser 3
+elif [ "${TEST_SUITE}" = "benchmark" ]; then
+ pass_fail_parser 4
+ benchmark_parser
+fi