Virt is a suite of tests made to exercise different linux virtualization hypervisors. At the time of this writing (01/09/2013), there are 4 virt types covered:
- QEMU (previously known as KVM)
- V2V (which is an utility to convert virtual machines from different systems)
- Openvswitch (Networking technology set to replace bridges)
Those tests were separated from the autotest git repo and became their own project. It's possible to use the virt tests in autotest just fine, but also run the tests through a stand alone test runner. The virt tests do require a few core autotest libraries to function, but those can be provided either by exporting an environment variable containing a path to an autotest git tree, or installing the autotest core through an RPM package (available on the Fedora repos). If you are curious about the parent project, autotest, you can check out its wiki page.
这些测试项目是从autotest git repo中分离，并成为独立的项目。在autotest中运行测试virt tests是没问题的，而且单独测试运行也是可以的。Virt test依赖一些核心的autotest库函数，不过它们大多被autotest git tree以环境变量包含的路径导入，或者通过RPM软件包安装autotest 。如果你很好奇virt test的父项目——autotest，可以访问wiki。
0. Install dependencies Red Hat based：
# yum install p7zip autotest-framework tcpdump nmap-ncat git python-devel python-imaging
Clone the virt test repo
# git clone git://github.com/autotest/virt-test.git
Get into the base dir
# cd virt-test
Run the [subtest]/get_started.py script. For example, if you want to run the qemu subtest, you will run:
This script will check if you have the minimum requirements for the test (required commands and includes), and download the JeOS image. You can omit running this script, since the code of this script also gets to run when you call the test runner, but it is discouraged. Explicitly running get_started.py first is interactive, and gives you a better idea of what is going on.
当测试环境是最小化安装时（仅仅使用git clone），脚本将会检查，并下载JeOS image.也可以忽略这个脚本，因为当测试代码运行时，也会运行它（不过并不推荐这么使用）。首先交互式的运行 get_started.py, 将会提供给你一个更好的方式。
For qemu and libvirt subtests, the default test set does not require root. However, other tests might fail due to lack of privileges.
# ./run -t qemu
# ./run -t libvirtIf you ran get_started.py, the test runner should just run the test. If you didn't, the runner will trigger the environment setup procedure:
- Create the /var/tmp/libvirt_test dir to hold images and isos
- Download the JeOS image (180 MB, takes about 3 minutes on a fast connection) and uncompress it (takes about a minute on an HDD laptop). p7ip has to be present.
- Run a predefined set of tests.
You can list the available tests to run by using the flag --list-tests
$ ./run -t qemu --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:
$ ./run -t qemu --tests "migrate timedrift file_transfer"
- Libvirt requires first importing the JeOS image. However, this cannot be done if the guest already exists. Therefore, it's wise to also conclude a set with the remove_guest.without_disk test.
# ./run -t libvirt --tests "unattended_install.import.import boot reboot remove_guest.without_disk"