Skip to contentSkip to conversation

Suport for qemu-iotests from inside KVM autotest

PATCH New Lucas Meneghel Rodrigues 1 participant 3 messages Dec 1, 2011 KVM

lore
Share & tools
lore
#0 lore raw

cover Suport for qemu-iotests from inside KVM autotest

Currently, qemu-iotests is implemented outside the KVM autotest realm. Although convenient if you want to test the default qemu shipped with your distro, it's not so convenient to integrate with the KVM autotest workflow.

In order to take advantage of the fact kvm autotest tests are already testing a set of paths [qemu, qemu-img and qemu-io], implement a qemu-iotests that fetch the latest testsuite from git and run the available tests, with the appropriate qemu paths.

Lucas Meneghel Rodrigues (2):
KVM test: Make tests aware of the qemu-io path KVM test: Introduce qemu_iotests for the KVM test

 client/tests/kvm/base.cfg.sample       |    1 +
 client/tests/kvm/subtests.cfg.sample   |   13 +++++++
 client/tests/kvm/tests.cfg.sample      |    4 ++
 client/tests/kvm/tests/qemu_iotests.py |   62 ++++++++++++++++++++++++++++++++
 client/virt/kvm_installer.py           |   24 ++++++++++++
 5 files changed, 104 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/tests/qemu_iotests.py
Signature · 1 line
1.7.7.3
#1 lore raw

PATCH 1/2 KVM test: Make tests aware of the qemu-io path

As it is important for qemu-iotests that this particular program is used.

---
 client/tests/kvm/base.cfg.sample  |    1 +
 client/tests/kvm/tests.cfg.sample |    4 ++++
 client/virt/kvm_installer.py      |   24 ++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 0 deletions(-)
client/tests/kvm/base.cfg.sample +1 -0
index c99add6..21fa513 100644
@@ -3,6 +3,7 @@
 # Absolute paths and/or names of binaries (default path is /usr/bin)
 qemu_binary = qemu
 qemu_img_binary = qemu-img
+qemu_io_binary = qemu-io
 
 # List of virtual machine object names (whitespace seperated)
 vms = vm1
client/tests/kvm/tests.cfg.sample +4 -0
index b011540..bd0d05e 100644
@@ -60,6 +60,7 @@ variants:
         # We want qemu-kvm for this run
         qemu_binary = /usr/bin/qemu-kvm
         qemu_img_binary = /usr/bin/qemu-img
+        qemu_io_binary = /usr/bin/qemu-io
         # Only qcow2 file format
         only qcow2
         # Only rtl8139 for nw card (default on qemu-kvm)
@@ -82,6 +83,7 @@ variants:
         # We want qemu for this run
         qemu_binary = /usr/bin/qemu
         qemu_img_binary = /usr/bin/qemu-img
+        qemu_io_binary = /usr/bin/qemu-io
         only qcow2
         # The default nw card for qemu is e1000
         only e1000
@@ -100,6 +102,7 @@ variants:
         # We want qemu-kvm for this run
         qemu_binary = /usr/bin/qemu-kvm
         qemu_img_binary = /usr/bin/qemu-img
+        qemu_io_binary = /usr/bin/qemu-io
         only qcow2
         only rtl8139
         only ide
@@ -117,6 +120,7 @@ variants:
         # We want qemu-kvm for this run
         qemu_binary = /usr/bin/qemu-kvm
         qemu_img_binary = /usr/bin/qemu-img
+        qemu_io_binary = /usr/bin/qemu-io
         only qcow2
         only rtl8139
         only ide
client/virt/kvm_installer.py +24 -0
index 6bebd87..2af359d 100644
@@ -32,6 +32,7 @@ class KVMBaseInstaller(base_installer.BaseInstaller):
     #
     QEMU_BIN = 'qemu'
     QEMU_IMG_BIN = 'qemu-img'
+    QEMU_IO_BIN = 'qemu-io'
 
 
     def _kill_qemu_processes(self):
@@ -131,6 +132,23 @@ class KVMBaseInstaller(base_installer.BaseInstaller):
             return None
 
 
+    def _qemu_io_bin_exists_at_prefix(self):
+        '''
+        Attempts to find the qemu-io binary at the installation prefix
+
+        @return: full path of qemu-io binary or None if not found
+        '''
+        qemu_io_bin_name = os.path.join(self.install_prefix,
+                                         'bin', self.QEMU_IO_BIN)
+        if os.path.isfile(qemu_io_bin_name):
+            logging.debug('Found qemu-io binary at %s', qemu_io_bin_name)
+            return qemu_io_bin_name
+        else:
+            logging.debug('Could not find qemu-img binary at prefix %s',
+                          self.install_prefix)
+            return None
+
+
     def _create_symlink_qemu(self):
         """
         Create symbolic links for qemu and qemu-img commands on test bindir
@@ -141,6 +159,7 @@ class KVMBaseInstaller(base_installer.BaseInstaller):
 
         qemu_dst = os.path.join(self.test_bindir, self.QEMU_BIN)
         qemu_img_dst = os.path.join(self.test_bindir, self.QEMU_IMG_BIN)
+        qemu_io_dst = os.path.join(self.test_bindir, self.QEMU_IO_BIN)
 
         qemu_bin = self._qemu_bin_exists_at_prefix()
         if qemu_bin is not None:
@@ -154,6 +173,11 @@ class KVMBaseInstaller(base_installer.BaseInstaller):
         else:
             raise error.TestError('Invalid qemu-img path')
 
+        qemu_io_bin = self._qemu_io_bin_exists_at_prefix()
+        if qemu_img_bin is not None:
+            os.symlink(qemu_io_bin, qemu_io_dst)
+        else:
+            raise error.TestError('Invalid qemu-img path')
 
     def _install_phase_init(self):
         '''
Signature · 1 line
1.7.7.3
#2 lore raw

PATCH 2/2 KVM test: Introduce qemu_iotests for the KVM test

In reply to Lucas Meneghel Rodrigues

In order to run always the latest up to date qemu iotests on all KVM branches, insert qemu-iotests execution inside KVM autotest. It'll attempt to git fetch the latest contents of the qemu-iotests test suite, then carry on with tests, reporting errors to autotest.

Besides having the latest test, with this approach it is easier to specify to the test suite which paths we want to get tested, which are under kvm autotest's control. This patch actually depends on a couple of patches sent to the qemu_iotest upstream maintainers.

---
 client/tests/kvm/subtests.cfg.sample   |   13 +++++++
 client/tests/kvm/tests/qemu_iotests.py |   62 ++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/tests/qemu_iotests.py
client/tests/kvm/subtests.cfg.sample +13 -0
index 55f1b21..9b997dd 100644
@@ -80,6 +80,19 @@ variants:
                 extra_params = " --append ks=REPLACE_THIS_WITH_URL_OF_KS"
                 url = REPLACE_THIS_WITH_TREE_URL
 
+    - qemu_iotests:
+        type = qemu_iotests
+        vms = ''
+        profilers = ''
+        take_regular_screendumps = no
+        qemu_io_uri = git://git.kernel.org/pub/scm/linux/kernel/git/hch/qemu-iotests.git
+        qemu_io_branch = master
+        qemu_io_lbranch = master
+        qemu_io_formats = "raw qcow qcow2 qed vdi vpc vmdk rdb sheepdog"
+        #qemu_io_commit =
+        #qemu_io_base_uri =
+        #qemu_io_extra_options =
+
     - qemu_img:
         type = qemu_img
         vms = ''
client/tests/kvm/tests/qemu_iotests.py new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
1.7.7.3