diff mbox

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

Message ID 1450128261-21170-7-git-send-email-rkrcmar@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Radim Krčmář Dec. 14, 2015, 9:24 p.m. UTC
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 mbox

Patch

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()