From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, rkrcmar@redhat.com
Subject: [kvm-unit-tests PATCH v3 2/6] run scripts need consistent exit status
Date: Mon, 29 Feb 2016 19:53:19 +0100 [thread overview]
Message-ID: <1456772003-27911-3-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1456772003-27911-1-git-send-email-drjones@redhat.com>
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 <drjones@redhat.com>
Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
---
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 2c8af36b2726e..10de5474a0b42 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 c7e78f83fb086..408bb05480b11 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"
@@ -73,11 +73,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
@@ -86,8 +86,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=<path> environment variable "
- exit ${NOTFOUND}
+ exit 2
elif [ -z "${qemu}" ]
then
echo "No Qemu test device support found"
- exit ${TESTDEVNOTSUPP}
+ exit 2
fi
if
--
2.4.3
next prev parent reply other threads:[~2016-02-29 18:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-29 18:53 [kvm-unit-tests PATCH v3 0/6] reduce exit status ambiguity and more Andrew Jones
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 1/6] x86: clean up exit use, use abort Andrew Jones
2016-02-29 18:53 ` Andrew Jones [this message]
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 3/6] arch-run: reduce return code ambiguity Andrew Jones
2016-03-01 21:29 ` Paolo Bonzini
2016-03-02 12:57 ` Radim Krčmář
2016-03-02 14:44 ` Paolo Bonzini
2016-03-02 15:42 ` Radim Krčmář
2016-03-02 16:05 ` Paolo Bonzini
2016-03-02 17:13 ` Radim Krčmář
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 4/6] cleanup unittests.cfg headers Andrew Jones
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 5/6] runtime: enable some unittest config overriding Andrew Jones
2016-02-29 18:53 ` [kvm-unit-tests PATCH v3 6/6] run scripts: add timeout support Andrew Jones
2016-03-01 21:30 ` [kvm-unit-tests PATCH v3 0/6] reduce exit status ambiguity and more Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456772003-27911-3-git-send-email-drjones@redhat.com \
--to=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.