From patchwork Thu Dec 17 17:53:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= X-Patchwork-Id: 7875781 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EA127BEEED for ; Thu, 17 Dec 2015 17:54:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C48D2009C for ; Thu, 17 Dec 2015 17:54:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 000292044C for ; Thu, 17 Dec 2015 17:54:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754284AbbLQRy3 (ORCPT ); Thu, 17 Dec 2015 12:54:29 -0500 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) Received: from potion (dhcp-1-105.brq.redhat.com [10.34.1.105]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id tBHHsPA5026681; Thu, 17 Dec 2015 12:54:26 -0500 Received: by potion (sSMTP sendmail emulation); Thu, 17 Dec 2015 18:54:25 +0100 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= To: kvm@vger.kernel.org Cc: Paolo Bonzini , Andrew Jones 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> In-Reply-To: <1450374823-7648-1-git-send-email-rkrcmar@redhat.com> References: <1450374823-7648-1-git-send-email-rkrcmar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ugly helpers will get us yellow "SKIP" to stdout and 77 on exit. Signed-off-by: Radim Kr?má? Reviewed-by: Andrew Jones --- v2: new 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 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 cmdline="\`echo '$cmdline' | sed s%$kernel%_NO_FILE_4Uhere_%\`" if \$qemu \$cmdline 2>&1 | grep 'No accelerator found' >/dev/null; then - echo "skip $testname (QEMU doesn't support KVM)" - exit 1 + echo "\$(SKIP) $testname (QEMU doesn't support KVM)" + exit \$EXIT_SKIP fi __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=0 +EXIT_SKIP=77 + function run() { local testname="$1" @@ -10,22 +17,22 @@ function run() local accel="$8" if [ -z "$testname" ]; then - return + return $EXIT_SKIP fi if [ -n "$only_group" ] && ! grep -q "$only_group" <<<$groups; then - return + return $EXIT_SKIP fi if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then - echo "skip $1 ($arch only)" - return + echo "`SKIP` $testname ($arch only)" + return $EXIT_SKIP fi __eval_log "$check" || { __eval_log 'echo "skipped $testname (check returned $?)"' - echo "skip $testname (failed check)" - return + echo "`SKIP` $testname (failed check)" + return $EXIT_SKIP } cmdline="TESTNAME=$testname ACCEL=$accel __run $kernel -smp $smp $opts" @@ -41,9 +48,9 @@ function run() ret=$(($? >> 1)) 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 echo -n " $testname"