summaryrefslogtreecommitdiff
path: root/automated
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2017-01-19 15:47:09 +0100
committerNicolas Dechesne <nicolas.dechesne@linaro.org>2017-01-19 15:52:38 +0100
commit3d25d4319afbbc485c0f194f394dbe25ce079d2e (patch)
treeff73b9beedf231e6bf26239c82c08407d2fcdeb3 /automated
parent2cc6d051bb231cb3918d82027e6567996fc25ae0 (diff)
downloadtest-definitions-pipe-3d25d4319afbbc485c0f194f394dbe25ce079d2e.tar.gz
automated: add support for measurements with no unit
It is possible to report measurements with no specific units, however the helper functions currently require the unit to be specified. This patch allows test case to provide only the measurement in add_metric() , effectively making the last arg (unit) optional. When processing the output , we then need to ensure whether or not the unit was specified in the first place. I needed this when porting sysbench test case onto 'automated' method (e.g. sysbench reports 'count of events'). With this change I can get the following test results from sysbench: <TEST_CASE_ID=total-time-2-threads RESULT=pass UNITS=s MEASUREMENT=4.0010> <TEST_CASE_ID=total-number-of-events-2-threads RESULT=pass UNITS= MEASUREMENT=8827> <TEST_CASE_ID=total-time-taken-by-event-execution-2-threads RESULT=pass UNITS= MEASUREMENT=7.9996> <TEST_CASE_ID=min-2-threads RESULT=pass UNITS=ms MEASUREMENT=0.90> <TEST_CASE_ID=avg-2-threads RESULT=pass UNITS=ms MEASUREMENT=0.91> <TEST_CASE_ID=max-2-threads RESULT=pass UNITS=ms MEASUREMENT=3.38> <TEST_CASE_ID=approx.-95-percentile-2-threads RESULT=pass UNITS=ms MEASUREMENT=0.93> <ENDRUN sysbench 9ce36643-e7e9-481e-a45a-464cd07d8cd9> 2017-01-19 15:45:57,557 - RUNNER.ResultParser: INFO: Result files saved to: /home/ndec/output/sysbench_9ce36643-e7e9-481e-a45a-464cd07d8cd9 --- Printing result.csv --- name,test_case_id,result,measurement,units,test_params sysbench,total-time-2-threads,pass,4.0010,s,DURATION=4;MAX_REQUESTS=50000;SKIP_INSTALL=False;TEST=cpu;FILE_TEST_MODE=seqrewr;TIMES=1 sysbench,total-number-of-events-2-threads,pass,8827,,DURATION=4;MAX_REQUESTS=50000;SKIP_INSTALL=False;TEST=cpu;FILE_TEST_MODE=seqrewr;TIMES=1 sysbench,total-time-taken-by-event-execution-2-threads,pass,7.9996,,DURATION=4;MAX_REQUESTS=50000;SKIP_INSTALL=False;TEST=cpu;FILE_TEST_MODE=seqrewr;TIMES=1 sysbench,min-2-threads,pass,0.90,ms,DURATION=4;MAX_REQUESTS=50000;SKIP_INSTALL=False;TEST=cpu;FILE_TEST_MODE=seqrewr;TIMES=1 sysbench,avg-2-threads,pass,0.91,ms,DURATION=4;MAX_REQUESTS=50000;SKIP_INSTALL=False;TEST=cpu;FILE_TEST_MODE=seqrewr;TIMES=1 sysbench,max-2-threads,pass,3.38,ms,DURATION=4;MAX_REQUESTS=50000;SKIP_INSTALL=False;TEST=cpu;FILE_TEST_MODE=seqrewr;TIMES=1 sysbench,approx.-95-percentile-2-threads,pass,0.93,ms,DURATION=4;MAX_REQUESTS=50000;SKIP_INSTALL=False;TEST=cpu;FILE_TEST_MODE=seqrewr;TIMES=1 Change-Id: Id41207c3237f597bc3db83a5d7d54ee35f6974e3 Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Diffstat (limited to 'automated')
-rwxr-xr-xautomated/lib/sh-test-lib6
-rwxr-xr-xautomated/utils/send-to-lava.sh8
2 files changed, 9 insertions, 5 deletions
diff --git a/automated/lib/sh-test-lib b/automated/lib/sh-test-lib
index b02c121..3b2ab43 100755
--- a/automated/lib/sh-test-lib
+++ b/automated/lib/sh-test-lib
@@ -129,9 +129,9 @@ report_fail() {
}
add_metric() {
- if [ "$#" -ne 4 ]; then
- warn_msg "The number of parameters less then 4"
- error_msg "Usage: add_metric test_case result measurement units"
+ if [ "$#" -lt 3 ]; then
+ warn_msg "The number of parameters less then 3"
+ error_msg "Usage: add_metric test_case result measurement [units]"
fi
test_case="$1"
result="$2"
diff --git a/automated/utils/send-to-lava.sh b/automated/utils/send-to-lava.sh
index 9660b97..ace3de9 100755
--- a/automated/utils/send-to-lava.sh
+++ b/automated/utils/send-to-lava.sh
@@ -16,14 +16,18 @@ if [ -f "${RESULT_FILE}" ]; then
else
echo "<TEST_CASE_ID=${test} RESULT=${result}>"
fi
- elif echo "${line}" | egrep -iq ".*+ (pass|fail|skip)+ .*+ .*"; then
+ elif echo "${line}" | egrep -iq ".*+ (pass|fail|skip)+ .*+"; then
test="$(echo "${line}" | awk '{print $1}')"
result="$(echo "${line}" | awk '{print $2}')"
measurement="$(echo "${line}" | awk '{print $3}')"
units="$(echo "${line}" | awk '{print $4}')"
if [ "${lava_test_case}" -eq 0 ]; then
- lava-test-case "${test}" --result "${result}" --measurement "${measurement}" --units "${units}"
+ if [ -n "${units}" ]; then
+ lava-test-case "${test}" --result "${result}" --measurement "${measurement}" --units "${units}"
+ else
+ lava-test-case "${test}" --result "${result}" --measurement "${measurement}"
+ fi
else
echo "<TEST_CASE_ID=${test} RESULT=${result} UNITS=${units} MEASUREMENT=${measurement}>"
fi