summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaresh Kamboju <naresh.kamboju@linaro.org>2017-05-24 20:45:35 +0530
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-05-25 11:34:50 +0000
commit5a904966cbc9d77f6a899ad011d59da3f999bdcb (patch)
tree8b10c0615e8a46f5d80f7d27c4ab952d2aab1c13
parent5e44fbd1cb9ed00bc457dae8e3c1876949a9d632 (diff)
automated: linux: optee-xtest: improve result parser
Results print format changed on upstream optee_test tree https://github.com/OP-TEE/optee_test/commit/213ca8aaf4eafe9d26af76db7b31d9595ce57e6f This patch simplify result parser to make it more reliable. Change-Id: Iacc3282b5460c0d1d8bfbb237917c087e9657108 Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
-rwxr-xr-xautomated/linux/optee/optee-xtest.sh45
1 files changed, 17 insertions, 28 deletions
diff --git a/automated/linux/optee/optee-xtest.sh b/automated/linux/optee/optee-xtest.sh
index 03ed02f..3d297a1 100755
--- a/automated/linux/optee/optee-xtest.sh
+++ b/automated/linux/optee/optee-xtest.sh
@@ -19,32 +19,6 @@ while getopts "l:t:h:" o; do
esac
done
-parser() {
- egrep "^XTEST_TEE_.* (OK|FAILED|SKIPPED)" "${LOG_FILE}" \
- > "${OUTPUT}/raw-result.txt"
-
- while read -r 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.
create_out_dir "${OUTPUT}"
@@ -61,8 +35,23 @@ 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
+# Parse xtest test log.
+awk "/Result of testsuite ${TEST_SUITE}:/{flag=1; next} /+-----------------------------------------------------/{flag=0} flag" "${LOG_FILE}" \
+ | 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" "${LOG_FILE}" \
+ | 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" "${LOG_FILE}" \
+ | awk '{printf("test-skipped pass %s\n", $1)}' \
+ | tee -a "${RESULT_FILE}"
# Cleanup.
kill "${tee_supplicant_pid}"