From ada7c84f4cbfd392891b48b281b257ef31a5b36f Mon Sep 17 00:00:00 2001 From: Chase Qi Date: Mon, 25 Jul 2016 12:39:49 +0800 Subject: android: optee-xtest: added support for result statistics Change-Id: Ic7e912fb182e7bd5706b882913daa95ae6d9cc3a Signed-off-by: Chase Qi --- android/scripts/optee-xtest.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/android/scripts/optee-xtest.sh b/android/scripts/optee-xtest.sh index 4c2cda6..de2226d 100755 --- a/android/scripts/optee-xtest.sh +++ b/android/scripts/optee-xtest.sh @@ -73,6 +73,30 @@ benchmark_parser() { done < "${TEST_SUITE}"_result.txt } +stats_parser() { + for i in "subtests" "test cases"; do + stats=$(egrep "^[0-9]+ $i of which [0-9]+ failed" \ + "${TEST_SUITE}"_output.txt) + total=$(echo "${stats}" | awk '{print $1}') + fails=$(echo "${stats}" | awk '{print $(NF-1)}') + passes=$(( total - fails )) + + test "$i" = "test cases" && i="tests" + lava-test-case "xtest-$i-fails" --result "pass" \ + --measurement "${fails}" --units "tests" + lava-test-case "xtest-$i-passes" --result "pass" \ + --measurement "${passes}" --units "tests" + lava-test-case "xtest-$i-fail-rate" --result "pass" \ + --measurement "${fails}"/"${total}" --units "percent" + done + + skip=$(egrep "^[0-9]+ test case was skipped" \ + "${TEST_SUITE}"_output.txt | awk '{print $1}') + lava-test-case xtest-tests-skipped --result "pass" \ + --measurement "${skip}" --units "tests" + +} + # Run xtest xtest -l "${LEVEL}" -t "${TEST_SUITE}" 2>&1 | tee "${TEST_SUITE}"_output.txt if [ $? -eq 0 ]; then @@ -82,6 +106,7 @@ else fi # Parse test result. +stats_parser if [ "${TEST_SUITE}" = "regression" ]; then pass_fail_parser 3 elif [ "${TEST_SUITE}" = "benchmark" ]; then -- cgit v1.2.3