From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [kvm-unit-tests PATCH v4 09/13] run_tests: print SUMMARY line in summary Date: Wed, 11 May 2016 18:12:51 +0200 Message-ID: <1462983171-4208-10-git-send-email-rkrcmar@redhat.com> References: <1462983171-4208-1-git-send-email-rkrcmar@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Paolo Bonzini , Andrew Jones To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54108 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932091AbcEKQNd (ORCPT ); Wed, 11 May 2016 12:13:33 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9285AA147A for ; Wed, 11 May 2016 16:13:33 +0000 (UTC) In-Reply-To: <1462983171-4208-1-git-send-email-rkrcmar@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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=C4=8Dm=C3=A1=C5=99 --- 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 =20 -if [ "$PRETTY_PRINT_STACKS" =3D "yes" ]; then - log_redir=3D"> >(./scripts/pretty_print_stacks.py \$kernel >> test.lo= g)" -else - log_redir=3D">> test.log" -fi +RUNTIME_log_stdout () { + if [ "$PRETTY_PRINT_STACKS" =3D "yes" ]; then + ./scripts/pretty_print_stacks.py $1 >> test.log + else + cat >> test.log + fi +} + =20 -RUNTIME_arch_run=3D"./$TEST_DIR/run $log_redir" config=3D$TEST_DIR/unittests.cfg rm -f test.log printf "BUILD_HEAD=3D$(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 =20 + echo "exec {stdout}>&1" + echo "RUNTIME_log_stdout () { cat >&\$stdout; }" + cat scripts/runtime.bash =20 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"; } =20 +extract_summary() +{ + tail -1 | grep '^SUMMARY: ' | sed 's/^SUMMARY: /(/;s/$/)/' +} + function run() { local testname=3D"$1" @@ -49,18 +54,18 @@ function run() fi =20 # 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_stdo= ut. + summary=3D$(eval $cmdline > >(tee >(RUNTIME_log_stdout $kernel) | = extract_summary)) ret=3D$? =20 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=3D$timeout)" else - echo "`FAIL` $1" + echo "`FAIL` $1 $summary" fi =20 return $ret --=20 2.8.2