All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: kvm@vger.kernel.org
Cc: gleb@redhat.com
Subject: [PATCH] kvm-unit-test: more documentation and runner script
Date: Wed, 27 Feb 2013 17:55:57 +0200	[thread overview]
Message-ID: <20130227155557.GA23629@redhat.com> (raw)

Add documentation about using qemu-system for unit tests.
Add runner script to select the correct binary and flags.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 README  | 10 +++++++++-
 x86-run | 27 +++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100755 x86-run

diff --git a/README b/README
index 4ceb869..214397c 100644
--- a/README
+++ b/README
@@ -10,10 +10,18 @@ To create the tests' images just type 'make' in this directory.
 Tests' images created in ./<ARCH>/*.flat
 
 An example of a test invocation:
-qemu-system-x86_64 -device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out -serial stdio -kernel ./x86/msr.flat
+Using qemu-kvm:
+
+qemu-kvm -device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out -serial stdio -kernel ./x86/msr.flat
 This invocation runs the msr test case. The test outputs to stdio.
 
+Using qemu (supported since qemu 1.3):
+qemu-system-x86_64 -enable-kvm -device pc-testdev -serial stdio -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel ./x86/msr.flat
 
+Or use a runner script to detect the correct invocation:
+./x86-run ./x86/msr.flat
+To select a specific qemu binary, specify the QEMU=<path> environment:
+QEMU=/tmp/qemu/x86_64-softmmu/qemu-system-x86_64 ./x86-run ./x86/msr.flat
 
 Directory structure:
 .:  Makefile and config files for the tests
diff --git a/x86-run b/x86-run
new file mode 100755
index 0000000..cf1d38a
--- /dev/null
+++ b/x86-run
@@ -0,0 +1,27 @@
+#!/usr/bin/bash
+
+qemukvm="${QEMU:-qemu-kvm}"
+qemusystem="${QEMU:-qemu-system-x86_64}"
+if
+	${qemukvm} -device '?' 2>&1 | fgrep -e \"testdev\" -e \"pc-testdev\" > /dev/null;
+then
+	qemu="${qemukvm}"
+else
+	if
+		${qemsystem} -device '?' 2>&1 | fgrep -e \"testdev\" -e \"pc-testdev\" > /dev/null;
+	then
+		qemu="${qemusystem}"
+	else
+		echo QEMU binary ${QEMU} has no support for test device. Exiting.
+		exit 1
+	fi
+fi
+
+if
+	${qemu} -device '?' 2>&1 | fgrep "pc-testdev" > /dev/null;
+then
+	command="${qemu} -enable-kvm -device pc-testdev -serial stdio -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel"
+else
+	command="${qemu} -device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out -serial stdio -kernel ./x86/msr.flat"
+fi
+exec ${command} "$@"
-- 
MST

             reply	other threads:[~2013-02-27 15:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-27 15:55 Michael S. Tsirkin [this message]
2013-02-27 18:10 ` [PATCH] kvm-unit-test: more documentation and runner script Lucas Meneghel Rodrigues
2013-02-27 20:44   ` Michael S. Tsirkin
2013-02-27 21:03     ` Lucas Meneghel Rodrigues
2013-02-27 21:40       ` Michael S. Tsirkin
2013-02-28  9:06         ` Gleb Natapov
2013-02-28  9:45           ` Michael S. Tsirkin
2013-02-28  9:51             ` Gleb Natapov
2013-02-28 12:32               ` Lucas Meneghel Rodrigues

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=20130227155557.GA23629@redhat.com \
    --to=mst@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.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 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.