/kvm-unit-tests

Primary LanguageCOtherNOASSERTION

This directory contains sources for a kvm test suite.

Tests for x86 architecture are run as kernel images for qemu that supports multiboot format.
Tests uses an infrastructure called from the bios code. The infrastructure initialize the system/cpu's,
switch to long-mode and calls the 'main' function of the individual test.
Tests uses a qemu's virtual test device, named testdev, for services like printing, exiting, query memory size etc.
See file testdev.txt for more details.

To create the tests' images just type 'make' in this directory.
Tests' images created in ./<ARCH>/*.flat

An example of a test invocation:
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
./lib: general services for the tests
./lib/<ARCH>: architecture dependent services for the tests
./<ARCH>: the sources of the tests and the created objects/images