Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | RESULT_FILE="$1" |
| 4 | |
Arthur She | bd0f2fe | 2018-06-01 00:10:30 -0700 | [diff] [blame] | 5 | which lava-test-case > /dev/null 2>&1 |
Chase Qi | c1a3f88 | 2016-10-21 09:00:15 +0800 | [diff] [blame] | 6 | lava_test_case="$?" |
Oleksandr Terentiev | 03e82bc | 2018-11-28 04:38:52 -0800 | [diff] [blame^] | 7 | which lava-test-set > /dev/null 2>&1 |
| 8 | lava_test_set="$?" |
Chase Qi | c1a3f88 | 2016-10-21 09:00:15 +0800 | [diff] [blame] | 9 | |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 10 | if [ -f "${RESULT_FILE}" ]; then |
Chase Qi | c763b9a | 2016-11-07 15:49:06 +0800 | [diff] [blame] | 11 | while read -r line; do |
Naresh Kamboju | 66a0233 | 2016-09-30 05:52:21 +0530 | [diff] [blame] | 12 | if echo "${line}" | egrep -iq ".* +(pass|fail|skip)$"; then |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 13 | test="$(echo "${line}" | awk '{print $1}')" |
| 14 | result="$(echo "${line}" | awk '{print $2}')" |
| 15 | |
Chase Qi | c1a3f88 | 2016-10-21 09:00:15 +0800 | [diff] [blame] | 16 | if [ "${lava_test_case}" -eq 0 ]; then |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 17 | lava-test-case "${test}" --result "${result}" |
| 18 | else |
| 19 | echo "<TEST_CASE_ID=${test} RESULT=${result}>" |
| 20 | fi |
Nicolas Dechesne | 3d25d43 | 2017-01-19 15:47:09 +0100 | [diff] [blame] | 21 | elif echo "${line}" | egrep -iq ".*+ (pass|fail|skip)+ .*+"; then |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 22 | test="$(echo "${line}" | awk '{print $1}')" |
| 23 | result="$(echo "${line}" | awk '{print $2}')" |
| 24 | measurement="$(echo "${line}" | awk '{print $3}')" |
| 25 | units="$(echo "${line}" | awk '{print $4}')" |
| 26 | |
Chase Qi | c1a3f88 | 2016-10-21 09:00:15 +0800 | [diff] [blame] | 27 | if [ "${lava_test_case}" -eq 0 ]; then |
Nicolas Dechesne | 3d25d43 | 2017-01-19 15:47:09 +0100 | [diff] [blame] | 28 | if [ -n "${units}" ]; then |
| 29 | lava-test-case "${test}" --result "${result}" --measurement "${measurement}" --units "${units}" |
| 30 | else |
| 31 | lava-test-case "${test}" --result "${result}" --measurement "${measurement}" |
| 32 | fi |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 33 | else |
Chase Qi | b6e5458 | 2018-08-01 17:29:45 +0800 | [diff] [blame] | 34 | echo "<TEST_CASE_ID=${test} RESULT=${result} MEASUREMENT=${measurement} UNITS=${units}>" |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 35 | fi |
Oleksandr Terentiev | 03e82bc | 2018-11-28 04:38:52 -0800 | [diff] [blame^] | 36 | elif echo "${line}" | egrep -iq "^lava-test-set.*"; then |
| 37 | test_set_status="$(echo "${line}" | awk '{print $2}')" |
| 38 | test_set_name="$(echo "${line}" | awk '{print $3}')" |
| 39 | if [ "${lava_test_set}" -eq 0 ]; then |
| 40 | lava-test-set "${test_set_status}" "${test_set_name}" |
| 41 | else |
| 42 | if [ "${test_set_status}" = "start" ]; then |
| 43 | echo "<LAVA_SIGNAL_TESTSET START ${test_set_name}>" |
| 44 | else |
| 45 | echo "<LAVA_SIGNAL_TESTSET STOP>" |
| 46 | fi |
| 47 | fi |
Chase Qi | 09edc7f | 2016-08-18 13:18:50 +0800 | [diff] [blame] | 48 | fi |
| 49 | done < "${RESULT_FILE}" |
| 50 | else |
| 51 | echo "WARNING: result file is missing!" |
| 52 | fi |