From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, mtosatti@redhat.com, jen@redhat.com
Subject: [kvm-unit-tests PATCH 3/9] run_tests.sh: add '-d' for dry-run
Date: Fri, 10 Jul 2015 18:44:57 +0200 [thread overview]
Message-ID: <1436546703-12258-4-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1436546703-12258-1-git-send-email-drjones@redhat.com>
Add an option that allows us to just get the qemu command line
for each test. Running ./run_tests.sh -d will result in each
test saying it passed, and test.log will contain a list of each
qemu command line that would have been executed, had it not been
a dry-run.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
arm/run | 12 +++++++-----
run_tests.sh | 41 +++++++++++++++++++++++++----------------
x86/run | 11 +++++++----
3 files changed, 39 insertions(+), 25 deletions(-)
diff --git a/arm/run b/arm/run
index e50709dcd12f4..3eacf3b77d625 100755
--- a/arm/run
+++ b/arm/run
@@ -48,9 +48,11 @@ fi
command="$qemu $M -cpu $processor $chr_testdev"
command+=" -display none -serial stdio -kernel"
-
echo $command "$@"
-$command "$@"
-ret=$?
-echo Return value from qemu: $ret
-exit $ret
+
+if [ "$DRYRUN" != "yes" ]; then
+ $command "$@"
+ ret=$?
+ echo Return value from qemu: $ret
+ exit $ret
+fi
diff --git a/run_tests.sh b/run_tests.sh
index 6f00aa495744c..4246f1b60a733 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -28,22 +28,24 @@ function run()
return
fi
- if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then
- echo "skip $1 ($arch only)"
- return
- fi
-
- # check a file for a particular value before running a test
- # the check line can contain multiple files to check separated by a space
- # but each check parameter needs to be of the form <path>=<value>
- for check_param in ${check[@]}; do
- path=${check_param%%=*}
- value=${check_param#*=}
- if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then
- echo "skip $1 ($path not equal to $value)"
+ if [ "$DRYRUN" != "yes" ]; then
+ if [ -n "$arch" ] && [ "$arch" != "$ARCH" ]; then
+ echo "skip $1 ($arch only)"
return
fi
- done
+
+ # Check a file for a particular value before running a test. The
+ # check line can contain multiple files to check, separated by a space,
+ # but each check parameter needs to be of the form <path>=<value>
+ for check_param in ${check[@]}; do
+ path=${check_param%%=*}
+ value=${check_param#*=}
+ if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then
+ echo "skip $1 ($path not equal to $value)"
+ return
+ fi
+ done
+ fi
cmdline="./$TEST_DIR-run $kernel -smp $smp $opts"
if [ $verbose != 0 ]; then
@@ -108,11 +110,13 @@ function usage()
{
cat <<EOF
-Usage: $0 [-g group] [-h] [-v]
+Usage: $0 [-g group] [-h] [-v] [-d]
-g: Only execute tests in the given group
-h: Output this help text
-v: Enables verbose mode
+ -d: Dry-run only. Just output the qemu command lines
+ that would be executed.
Set the environment variable QEMU=/path/to/qemu-system-ARCH to
specify the appropriate qemu binary for ARCH-run.
@@ -121,7 +125,7 @@ EOF
}
>test.log
-while getopts "g:hv" opt; do
+while getopts "g:hvd" opt; do
case $opt in
g)
only_group=$OPTARG
@@ -133,10 +137,15 @@ while getopts "g:hv" opt; do
v)
verbose=1
;;
+ d)
+ echo "DRYRUN=yes" >> config.mak
+ ;;
*)
exit
;;
esac
done
+source config.mak # reload, parsing options may have changed it
run_all $config
+sed -i '/^DRYRUN=.*/d' config.mak
diff --git a/x86/run b/x86/run
index d00e8fece4b6d..38b56e9a6b531 100755
--- a/x86/run
+++ b/x86/run
@@ -54,7 +54,10 @@ fi
command="${qemu} -enable-kvm $pc_testdev -vnc none -serial stdio $pci_testdev -kernel"
echo ${command} "$@"
-${command} "$@"
-ret=$?
-echo Return value from qemu: $ret
-exit $ret
+
+if [ "$DRYRUN" != "yes" ]; then
+ ${command} "$@"
+ ret=$?
+ echo Return value from qemu: $ret
+ exit $ret
+fi
--
2.4.3
next prev parent reply other threads:[~2015-07-10 16:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 16:44 [kvm-unit-tests PATCH 0/9] Generate standalone tests Andrew Jones
2015-07-10 16:44 ` [kvm-unit-tests PATCH 1/9] x86/run: source config.mak Andrew Jones
2015-07-10 16:44 ` [kvm-unit-tests PATCH 2/9] run_tests.sh: remove blank line from start of log Andrew Jones
2015-07-10 16:44 ` Andrew Jones [this message]
2015-07-10 16:44 ` [kvm-unit-tests PATCH 4/9] run_tests.sh: allow default unittests.cfg override Andrew Jones
2015-07-10 16:44 ` [kvm-unit-tests PATCH 5/9] unittests.cfg: use double quotes Andrew Jones
2015-07-10 16:45 ` [kvm-unit-tests PATCH 6/9] arm/unittests.cfg: make test names more friendly Andrew Jones
2015-07-10 16:45 ` [kvm-unit-tests PATCH 7/9] scripts: introduce mk[all]standalone.sh Andrew Jones
2015-07-10 16:45 ` [kvm-unit-tests PATCH 8/9] Makefile: change 'make install' to install standalone tests Andrew Jones
2015-07-10 16:45 ` [kvm-unit-tests PATCH 9/9] standalone: add documentation to README Andrew Jones
2015-07-13 9:46 ` [kvm-unit-tests PATCH 0/9] Generate standalone tests Andrew Jones
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=1436546703-12258-4-git-send-email-drjones@redhat.com \
--to=drjones@redhat.com \
--cc=jen@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox