From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PATCH kvm-unit-tests v2 11/12] wrappers: consolidate skip output Date: Thu, 17 Dec 2015 18:53:42 +0100 Message-ID: <1450374823-7648-12-git-send-email-rkrcmar@redhat.com> References: <1450374823-7648-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]:45540 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753267AbbLQRy2 (ORCPT ); Thu, 17 Dec 2015 12:54:28 -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 184D18F4F8 for ; Thu, 17 Dec 2015 17:54:28 +0000 (UTC) In-Reply-To: <1450374823-7648-1-git-send-email-rkrcmar@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Ugly helpers will get us yellow "SKIP" to stdout and 77 on exit. 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(-) 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; the= n - 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"; } + +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; the= n - 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 -smp = $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