From patchwork Tue Jan 26 18:42:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 8126381 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 89EBC9F1C0 for ; Tue, 26 Jan 2016 18:42:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A1485202E6 for ; Tue, 26 Jan 2016 18:42:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6F9A2027D for ; Tue, 26 Jan 2016 18:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751355AbcAZSmW (ORCPT ); Tue, 26 Jan 2016 13:42:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55472 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751230AbcAZSmV (ORCPT ); Tue, 26 Jan 2016 13:42:21 -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 527F9C0A9CCC for ; Tue, 26 Jan 2016 18:42:21 +0000 (UTC) Received: from hawk.localdomain.com (dhcp-1-158.brq.redhat.com [10.34.1.158]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0QIgFMc014029; Tue, 26 Jan 2016 13:42:18 -0500 From: Andrew Jones To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com Subject: [kvm-unit-tests PATCH 2/6] run scripts need consistent exit status Date: Tue, 26 Jan 2016 19:42:07 +0100 Message-Id: <1453833731-23215-3-git-send-email-drjones@redhat.com> In-Reply-To: <1453833731-23215-1-git-send-email-drjones@redhat.com> References: <1453833731-23215-1-git-send-email-drjones@redhat.com> 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, 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 When a script fails on something build related, e.g. ./configure hasn't been run, or usage related, e.g. a bad parameter, then an exit status of 1 makes sense, as no test was attempted. However, if a test is attempted, then we now need to reserve an exit status of 1 for QEMU failures. arch-run scripts and standalone generated run scripts should always use 2, as it's assumed that attempting to run those attempt to run the test. (Additional cleanup; remove return values from a couple of "void" functions in scripts/mkstandalone) Signed-off-by: Andrew Jones --- run_tests.sh | 4 ++-- scripts/mkstandalone.sh | 14 ++++++-------- scripts/runtime.bash | 4 ++-- x86/run | 6 ++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 558b8e7431d8e..5b0aec1c599c0 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -4,7 +4,7 @@ verbose="no" if [ ! -f config.mak ]; then echo "run ./configure && make first. See ./configure -h" - exit + exit 1 fi source config.mak source scripts/functions.bash @@ -41,7 +41,7 @@ while getopts "g:hv" opt; do verbose="yes" ;; *) - exit + exit 1 ;; esac done diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh index b0f1e7c098afb..a8781b0c9835f 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -2,7 +2,7 @@ if [ ! -f config.mak ]; then echo "run ./configure && make first. See ./configure -h" - exit + exit 1 fi source config.mak source scripts/functions.bash @@ -21,7 +21,7 @@ temp_file () echo "$var=\`mktemp\`" echo "cleanup=\"\$$var \$cleanup\"" - echo "base64 -d << 'BIN_EOF' | zcat > \$$var || exit 1" + echo "base64 -d << 'BIN_EOF' | zcat > \$$var || exit 2" gzip - < $file | base64 @@ -47,8 +47,8 @@ generate_test () if [ ! -f $kernel ]; then echo 'echo "skip '"$testname"' (test kernel not present)"' - echo 'exit 1' - return 1 + echo 'exit 2' + return fi echo "trap 'rm -f \$cleanup' EXIT" @@ -68,11 +68,11 @@ function mkstandalone() local testname="$1" if [ -z "$testname" ]; then - return 1 + return fi if [ -n "$one_testname" ] && [ "$testname" != "$one_testname" ]; then - return 1 + return fi standalone=tests/$testname @@ -81,8 +81,6 @@ function mkstandalone() chmod +x $standalone echo Written $standalone. - - return 0 } trap 'rm -f $cfg' EXIT diff --git a/scripts/runtime.bash b/scripts/runtime.bash index 63d1b9653007b..04adb9d070f13 100644 --- a/scripts/runtime.bash +++ b/scripts/runtime.bash @@ -23,7 +23,7 @@ function run() if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then echo "skip $1 ($arch only)" - return + return 2 fi # check a file for a particular value before running a test @@ -34,7 +34,7 @@ function run() value=${check_param#*=} if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then echo "skip $1 ($path not equal to $value)" - return + return 2 fi done diff --git a/x86/run b/x86/run index bdd7c7e394e45..22d7f2cad0d06 100755 --- a/x86/run +++ b/x86/run @@ -1,6 +1,4 @@ #!/bin/bash -NOTFOUND=1 -TESTDEVNOTSUPP=2 qemubinarysearch="${QEMU:-qemu-kvm qemu-system-x86_64}" @@ -19,11 +17,11 @@ done if [ -z "${QEMUFOUND}" ] then echo "A QEMU binary was not found, You can set a custom location by using the QEMU= environment variable " - exit ${NOTFOUND} + exit 2 elif [ -z "${qemu}" ] then echo "No Qemu test device support found" - exit ${TESTDEVNOTSUPP} + exit 2 fi if