[PATCH kvm-unit-tests 6/6] run_tests: print summary

Radim Krčmář
2015-12-14T21:24:45Z

Add shortened SUMMARY line into the output (in parentheses).

Might be interesting and hopefully won't break too many scripts.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
run_tests.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/run_tests.sh b/run_tests.sh
index b0b064f2e341..d0b282f7b079 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -21,6 +21,7 @@ function run()
local arch="$6"
local check="$7"
local accel="$8"
+ local output

if [ -z "$testname" ]; then
return
@@ -47,7 +48,7 @@ function run()

# extra_params in the config file may contain backticks that need to be
# expanded, so use eval to start qemu
- eval $cmdline >> test.log
+ output=`eval $cmdline`
# The first bit of return value is too hard to use, just skip it.
# Unit-tests' return value is shifted by one.
case $(($? >> 1)) in
@@ -56,7 +57,11 @@ function run()
*) echo -ne "\e[31mFAIL\e[0m"
esac

- echo " $1"
+ echo -n " $1 "
+
+ printf "%s\n" "$output" |
+ tee -a test.log |
+ sed 'x;$s/^SUMMARY: //;ta;$s/.*//p;d;:a s/^/(/;s/$/)/'
}

function usage()
--
2.6.4