If we have a certain file that has information about running unit tests, let's build the unittests on the build.git mode. This feature depends on a qemu-kvm patch that is still not upstream, but I am sending anyways so people can comment. Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx> --- client/tests/kvm/tests/build.py | 30 +++++++++++++++++++++++++++--- 1 files changed, 27 insertions(+), 3 deletions(-) diff --git a/client/tests/kvm/tests/build.py b/client/tests/kvm/tests/build.py index 6814cfe..a46bbf2 100644 --- a/client/tests/kvm/tests/build.py +++ b/client/tests/kvm/tests/build.py @@ -115,20 +115,25 @@ def load_kvm_modules(module_dir=None, load_stock=False, extra_modules=None): utils.system("modprobe %s" % module) -def create_symlinks(test_bindir, prefix=None, bin_list=None): +def create_symlinks(test_bindir, prefix=None, bin_list=None, unittest=None): """ Create symbolic links for the appropriate qemu and qemu-img commands on the kvm test bindir. @param test_bindir: KVM test bindir @param prefix: KVM prefix path + @param bin_list: List of qemu binaries to link + @param unittest: Path to configuration file unittests.cfg """ qemu_path = os.path.join(test_bindir, "qemu") qemu_img_path = os.path.join(test_bindir, "qemu-img") + qemu_unittest_path = os.path.join(test_bindir, "unittests") if os.path.lexists(qemu_path): os.unlink(qemu_path) if os.path.lexists(qemu_img_path): os.unlink(qemu_img_path) + if unittest and os.path.lexists(qemu_unittest_path): + os.unlink(qemu_unittest_path) logging.debug("Linking qemu binaries") @@ -149,6 +154,11 @@ def create_symlinks(test_bindir, prefix=None, bin_list=None): os.symlink(kvm_qemu, qemu_path) os.symlink(kvm_qemu_img, qemu_img_path) + elif unittest: + logging.debug("Linking unittest dir") + unittest_dir = os.path.dirname(unittest) + os.symlink(unittest_dir, qemu_unittest_path) + def save_build(build_dir, dest_dir): logging.debug('Saving the result of the build on %s', dest_dir) @@ -512,6 +522,7 @@ class GitInstaller(SourceDirInstaller): kvm_utils.get_git_branch(user_repo, user_branch, userspace_srcdir, user_commit, user_lbranch) self.userspace_srcdir = userspace_srcdir + if user_patches: os.chdir(self.userspace_srcdir) for patch in user_patches: @@ -519,6 +530,13 @@ class GitInstaller(SourceDirInstaller): os.path.basename(patch))) utils.system('patch -p1 %s' % os.path.basename(patch)) + unittest_cfg = os.path.join(userspace_srcdir, 'kvm', 'test', + 'unittests.cfg') + + self.unittest_cfg = None + if os.path.isfile(unittest_cfg): + self.unittest_cfg = unittest_cfg + if kernel_repo: kernel_srcdir = os.path.join(self.srcdir, "kvm") kvm_utils.get_git_branch(kernel_repo, kernel_branch, kernel_srcdir, @@ -591,12 +609,18 @@ class GitInstaller(SourceDirInstaller): utils.system('make clean') utils.system('make -j %s' % make_jobs) + if self.unittest_cfg: + os.chdir(os.path.dirname(self.unittest_cfg)) + utils.system('./configure --prefix=%s' % self.prefix) + utils.system('make') + utils.system('make install') + def _install(self): os.chdir(self.userspace_srcdir) utils.system('make install') - create_symlinks(self.test_bindir, self.prefix) - + create_symlinks(test_bindir=self.test_bindir, prefix=self.prefix, + bin_list=None, unittest=self.unittest_cfg) def _load_modules(self): if self.kmod_srcdir and self.modules_build_succeed: -- 1.7.0.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html