diff mbox

KVM test: build subtest: Add path_to_rom_images

Message ID 1290017224-4298-1-git-send-email-lmr@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Meneghel Rodrigues Nov. 17, 2010, 6:07 p.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/build.cfg.sample b/client/tests/kvm/build.cfg.sample
index 860192b..b6a20f7 100644
--- a/client/tests/kvm/build.cfg.sample
+++ b/client/tests/kvm/build.cfg.sample
@@ -23,6 +23,9 @@  variants:
                 # release_tag = 84
                 release_dir = http://downloads.sourceforge.net/project/kvm/
                 release_listing = http://sourceforge.net/projects/kvm/files/
+                # In some cases, you might want to provide a ROM dir, so ROM
+                # files can be copied from there to your source based install
+                # path_to_rom_images = /usr/share/kvm
             - snapshot:
                 mode = snapshot
                 ## Install from a kvm snapshot location. You can optionally
@@ -30,14 +33,23 @@  variants:
                 ## yesterday's snapshot.
                 # snapshot_date = 20090712
                 snapshot_dir = http://foo.org/kvm-snapshots/
+                # In some cases, you might want to provide a ROM dir, so ROM
+                # files can be copied from there to your source based install
+                # path_to_rom_images = /usr/share/kvm
             - localtar:
                 mode = localtar
                 ## Install from tarball located on the host's filesystem.
                 tarball = /tmp/kvm-84.tar.gz
+                # In some cases, you might want to provide a ROM dir, so ROM
+                # files can be copied from there to your source based install
+                # path_to_rom_images = /usr/share/kvm
             - localsrc:
                 mode = localsrc
                 ## Install from tarball located on the host's filesystem.
                 srcdir = /tmp/kvm-84
+                # In some cases, you might want to provide a ROM dir, so ROM
+                # files can be copied from there to your source based install
+                # path_to_rom_images = /usr/share/kvm
             - git:
                 mode = git
                 ## Install KVM from git repositories.
@@ -64,6 +76,9 @@  variants:
                 # kmod_lbranch = kmod_lbranch_name
                 # kmod_commit = kmod_commit_name
                 # kmod_patches = ['http://foo.com/patch1', 'http://foo.com/patch2']
+                # In some cases, you might want to provide a ROM dir, so ROM
+                # files can be copied from there to your source based install
+                # path_to_rom_images = /usr/share/kvm
             - yum:
                 mode = yum
                 src_pkg = qemu
diff --git a/client/tests/kvm/tests/build.py b/client/tests/kvm/tests/build.py
index c4f0b18..bb3e2dc 100644
--- a/client/tests/kvm/tests/build.py
+++ b/client/tests/kvm/tests/build.py
@@ -154,6 +154,15 @@  def create_symlinks(test_bindir, prefix=None, bin_list=None, unittest=None):
         os.symlink(unittest, qemu_unittest_path)
 
 
+def install_roms(rom_dir, prefix):
+    logging.debug("Path to roms specified. Copying roms to install prefix")
+    rom_dst_dir = os.path.join(prefix, 'share', 'qemu')
+    for rom_src in glob.glob('%s/*.bin' % rom_dir):
+        rom_dst = os.path.join(rom_dst_dir, os.path.basename(rom_src))
+        logging.debug("Copying rom file %s to %s", rom_src, rom_dst)
+        shutil.copy(rom_src, rom_dst)
+
+
 def save_build(build_dir, dest_dir):
     logging.debug('Saving the result of the build on %s', dest_dir)
     base_name = os.path.basename(build_dir)
@@ -314,6 +323,7 @@  class SourceDirInstaller(BaseInstaller):
 
         install_mode = params["mode"]
         srcdir = params.get("srcdir", None)
+        self.path_to_roms = params.get("path_to_rom_images", None)
 
         if install_mode == 'localsrc':
             if srcdir is None:
@@ -391,6 +401,8 @@  class SourceDirInstaller(BaseInstaller):
             utils.system("make -C qemu install")
         elif self.repo_type == 2:
             utils.system("make install")
+        if self.path_to_roms:
+            install_roms(self.path_to_roms, self.prefix)
         create_symlinks(self.test_bindir, self.prefix)
 
 
@@ -559,6 +571,8 @@  class GitInstaller(SourceDirInstaller):
     def _install(self):
         os.chdir(self.userspace_srcdir)
         utils.system('make install')
+        if self.path_to_roms:
+            install_roms(self.path_to_roms, self.prefix)
         create_symlinks(test_bindir=self.test_bindir, prefix=self.prefix,
                         bin_list=None,
                         unittest=self.unittest_prefix)