kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Andrew Jones <drjones@redhat.com>
Subject: [kvm-unit-tests PATCH v4 09/13] run_tests: print SUMMARY line in summary
Date: Wed, 11 May 2016 18:12:51 +0200	[thread overview]
Message-ID: <1462983171-4208-10-git-send-email-rkrcmar@redhat.com> (raw)
In-Reply-To: <1462983171-4208-1-git-send-email-rkrcmar@redhat.com>

SUMMARY line is present if the test uses lib/report.  Summary contains
some interesting information, so duplicating the output isn't that big
of a cost.  Our log redirection got more complicated, though.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 v4:
 * less ev[ai]l [Paolo]
 * didn't include Drew's r-b

 run_tests.sh            | 14 ++++++++------
 scripts/mkstandalone.sh |  3 +++
 scripts/runtime.bash    | 15 ++++++++++-----
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/run_tests.sh b/run_tests.sh
index 7e0237f3aa11..b634e472a834 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -46,13 +46,15 @@ while getopts "g:hv" opt; do
     esac
 done
 
-if [ "$PRETTY_PRINT_STACKS" = "yes" ]; then
-	log_redir="> >(./scripts/pretty_print_stacks.py \$kernel >> test.log)"
-else
-	log_redir=">> test.log"
-fi
+RUNTIME_log_stdout () {
+    if [ "$PRETTY_PRINT_STACKS" = "yes" ]; then
+        ./scripts/pretty_print_stacks.py $1 >> test.log
+    else
+        cat >> test.log
+    fi
+}
+
 
-RUNTIME_arch_run="./$TEST_DIR/run $log_redir"
 config=$TEST_DIR/unittests.cfg
 rm -f test.log
 printf "BUILD_HEAD=$(cat build-head)\n\n" > test.log
diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index 26094dfba373..77793fd64c76 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -68,6 +68,9 @@ generate_test ()
 	(echo "#!/bin/bash"
 	 cat scripts/arch-run.bash "$TEST_DIR/run") | temp_file RUNTIME_arch_run
 
+	echo "exec {stdout}>&1"
+	echo "RUNTIME_log_stdout () { cat >&\$stdout; }"
+
 	cat scripts/runtime.bash
 
 	echo "run ${args[@]}"
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 8d374103a71c..6d9d8bffb82f 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -6,6 +6,11 @@ PASS() { echo -ne "\e[32mPASS\e[0m"; }
 SKIP() { echo -ne "\e[33mSKIP\e[0m"; }
 FAIL() { echo -ne "\e[31mFAIL\e[0m"; }
 
+extract_summary()
+{
+    tail -1 | grep '^SUMMARY: ' | sed 's/^SUMMARY: /(/;s/$/)/'
+}
+
 function run()
 {
     local testname="$1"
@@ -49,18 +54,18 @@ function run()
     fi
 
     # extra_params in the config file may contain backticks that need to be
-    # expanded, so use eval to start qemu
-    eval $cmdline
+    # expanded, so use eval to start qemu.  Same for $RUNTIME_log_stdout.
+    summary=$(eval $cmdline > >(tee >(RUNTIME_log_stdout $kernel) | extract_summary))
     ret=$?
 
     if [ $ret -eq 0 ]; then
-        echo "`PASS` $1"
+        echo "`PASS` $1 $summary"
     elif [ $ret -eq 77 ]; then
-        echo "`SKIP` $1"
+        echo "`SKIP` $1 $summary"
     elif [ $ret -eq 124 ]; then
         echo "`FAIL` $1 (timeout; duration=$timeout)"
     else
-        echo "`FAIL` $1"
+        echo "`FAIL` $1 $summary"
     fi
 
     return $ret
-- 
2.8.2


  parent reply	other threads:[~2016-05-11 16:13 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 16:12 [kvm-unit-tests PATCH v4 00/13] Improve the output of test runners Radim Krčmář
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 01/13] lib/report: allow test skipping Radim Krčmář
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 02/13] x86/*: report skipped tests Radim Krčmář
2016-05-17 12:19   ` Paolo Bonzini
2016-05-25 17:19     ` Radim Krčmář
2016-05-25 17:23       ` Radim Krčmář
2016-05-26  7:22         ` Paolo Bonzini
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 03/13] x86/unittests: remove svm-disabled Radim Krčmář
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 04/13] lib/string: add strncmp Radim Krčmář
2016-05-11 16:33   ` Andrew Jones
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 05/13] lib/util: add args_parse_keyval Radim Krčmář
2016-05-11 16:58   ` Andrew Jones
2016-05-11 17:19     ` Radim Krčmář
2016-05-11 17:23   ` Andrew Jones
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 06/13] x86/pmu: expect failure with nmi_watchdog Radim Krčmář
2016-05-11 17:00   ` Andrew Jones
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 07/13] lib/report: don't print 0 failed tests Radim Krčmář
2016-05-11 16:12 ` [kvm-unit-tests PATCH v4 08/13] scripts/runtime: consolidate summary tags Radim Krčmář
2016-05-17 12:22   ` Paolo Bonzini
2016-05-25 17:46     ` Radim Krčmář
2016-05-11 16:12 ` Radim Krčmář [this message]
2016-05-11 17:10   ` [kvm-unit-tests PATCH v4 09/13] run_tests: print SUMMARY line in summary Andrew Jones
2016-05-17 12:32   ` Paolo Bonzini
2016-05-25 17:41     ` Radim Krčmář
2016-05-11 16:30 ` [kvm-unit-tests PATCH v4 10/13] run_tests: log stderr Radim Krčmář
2016-05-11 16:30   ` [kvm-unit-tests PATCH v4 11/13] scripts/runtime: skip tests that cannot run Radim Krčmář
2016-05-11 17:20     ` Andrew Jones
2016-05-11 16:30   ` [kvm-unit-tests PATCH v4 12/13] scripts/arch-run: change QEMU failure detection Radim Krčmář
2016-05-11 17:24     ` Andrew Jones
2016-05-11 16:30   ` [kvm-unit-tests PATCH v4 13/13] scripts/run: generalize check Radim Krčmář
2016-05-11 17:31     ` Andrew Jones
2016-05-11 17:11   ` [kvm-unit-tests PATCH v4 10/13] run_tests: log stderr Andrew Jones
2016-05-17 12:29 ` [kvm-unit-tests PATCH v4 00/13] Improve the output of test runners Paolo Bonzini
2016-05-25 17:49   ` Radim Krčmář
2016-05-26  7:25     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462983171-4208-10-git-send-email-rkrcmar@redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).