Virt autotest documentation

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:

Virt是一组用于测试Linux虚拟化超级管理器的套件。在写本文是 (01/09/2013),已经有4种virt形式被覆盖到。

  • QEMU (previously known as KVM)
  • Libvirt
  • 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

  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. Run the [subtest]/get_started.py script. For example, if you want to run the qemu subtest, you will run:

  # qemu/get_started.py

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, 将会提供给你一个更好的方式。

  1. For qemu and libvirt subtests, the default test set does not require root. However, other tests might fail due to lack of privileges.

  对于qemu和libvirt子测试系统,默认是不需要root用户的,然而其他测试可能会因为缺少权限而失败。

  #  ./run -t qemu

or

  # ./run -t libvirt

If 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:
  1. Create the /var/tmp/libvirt_test dir to hold images and isos
  2. 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.
  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 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:

  1. qemu

  $ ./run -t qemu --tests "migrate timedrift file_transfer"

  1. 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"

Checking the results

 

posted @ 2013-09-25 23:31  风刃  阅读(525)  评论(0编辑  收藏  举报