From patchwork Thu Sep 17 03:53:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 48205 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8H3rVU8005919 for ; Thu, 17 Sep 2009 03:53:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760066AbZIQDx0 (ORCPT ); Wed, 16 Sep 2009 23:53:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760071AbZIQDx0 (ORCPT ); Wed, 16 Sep 2009 23:53:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33248 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758508AbZIQDxZ (ORCPT ); Wed, 16 Sep 2009 23:53:25 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8H3rSlK029837; Wed, 16 Sep 2009 23:53:28 -0400 Received: from localhost.localdomain (vpn-12-119.rdu.redhat.com [10.11.12.119]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8H3rPor030034; Wed, 16 Sep 2009 23:53:26 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH] KVM test: Verify configure script capabilities before assuming --disable-strip Date: Thu, 17 Sep 2009 00:53:25 -0300 Message-Id: <1253159605-3026-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Instead of just assuming we can use --disable-strip, keep a record of the supported configure options and only use that particular option if it's supported. Signed-off-by: Lucas Meneghel Rodrigues diff --git a/client/tests/kvm/tests/build.py b/client/tests/kvm/tests/build.py index f6856ad..1801e05 100644 --- a/client/tests/kvm/tests/build.py +++ b/client/tests/kvm/tests/build.py @@ -4,6 +4,27 @@ from autotest_lib.client.common_lib import error import kvm_utils +def check_configure_options(script_path): + """ + Return the list of available options (flags) of a given kvm configure build + script. + + @param script: Path to the configure script + """ + abspath = os.path.abspath(script_path) + help_raw = utils.system_output('%s --help' % abspath, ignore_status=True) + help_output = help_raw.split("\n") + option_list = [] + for line in help_output: + cleaned_line = line.lstrip() + if cleaned_line.startswith("--"): + option = cleaned_line.split()[0] + option = option.split("=")[0] + option_list.append(option) + + return option_list + + def load_kvm_modules(module_dir): """ Unload previously loaded kvm modules, then load modules present on any @@ -134,7 +155,8 @@ class SourceDirInstaller: if not release_tag: release_tag = kvm_utils.get_latest_kvm_release_tag( release_listing) - tarball = os.path.join(release_dir, "kvm-%s.tar.gz" % release_tag) + tarball = os.path.join(release_dir, 'kvm', release_tag, + "kvm-%s.tar.gz" % release_tag) logging.info("Retrieving release kvm-%s" % release_tag) tarball = utils.unmap_url("/", tarball, "/tmp") @@ -166,13 +188,17 @@ class SourceDirInstaller: os.chdir(srcdir) self.srcdir = os.path.join(srcdir, utils.extract_tarball(tarball)) self.repo_type = kvm_utils.check_kvm_source_dir(self.srcdir) + configure_script = os.path.join(self.srcdir, 'configure') + self.configure_options = check_configure_options(configure_script) def __build(self): os.chdir(self.srcdir) # For testing purposes, it's better to build qemu binaries with # debugging symbols, so we can extract more meaningful stack traces. - cfg = "./configure --disable-strip --prefix=%s" % self.prefix + cfg = "./configure --prefix=%s" % self.prefix + if "--disable-strip" in self.configure_options: + cfg += " --disable-strip" steps = [cfg, "make clean", "make -j %s" % (utils.count_cpus() + 1)] logging.info("Building KVM") for step in steps: @@ -262,6 +288,9 @@ class GitInstaller: lbranch) self.kmod_srcdir = kmod_srcdir + configure_script = os.path.join(self.userspace_srcdir, 'configure') + self.configure_options = check_configure_options(configure_script) + def __build(self): if self.kmod_srcdir: @@ -273,14 +302,18 @@ class GitInstaller: utils.system('make -j %s' % utils.count_cpus()) logging.info('Building KVM userspace code') os.chdir(self.userspace_srcdir) - utils.system('./configure --disable-strip --prefix=%s' % - self.prefix) + cfg = './configure --prefix=%s' % self.prefix + if "--disable-strip" in self.configure_options: + cfg += ' --disable-strip' + utils.system(cfg) utils.system('make clean') utils.system('make -j %s' % utils.count_cpus()) else: os.chdir(self.userspace_srcdir) - utils.system('./configure --disable-strip --prefix=%s' % - self.prefix) + cfg = './configure --prefix=%s' % self.prefix + if "--disable-strip" in self.configure_options: + cfg += ' --disable-strip' + utils.system(cfg) logging.info('Building KVM modules') utils.system('make clean') utils.system('make -C kernel LINUX=%s sync' % self.kernel_srcdir)