From patchwork Fri Jun 25 00:26:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 107978 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o5P0QgfF007432 for ; Fri, 25 Jun 2010 00:26:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754029Ab0FYA0c (ORCPT ); Thu, 24 Jun 2010 20:26:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24778 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753844Ab0FYA0b (ORCPT ); Thu, 24 Jun 2010 20:26:31 -0400 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.13.8/8.13.8) with ESMTP id o5P0QUtU023415 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 24 Jun 2010 20:26:30 -0400 Received: from localhost.localdomain (vpn-9-214.rdu.redhat.com [10.11.9.214]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5P0QS2h023157; Thu, 24 Jun 2010 20:26:28 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, mgoldish@redhat.com, Lucas Meneghel Rodrigues Subject: [PATCH] KVM test: Modify the build.git method to build and link unittests Date: Thu, 24 Jun 2010 21:26:26 -0300 Message-Id: <1277425586-15253-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.3 (demeter.kernel.org [140.211.167.41]); Fri, 25 Jun 2010 00:26:48 +0000 (UTC) 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: