From: alex.bennee@linaro.org (Alex Bennée)
To: linux-arm-kernel@lists.infradead.org
Subject: [kvm-unit-tests PATCH 6/6] run_tests: allow passing of options to QEMU
Date: Wed, 11 Jan 2017 16:28:41 +0000 [thread overview]
Message-ID: <20170111162841.15569-7-alex.bennee@linaro.org> (raw)
In-Reply-To: <20170111162841.15569-1-alex.bennee@linaro.org>
This allows additional options to be passed to QEMU. It follows the
convention of passing parameters after a -- to the child process. In
my case I'm using it to toggle MTTCG on an off:
./run_tests.sh -- --accel tcg,thread=multi
Signed-off-by: Alex Benn?e <alex.bennee@linaro.org>
---
v1
- changes from -o to --
- fixed whitespace damage
---
README.md | 6 ++++++
run_tests.sh | 13 +++++++++++--
scripts/functions.bash | 7 ++++---
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index fa3a445..1bd6dcb 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,12 @@ To extend or disable the timeouts:
TIMEOUT=0 ./run_tests.sh
+Any arguments past the end-of-arguments marker (--) is passed on down
+to the QEMU invocation. This can of course be combined with the other
+modifiers:
+
+ ACCEL=tcg ./run_tests.sh -v -- --accel tcg,thread=multi
+
# Contributing
## Directory structure
diff --git a/run_tests.sh b/run_tests.sh
index 254129d..3270fba 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -13,7 +13,7 @@ function usage()
{
cat <<EOF
-Usage: $0 [-g group] [-h] [-v]
+Usage: $0 [-g group] [-h] [-v] [-- QEMU options]
-g: Only execute tests in the given group
-h: Output this help text
@@ -22,6 +22,8 @@ Usage: $0 [-g group] [-h] [-v]
Set the environment variable QEMU=/path/to/qemu-system-ARCH to
specify the appropriate qemu binary for ARCH-run.
+All options specified after -- are passed on to QEMU.
+
EOF
}
@@ -29,6 +31,7 @@ RUNTIME_arch_run="./$TEST_DIR/run"
source scripts/runtime.bash
while getopts "g:hv" opt; do
+
case $opt in
g)
only_group=$OPTARG
@@ -46,6 +49,12 @@ while getopts "g:hv" opt; do
esac
done
+# Any options left for QEMU?
+shift $((OPTIND-1))
+if [ "$#" -gt 0 ]; then
+ extra_opts="$@"
+fi
+
RUNTIME_log_stderr () { cat >> test.log; }
RUNTIME_log_stdout () {
if [ "$PRETTY_PRINT_STACKS" = "yes" ]; then
@@ -59,4 +68,4 @@ RUNTIME_log_stdout () {
config=$TEST_DIR/unittests.cfg
rm -f test.log
printf "BUILD_HEAD=$(cat build-head)\n\n" > test.log
-for_each_unittest $config run
+for_each_unittest $config run "$extra_opts"
diff --git a/scripts/functions.bash b/scripts/functions.bash
index ee9143c..60fbc6a 100644
--- a/scripts/functions.bash
+++ b/scripts/functions.bash
@@ -3,10 +3,11 @@ function for_each_unittest()
{
local unittests="$1"
local cmd="$2"
+ local extra_opts=$3
local testname
local smp
local kernel
- local opts
+ local opts=$extra_opts
local groups
local arch
local check
@@ -21,7 +22,7 @@ function for_each_unittest()
testname=${BASH_REMATCH[1]}
smp=1
kernel=""
- opts=""
+ opts=$extra_opts
groups=""
arch=""
check=""
@@ -32,7 +33,7 @@ function for_each_unittest()
elif [[ $line =~ ^smp\ *=\ *(.*)$ ]]; then
smp=${BASH_REMATCH[1]}
elif [[ $line =~ ^extra_params\ *=\ *(.*)$ ]]; then
- opts=${BASH_REMATCH[1]}
+ opts="$opts ${BASH_REMATCH[1]}"
elif [[ $line =~ ^groups\ *=\ *(.*)$ ]]; then
groups=${BASH_REMATCH[1]}
elif [[ $line =~ ^arch\ *=\ *(.*)$ ]]; then
--
2.11.0
next prev parent reply other threads:[~2017-01-11 16:28 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-11 16:28 [kvm-unit-tests PATCH 0/6] Documentation misc fixes Alex Bennée
2017-01-11 16:28 ` [kvm-unit-tests PATCH 1/6] libcflat: add PRI(dux)32 format types Alex Bennée
2017-01-12 12:29 ` Paolo Bonzini
2017-01-12 12:39 ` Alex Bennée
2017-01-12 16:56 ` Andrew Jones
2017-01-12 17:18 ` Alex Bennée
2017-01-12 17:43 ` Andrew Jones
2017-01-12 17:44 ` Paolo Bonzini
2017-01-12 18:01 ` Alex Bennée
2017-01-13 18:03 ` Andrew Jones
2017-01-11 16:28 ` [kvm-unit-tests PATCH 2/6] lib/pci: fix BAR format strings Alex Bennée
2017-01-12 12:35 ` Paolo Bonzini
2017-01-11 16:28 ` [kvm-unit-tests PATCH 3/6] docs: move README to README.md and symlink Alex Bennée
2017-01-12 17:04 ` Andrew Jones
2017-01-11 16:28 ` [kvm-unit-tests PATCH 4/6] docs: mention checkpatch in the README Alex Bennée
2017-01-12 12:29 ` Paolo Bonzini
2017-01-12 12:35 ` Alex Bennée
2017-01-12 17:09 ` Andrew Jones
2017-01-12 17:08 ` Andrew Jones
2017-01-11 16:28 ` [kvm-unit-tests PATCH 5/6] docs: mention modifying env vars in README Alex Bennée
2017-01-12 17:14 ` Andrew Jones
2017-01-11 16:28 ` Alex Bennée [this message]
2017-01-12 12:30 ` [kvm-unit-tests PATCH 6/6] run_tests: allow passing of options to QEMU Paolo Bonzini
2017-01-12 17:32 ` Andrew Jones
2017-01-12 17:50 ` Paolo Bonzini
2017-01-17 12:07 ` Alex Bennée
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=20170111162841.15569-7-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).