Build
-----
qemu-test will build a Linux kernel and initramfs based on busybox. The
initramfs will pull in your local glibc.
Since the initrd and kernel are git submodules, you need to first fetch the
submodules:
$ git submodule update --init
If you have a local kernel tree, you may want to use that instead of
git.kernel.org. To do this:
$ git submodule init
$ # update .gitmodules to point to your local tree
$ git submodule update
After updating submodules, to build the initrd and kernel, do:
$ make
Once the modules are built, you can issue a *make clean* to clean up the working
directory. *make clean* will not remove the final kernel/initramfs.
Running Tests
-------------
To run a new test, execute:
$ ./qemu-test ~/build/qemu/x86_64-softmmu/qemu-system-x86_64 \
tests/no-vga-pci-allocation.sh
The first argument is the QEMU executable to use. The second is the test shell
script.
If you get an error about QEMU_SRC not being set, you'll need to set the
QEMU_SRC environment variable to point to your qemu.git tree. It should be at
least qemu-1.0.
Writing New Tests
-----------------
Each test is a single shell script. If the environmental variable QEMU_TEST is
set, then the shell script is being used to launch qemu. If it is not set, then
the shell script is running in the guest and can be used to run guest code.
In both cases, failure is indicated by exiting with a non-zero exit status.
When running in the host, the following commands are avaiable:
- qmp -- execute a qmp command. 'qmp human-monitor-command' can be used to
execute HMP commands.
- qemu -- a light wrapper around the user supplied qemu executable.
The qemu wrapper tracks standard output from the test and implements a timeout.
If no new text appears on stdout after 10 seconds, the guest is assumed to be
hung. Please write your tests accordingly.
The wrapper also constantly interacts with QMP attempting to detect when QEMU
itself is locked up.
Submitting Tests
----------------
Send new tests to qemu-devel@nongnu.org
Tips on Writing New Tests
-------------------------
- Tests should fail and pass as quickly as possible
- Running a test should test one piece of functionality. If you want to test
multiple scenarios in one test file, consider using $RANDOM to choose which
scenario is run.