From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: Re: [PATCH kvm-unit-tests v2 11/12] wrappers: consolidate skip output Date: Thu, 17 Dec 2015 13:59:52 -0600 Message-ID: <20151217195952.GI14168@hawk.localdomain> References: <1450374823-7648-1-git-send-email-rkrcmar@redhat.com> <1450374823-7648-12-git-send-email-rkrcmar@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, Paolo Bonzini To: Radim =?utf-8?B?S3LEjW3DocWZ?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50118 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756465AbbLQT76 (ORCPT ); Thu, 17 Dec 2015 14:59:58 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id B6EEA344DB5 for ; Thu, 17 Dec 2015 19:59:58 +0000 (UTC) Content-Disposition: inline In-Reply-To: <1450374823-7648-12-git-send-email-rkrcmar@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Dec 17, 2015 at 06:53:42PM +0100, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: > Ugly helpers will get us yellow "SKIP" to stdout and 77 on exit. >=20 > Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 > --- > v2: new > =20 > scripts/mkstandalone.sh | 6 +++--- > scripts/run.bash | 25 ++++++++++++++++--------- > 2 files changed, 19 insertions(+), 12 deletions(-) >=20 > diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh > index c37f694398b8..adb11abf650c 100755 > --- a/scripts/mkstandalone.sh > +++ b/scripts/mkstandalone.sh > @@ -66,7 +66,7 @@ cat scripts/run.bash >> $standalone > =20 > if [ ! -f $kernel ]; then > cat <> $standalone > -echo "skip $testname (test kernel not present)" 1>&2 > +echo "\$(SKIP) $testname (test kernel not present)" > exit 1 > EOF > else > @@ -89,8 +89,8 @@ echo \$qemu $cmdline -smp $smp $opts > =20 > cmdline=3D"\`echo '$cmdline' | sed s%$kernel%_NO_FILE_4Uhere_%\`" > if \$qemu \$cmdline 2>&1 | grep 'No accelerator found' >/dev/null; t= hen > - echo "skip $testname (QEMU doesn't support KVM)" > - exit 1 > + echo "\$(SKIP) $testname (QEMU doesn't support KVM)" > + exit \$EXIT_SKIP > fi > =20 > __run() > diff --git a/scripts/run.bash b/scripts/run.bash > index d3e8d37d315d..06a13b9aaf1a 100644 > --- a/scripts/run.bash > +++ b/scripts/run.bash > @@ -1,3 +1,10 @@ > +PASS() { echo -ne "\e[32mPASS\e[0m"; } > +SKIP() { echo -ne "\e[33mSKIP\e[0m"; } > +FAIL() { echo -ne "\e[31mFAIL\e[0m"; } I definitely put these in functions.bash, but then I'd put run() in functions.bash too, as I said earlier. > + > +EXIT_SUCCESS=3D0 > +EXIT_SKIP=3D77 > + > function run() > { > local testname=3D"$1" > @@ -10,22 +17,22 @@ function run() > local accel=3D"$8" > =20 > if [ -z "$testname" ]; then > - return > + return $EXIT_SKIP > fi > =20 > if [ -n "$only_group" ] && ! grep -q "$only_group" <<<$groups; t= hen > - return > + return $EXIT_SKIP > fi > =20 > if [ -n "$arch" ] && [ "$arch" !=3D "$ARCH" ]; then > - echo "skip $1 ($arch only)" > - return > + echo "`SKIP` $testname ($arch only)" > + return $EXIT_SKIP > fi > =20 > __eval_log "$check" || { > __eval_log 'echo "skipped $testname (check returned $?)"' > - echo "skip $testname (failed check)" > - return > + echo "`SKIP` $testname (failed check)" > + return $EXIT_SKIP > } > =20 > cmdline=3D"TESTNAME=3D$testname ACCEL=3D$accel __run $kernel -sm= p $smp $opts" > @@ -41,9 +48,9 @@ function run() > ret=3D$(($? >> 1)) > =20 > case $ret in > - 0) echo -ne "\e[32mPASS\e[0m" ;; > - 77) echo -ne "\e[33mSKIP\e[0m" ;; > - *) echo -ne "\e[31mFAIL\e[0m" > + $EXIT_SUCCESS) PASS ;; > + $EXIT_SKIP) SKIP ;; > + *) FAIL > esac > =20 > echo -n " $testname" > --=20 > 2.6.4 Otherwise Reviewed-by: Andrew Jones >=20 > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html