Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | RESULT_FILE="$1" |
| 4 | |
Chase Qi | c1a3f88 | 2016-10-21 09:00:15 +0800 | [diff] [blame] | 5 | command -v lava-test-case |
| 6 | lava_test_case="$?" |
| 7 | |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 8 | if [ -f "${RESULT_FILE}" ]; then |
Chase Qi | c763b9a | 2016-11-07 15:49:06 +0800 | [diff] [blame] | 9 | while read -r line; do |
Naresh Kamboju | 66a0233 | 2016-09-30 05:52:21 +0530 | [diff] [blame] | 10 | if echo "${line}" | egrep -iq ".* +(pass|fail|skip)$"; then |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 11 | test="$(echo "${line}" | awk '{print $1}')" |
| 12 | result="$(echo "${line}" | awk '{print $2}')" |
| 13 | |
Chase Qi | c1a3f88 | 2016-10-21 09:00:15 +0800 | [diff] [blame] | 14 | if [ "${lava_test_case}" -eq 0 ]; then |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 15 | lava-test-case "${test}" --result "${result}" |
| 16 | else |
| 17 | echo "<TEST_CASE_ID=${test} RESULT=${result}>" |
| 18 | fi |
Nicolas Dechesne | 3d25d43 | 2017-01-19 15:47:09 +0100 | [diff] [blame] | 19 | elif echo "${line}" | egrep -iq ".*+ (pass|fail|skip)+ .*+"; then |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 20 | test="$(echo "${line}" | awk '{print $1}')" |
| 21 | result="$(echo "${line}" | awk '{print $2}')" |
| 22 | measurement="$(echo "${line}" | awk '{print $3}')" |
| 23 | units="$(echo "${line}" | awk '{print $4}')" |
| 24 | |
Chase Qi | c1a3f88 | 2016-10-21 09:00:15 +0800 | [diff] [blame] | 25 | if [ "${lava_test_case}" -eq 0 ]; then |
Nicolas Dechesne | 3d25d43 | 2017-01-19 15:47:09 +0100 | [diff] [blame] | 26 | if [ -n "${units}" ]; then |
| 27 | lava-test-case "${test}" --result "${result}" --measurement "${measurement}" --units "${units}" |
| 28 | else |
| 29 | lava-test-case "${test}" --result "${result}" --measurement "${measurement}" |
| 30 | fi |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 31 | else |
| 32 | echo "<TEST_CASE_ID=${test} RESULT=${result} UNITS=${units} MEASUREMENT=${measurement}>" |
| 33 | fi |
| 34 | fi |
| 35 | done < "${RESULT_FILE}" |
| 36 | else |
| 37 | echo "WARNING: result file is missing!" |
| 38 | fi |