From patchwork Mon Feb 21 12:35:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 577451 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1LCa7XS027554 for ; Mon, 21 Feb 2011 12:36:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755762Ab1BUMgD (ORCPT ); Mon, 21 Feb 2011 07:36:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42693 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752944Ab1BUMgB (ORCPT ); Mon, 21 Feb 2011 07:36:01 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1LCZsgL028743 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 21 Feb 2011 07:35:54 -0500 Received: from freedom.redhat.com (vpn-8-170.rdu.redhat.com [10.11.8.170]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1LCZrXp031604; Mon, 21 Feb 2011 07:35:53 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH] KVM test: encapsulate unittests build and move it to parent class Date: Mon, 21 Feb 2011 09:35:51 -0300 Message-Id: <1298291751-3533-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 21 Feb 2011 12:36:07 +0000 (UTC) diff --git a/client/tests/kvm/installer.py b/client/tests/kvm/installer.py index a757223..6b2a6fe 100644 --- a/client/tests/kvm/installer.py +++ b/client/tests/kvm/installer.py @@ -231,6 +231,42 @@ class BaseInstaller(object): self._full_module_list = list(self._module_list()) + def install_unittests(self): + userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace") + test_repo = self.params.get("test_git_repo") + test_branch = self.params.get("test_branch", "master") + test_commit = self.params.get("test_commit", None) + test_lbranch = self.params.get("test_lbranch", "master") + + if test_repo: + test_srcdir = os.path.join(self.srcdir, "kvm-unit-tests") + kvm_utils.get_git_branch(test_repo, test_branch, test_srcdir, + test_commit, test_lbranch) + unittest_cfg = os.path.join(test_srcdir, 'x86', + 'unittests.cfg') + self.test_srcdir = test_srcdir + else: + unittest_cfg = os.path.join(userspace_srcdir, 'kvm', 'test', 'x86', + 'unittests.cfg') + self.unittest_cfg = None + if os.path.isfile(unittest_cfg): + self.unittest_cfg = unittest_cfg + else: + if test_repo: + logging.error("No unittest config file %s found, skipping " + "unittest build", self.unittest_cfg) + + self.unittest_prefix = None + if self.unittest_cfg: + logging.info("Building and installing unittests") + os.chdir(os.path.dirname(os.path.dirname(self.unittest_cfg))) + utils.system('./configure --prefix=%s' % self.prefix) + utils.system('make') + utils.system('make install') + self.unittest_prefix = os.path.join(self.prefix, 'share', 'qemu', + 'tests') + + def full_module_list(self): """Return the module list used by the installer @@ -341,11 +377,13 @@ class YumInstaller(BaseInstaller): def install(self): + self.install_unittests() self._clean_previous_installs() self._get_packages() self._install_packages() create_symlinks(test_bindir=self.test_bindir, - bin_list=self.qemu_bin_paths) + bin_list=self.qemu_bin_paths, + unittest=self.unittest_prefix) self.reload_modules_if_needed() if self.save_results: save_build(self.srcdir, self.results_dir) @@ -386,8 +424,10 @@ class KojiInstaller(YumInstaller): super(KojiInstaller, self)._clean_previous_installs() self._get_packages() super(KojiInstaller, self)._install_packages() + self.install_unittests() create_symlinks(test_bindir=self.test_bindir, - bin_list=self.qemu_bin_paths) + bin_list=self.qemu_bin_paths, + unittest=self.unittest_prefix) self.reload_modules_if_needed() if self.save_results: save_build(self.srcdir, self.results_dir) @@ -532,7 +572,10 @@ class SourceDirInstaller(BaseInstaller): utils.system("make install") if self.path_to_roms: install_roms(self.path_to_roms, self.prefix) - create_symlinks(self.test_bindir, self.prefix) + self.install_unittests() + create_symlinks(test_bindir=self.test_bindir, + prefix=self.prefix, + unittest=self.unittest_prefix) def _load_modules(self, mod_list): @@ -564,22 +607,18 @@ class GitInstaller(SourceDirInstaller): kernel_repo = params.get("git_repo") user_repo = params.get("user_git_repo") kmod_repo = params.get("kmod_repo") - test_repo = params.get("test_git_repo") kernel_branch = params.get("kernel_branch", "master") user_branch = params.get("user_branch", "master") kmod_branch = params.get("kmod_branch", "master") - test_branch = params.get("test_branch", "master") kernel_lbranch = params.get("kernel_lbranch", "master") user_lbranch = params.get("user_lbranch", "master") kmod_lbranch = params.get("kmod_lbranch", "master") - test_lbranch = params.get("test_lbranch", "master") kernel_commit = params.get("kernel_commit", None) user_commit = params.get("user_commit", None) kmod_commit = params.get("kmod_commit", None) - test_commit = params.get("test_commit", None) kernel_patches = eval(params.get("kernel_patches", "[]")) user_patches = eval(params.get("user_patches", "[]")) @@ -602,21 +641,6 @@ class GitInstaller(SourceDirInstaller): os.path.basename(patch))) utils.system('patch -p1 %s' % os.path.basename(patch)) - if test_repo: - test_srcdir = os.path.join(self.srcdir, "kvm-unit-tests") - kvm_utils.get_git_branch(test_repo, test_branch, test_srcdir, - test_commit, test_lbranch) - unittest_cfg = os.path.join(test_srcdir, 'x86', - 'unittests.cfg') - self.test_srcdir = test_srcdir - else: - unittest_cfg = os.path.join(userspace_srcdir, 'kvm', 'test', 'x86', - '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, @@ -683,15 +707,6 @@ class GitInstaller(SourceDirInstaller): utils.system('make clean') utils.system('make -j %s' % make_jobs) - self.unittest_prefix = None - if self.unittest_cfg: - os.chdir(os.path.dirname(os.path.dirname(self.unittest_cfg))) - utils.system('./configure --prefix=%s' % self.prefix) - utils.system('make') - utils.system('make install') - self.unittest_prefix = os.path.join(self.prefix, 'share', 'qemu', - 'tests') - def _install(self): if self.kernel_srcdir: @@ -716,6 +731,7 @@ class GitInstaller(SourceDirInstaller): if self.path_to_roms: install_roms(self.path_to_roms, self.prefix) + self.install_unittests() create_symlinks(test_bindir=self.test_bindir, prefix=self.prefix, bin_list=None, unittest=self.unittest_prefix)