All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] kvm-unit-test: more documentation and runner script
@ 2013-02-28  7:06 Michael S. Tsirkin
  2013-03-04 23:28 ` [PATCHv2] kvm-unit-test: more documentation and runner script\ Marcelo Tosatti
  0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2013-02-28  7:06 UTC (permalink / raw)
  To: kvm; +Cc: lmr, gleb

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>
---

Changes from v1:
	fix typo for qemu-system flags
	add lmr's comment about exit status

 README  | 15 ++++++++++++++-
 x86-run | 27 +++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100755 x86-run

diff --git a/README b/README
index 4ceb869..db525e3 100644
--- a/README
+++ b/README
@@ -10,10 +10,23 @@ 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
 
+The exit status of the binary (and the script) is inconsistent: with
+qemu-system, after the unittest is done, the exit status of qemu is 1,
+different from the 'old style' qemu-kvm, whose exit status in successful
+completion is 0.
 
 Directory structure:
 .:  Makefile and config files for the tests
diff --git a/x86-run b/x86-run
new file mode 100755
index 0000000..e395a70
--- /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"
+fi
+exec ${command} "$@"
-- 
MST

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCHv2] kvm-unit-test: more documentation and runner script\
  2013-02-28  7:06 [PATCHv2] kvm-unit-test: more documentation and runner script Michael S. Tsirkin
@ 2013-03-04 23:28 ` Marcelo Tosatti
  0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2013-03-04 23:28 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: kvm, lmr, gleb

On Thu, Feb 28, 2013 at 09:06:07AM +0200, Michael S. Tsirkin wrote:
> 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>
> ---
> 
> Changes from v1:
> 	fix typo for qemu-system flags
> 	add lmr's comment about exit status

Applied, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-04 23:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-28  7:06 [PATCHv2] kvm-unit-test: more documentation and runner script Michael S. Tsirkin
2013-03-04 23:28 ` [PATCHv2] kvm-unit-test: more documentation and runner script\ Marcelo Tosatti

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.