Skip to content
Lucas Meneghel Rodrigues edited this page Nov 28, 2012 · 5 revisions

Getting started with the virt test test runner

Pre-requisites

  1. A supported host platforms: Red Hat Enterprise Linux (RHEL) or Fedora.
Ubuntu and Debian should also work, but have not been very tested, and currently autotest is still not packaged for those, which means you have to clone autotest and put its path in an env variable so virt tests can find the autotest libs.
  1. Root access to setup and run tests
  2. Install software packages
  3. A copy of the virt test source

For the impatient

  1. Clone the virt test repo
git clone git://github.com/autotest/virt-test.git
  1. Get into the base dir
cd virt-test
  1. If you read Install software packages and provided the autotest dep, good. If not, please read this page!
  2. Get root, and execute the run script with appropriate options:

4.1) For kvm test users. The default KVM test set does not require root. Keep in mind that some tests might fail because of lack of superuser privileges, but we're trying to make as many tests as possible to work as non root. One particularly tricky area is networking testing, that usually needs access to a bridge, and currently that can only be acomplished with root.

$ ./run -t kvm

4.2) For libvirt test users. Libvirt basic tests still need root as of today (11/28/2012).

# ./run -t libvirt

Now, this is enough to trigger the environment setup procedure:

  1. Create the /var/tmp/libvirt_test dir to hold images and isos
  2. Download the JeOS image (120 MB, takes about 2 minutes on a fast connection) and uncompress it (takes about a minute on an HDD laptop). p7ip has to be present.
  3. Run a predefined set of tests.

Running different tests

You can list the available tests to run by using the flag --list-tests

$ ./run -t kvm --list-tests
(will print a numbered list of tests, with a paginator)

Then you can pass tests that interest you with --tests "list of tests", for example:

  1. KVM
$ ./run -t kvm --tests "migrate, timedrift, file_transfer"

2) Libvirt: Libvirt has a caveat: Since it's necessary to import the JeOS image into libvirt for it to count as a guest, if you want to run tests that are dependent of guests, you are better of starting the test set with "unattended_install.import.import boot". Since you want to remove the defined guest at the end of the test sequence, so you don't get a 'vm 'vm1' already exists error, you also want to finish with remove_guest.with_disk.

# ./run -t libvirt --tests "unattended_install.import.import boot, reboot, shutdown, remove_guest.with_disk"

Checking the results

The test runner will produce a debug log, that will be useful to debug problems:

[lmr@freedom virt-test.git]$ ./run -t kvm --tests boot_with_usb
SETUP: PASS (1.20 s)
DATA DIR: /path/to/home/virt_test
DEBUG LOG: /path/to/virt-test.git/logs/run-2012-11-28-11.31.25/debug.log
TESTS: 10
kvm.virtio_blk.smp2.virtio_net.JeOS.17.64.boot_with_usb.ehci: PASS (27.78 s)
kvm.virtio_blk.smp2.virtio_net.JeOS.17.64.boot_with_usb.keyboard.uhci: PASS (27.79 s)
kvm.virtio_blk.smp2.virtio_net.JeOS.17.64.boot_with_usb.keyboard.xhci: PASS (27.88 s)
kvm.virtio_blk.smp2.virtio_net.JeOS.17.64.boot_with_usb.mouse.uhci: PASS (27.99 s)
kvm.virtio_blk.smp2.virtio_net.JeOS.17.64.boot_with_usb.mouse.xhci: PASS (27.92 s)
kvm.virtio_blk.smp2.virtio_net.JeOS.17.64.boot_with_usb.usb_audio: PASS (27.98 s)
kvm.virtio_blk.smp2.virtio_net.JeOS.17.64.boot_with_usb.hub: PASS (27.79 s)
kvm.virtio_blk.smp2.virtio_net.JeOS.17.64.boot_with_usb.storage.uhci: PASS (27.86 s)
kvm.virtio_blk.smp2.virtio_net.JeOS.17.64.boot_with_usb.storage.ehci: PASS (28.18 s)
kvm.virtio_blk.smp2.virtio_net.JeOS.17.64.boot_with_usb.storage.xhci: PASS (28.03 s)

At any moment, in this example you can check /path/to/virt-test.git/logs/run-2012-11-28-11.31.25/debug.log for test details.

Clone this wiki locally