summaryrefslogtreecommitdiff
path: root/automated/linux/optee/optee-xtest.sh
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2016-10-19 11:07:56 +0800
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2016-10-20 09:53:07 +0000
commit22bacf9c45ba0981d8c9b717561910a10076f45c (patch)
treee52e67e0ecf2a0b0b72eba36d34fa67c1932626a /automated/linux/optee/optee-xtest.sh
parent50a5baa56961c2d98bbb3ee5b4cf1f0d2f230088 (diff)
downloadtest-definitions-pipe-22bacf9c45ba0981d8c9b717561910a10076f45c.tar.gz
v2: linux: add optee xtest
Change-Id: Ifbaf77db448c07f6209269bc45718e7ad5747a50 Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'automated/linux/optee/optee-xtest.sh')
-rwxr-xr-xautomated/linux/optee/optee-xtest.sh69
1 files changed, 69 insertions, 0 deletions
diff --git a/automated/linux/optee/optee-xtest.sh b/automated/linux/optee/optee-xtest.sh
new file mode 100755
index 0000000..67884dd
--- /dev/null
+++ b/automated/linux/optee/optee-xtest.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+. ../../lib/sh-test-lib
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+TEST_LEVEL="0"
+TEST_SUITE="regression"
+
+usage() {
+ echo "Usage: $0 [-l <0-15> -t <regression|benchmark>]" 1>&2
+ exit 1
+}
+
+while getopts "l:t:h:" o; do
+ case "$o" in
+ l) TEST_LEVEL="${OPTARG}" ;;
+ t) TEST_SUITE="${OPTARG}" ;;
+ h|*) usage ;;
+ esac
+done
+
+parser() {
+ egrep "^XTEST_TEE_.* (OK|FAILED|SKIPPED)" "${LOG_FILE}" \
+ > "${OUTPUT}/raw-result.txt"
+
+ while read line; do
+ test_case=$(echo "${line}" | awk '{print $1}')
+ test_result=$(echo "${line}" | awk '{print $2}')
+
+ case "${test_result}" in
+ OK) test_result="pass" ;;
+ SKIPPED) test_result="skip" ;;
+ *) test_result="fail" ;;
+ esac
+
+ echo "${test_case} ${test_result}" >> "${RESULT_FILE}"
+
+ if [ "${TEST_SUITE}" = "benchmark" ]; then
+ sed -n "/^\* ${test_case}/,/ ${test_case} [OK|FAILED|SKIPPED]/p" "${LOG_FILE}" \
+ | grep "[0-9].*|" \
+ | awk -v test_case="${test_case}" -v test_result="${test_result}"\
+ '{data_size=$1; speed=$NF; print test_case"_"data_size" "test_result" "speed" KB/s"; }' \
+ >> "${RESULT_FILE}"
+ fi
+ done < "${OUTPUT}/raw-result.txt"
+}
+
+# Test run.
+[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
+mkdir -p "${OUTPUT}"
+
+command -v tee-supplicant && command -v xtest
+exit_on_fail "xtest-existence-check"
+
+tee-supplicant &
+tee_supplicant_pid="$!"
+sleep 5
+
+info_msg "Running xtest..."
+LOG_FILE="${OUTPUT}/${TEST_SUITE}-output.txt"
+test_cmd="xtest -l ${TEST_LEVEL} -t ${TEST_SUITE} 2>&1"
+pipe0_status "${test_cmd}" "tee ${LOG_FILE}"
+check_return "xtest-run"
+
+# Parse output.
+parser
+
+# Cleanup.
+kill "${tee_supplicant_pid}"