From: Paolo Bonzini <pbonzini@redhat.com>
To: "Andrew Jones" <drjones@redhat.com>, "Radim Krčmář" <rkrcmar@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 8/9] run_tests: print summary
Date: Tue, 10 May 2016 13:45:53 +0200 [thread overview]
Message-ID: <5731C9F1.80003@redhat.com> (raw)
In-Reply-To: <20160419071947.3v6fjnbdln47ddno@hawk.localdomain>
On 19/04/2016 09:19, Andrew Jones wrote:
> On Fri, Apr 15, 2016 at 10:52:50PM +0200, Radim Krčmář wrote:
>> 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>
>> ---
>> run_tests.sh | 6 +++---
>> scripts/mkstandalone.sh | 3 +++
>> scripts/runtime.bash | 15 ++++++++++-----
>> 3 files changed, 16 insertions(+), 8 deletions(-)
>>
>> diff --git a/run_tests.sh b/run_tests.sh
>> index 7e0237f3aa11..2a0082163423 100755
>> --- a/run_tests.sh
>> +++ b/run_tests.sh
>> @@ -25,6 +25,7 @@ specify the appropriate qemu binary for ARCH-run.
>> EOF
>> }
>>
>> +RUNTIME_log_stdout="/dev/null"
>> RUNTIME_arch_run="./$TEST_DIR/run"
>> source scripts/runtime.bash
>>
>> @@ -47,12 +48,11 @@ while getopts "g:hv" opt; do
>> done
>>
>> if [ "$PRETTY_PRINT_STACKS" = "yes" ]; then
>> - log_redir="> >(./scripts/pretty_print_stacks.py \$kernel >> test.log)"
>> + RUNTIME_log_stdout='>(./scripts/pretty_print_stacks.py $kernel >> test.log)'
>> else
>> - log_redir=">> test.log"
>> + RUNTIME_log_stdout='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 ef15bc88a22a..ee01fe0c7777 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 59f0df080988..fc4be91d8727 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"
>> @@ -55,18 +60,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 > >(eval "tee -a $RUNTIME_log_stdout" | extract_summary))
>
> The depth of our stdout resolution is getting insane. Oh well, let's see
> how deep we can go before we throw our hands up and just rewrite all these
> bash scripts in python.
Why not just use a pipe here?
eval $cmdline 2>> $RUNTIME_log_stderr \
| eval tee -a "$RUNTIME_log_stdout" | extract_summary
Anything I am missing?
Paolo
>> 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.1
>>
>
> Reviewed-by: Andrew Jones <drjones@redhat.com>
>
next prev parent reply other threads:[~2016-05-10 11:45 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-15 20:52 [PATCH kvm-unit-tests v3 0/9] Improve the output of test runners Radim Krčmář
2016-04-15 20:52 ` [PATCH v3 1/9] lib/report: allow test skipping Radim Krčmář
2016-04-19 6:26 ` Andrew Jones
2016-04-15 20:52 ` [PATCH v3 2/9] x86/*: report skipped tests Radim Krčmář
2016-04-19 6:34 ` Andrew Jones
2016-04-19 11:51 ` Radim Krčmář
2016-04-15 20:52 ` [PATCH v3 3/9] x86/unittests: remove svm-disabled Radim Krčmář
2016-04-15 20:52 ` [PATCH v3 4/9] x86/pmu: expect failure with nmi_watchdog Radim Krčmář
2016-04-19 6:44 ` Andrew Jones
2016-04-19 11:57 ` Radim Krčmář
2016-04-19 13:46 ` Andrew Jones
2016-04-15 20:52 ` [PATCH v3 5/9] lib/report: don't print 0 failed tests Radim Krčmář
2016-04-19 6:45 ` Andrew Jones
2016-04-15 20:52 ` [PATCH v3 6/9] scripts/runtime: skip tests that cannot run Radim Krčmář
2016-04-19 7:01 ` Andrew Jones
2016-04-19 12:01 ` Radim Krčmář
2016-04-15 20:52 ` [PATCH v3 7/9] scripts/runtime: consolidate summary tags Radim Krčmář
2016-04-19 7:04 ` Andrew Jones
2016-04-15 20:52 ` [PATCH v3 8/9] run_tests: print summary Radim Krčmář
2016-04-19 7:19 ` Andrew Jones
2016-05-10 11:45 ` Paolo Bonzini [this message]
2016-05-10 12:41 ` Radim Krčmář
2016-05-10 14:32 ` Paolo Bonzini
2016-05-10 15:31 ` Radim Krčmář
2016-05-10 15:46 ` Paolo Bonzini
2016-05-10 16:17 ` Radim Krčmář
2016-04-15 20:52 ` [PATCH v3 9/9] run_tests: log stderr Radim Krčmář
2016-04-19 7:26 ` Andrew Jones
2016-04-19 12:13 ` Radim Krčmář
2016-05-10 11:41 ` Paolo Bonzini
2016-05-10 12:47 ` Radim Krčmář
2016-04-19 7:31 ` [PATCH kvm-unit-tests v3 0/9] Improve the output of test runners Andrew Jones
2016-04-19 12:14 ` Radim Krčmář
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=5731C9F1.80003@redhat.com \
--to=pbonzini@redhat.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=rkrcmar@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.