From patchwork Tue Oct 5 21:35:49 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: 233981 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 o95La0kC012858 for ; Tue, 5 Oct 2010 21:36:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754239Ab0JEVf5 (ORCPT ); Tue, 5 Oct 2010 17:35:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13881 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753244Ab0JEVf4 (ORCPT ); Tue, 5 Oct 2010 17:35:56 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o95LZtNU023761 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Oct 2010 17:35:55 -0400 Received: from freedom.redhat.com (vpn-9-241.rdu.redhat.com [10.11.9.241]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o95LZqsR011939; Tue, 5 Oct 2010 17:35:53 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, ehabkost@redhat.com, dlaor@redhat.com, avi@redhat.com, mgoldish@redhat.com, akong@redhat.com, Lucas Meneghel Rodrigues Subject: [PATCH] [RFC] KVM test: Change sample control file to allow host kernel install Date: Tue, 5 Oct 2010 18:35:49 -0300 Message-Id: <1286314549-2874-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 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 (demeter1.kernel.org [140.211.167.41]); Tue, 05 Oct 2010 21:36:01 +0000 (UTC) diff --git a/client/tests/kvm/control b/client/tests/kvm/control index 63bbe5d..668de8b 100644 --- a/client/tests/kvm/control +++ b/client/tests/kvm/control @@ -21,43 +21,83 @@ For online docs, please refer to http://www.linux-kvm.org/page/KVM-Autotest """ import sys, os, logging +# set English environment (command output might be localized, need to be safe) +os.environ['LANG'] = 'en_US.UTF-8' # Add the KVM tests dir to the python path kvm_test_dir = os.path.join(os.environ['AUTODIR'],'tests/kvm') sys.path.append(kvm_test_dir) # Now we can import modules inside the KVM tests dir import kvm_utils, kvm_config -# set English environment (command output might be localized, need to be safe) -os.environ['LANG'] = 'en_US.UTF-8' +# Choose the host kernel install mode 'rpm' or 'git' +# If you don't want to install a kernel, keep the below 'default' +host_kernel_install = 'default' +# URL for the kernel package +host_kernel_rpm_url = 'http://kojipkgs.fedoraproject.org/packages/kernel/2.6.36/0.32.rc6.git2.fc15/x86_64/kernel-2.6.36-0.32.rc6.git2.fc15.x86_64.rpm' +# Git repo URL and other git repo relevant data +host_kernel_git_repo = 'git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git' +host_kernel_git_branch = 'master' +host_kernel_git_commit = '' +# If you want to apply patches to your tree, make sure you populate the list +# below with the urls of the patches. +host_kernel_patch_list = [] +# URL for the kernel config file (git build method) +host_kernel_config = 'http://your-server.com/config' + + +def step_init(): + job.next_step([step_test]) + if host_kernel_install == 'rpm': + logging.info('Chose to install host kernel through rpm, proceeding') + dst = os.path.join("/tmp", os.path.basename(host_kernel_rpm_url)) + k = utils.get_file(host_kernel_rpm_url, dst) + host_kernel = job.kernel(k) + host_kernel.install(install_vmlinux=False) + job.bootloader.boot_once('autotest') + elif host_kernel_install == 'git': + logging.info('Chose to install host kernel through git, proceeding') + repodir = os.path.join("/tmp", 'kernel_src') + r = kvm_utils.get_git_branch(host_kernel_git_repo, + host_kernel_git_branch, + repodir, + host_kernel_git_commit) + host_kernel = job.kernel(r) + if host_kernel_patch_list: + host_kernel.patch(host_kernel_patch_list) + host_kernel.config(host_kernel_config) + host_kernel.build() + host_kernel.install() + job.bootloader.boot_once('autotest') + else: + logging.info('Chose %s, using the current kernel for the host', + host_kernel_install) -str = """ + +def step_test(): + str = """ # This string will be parsed after build.cfg. Make any desired changes to the # build configuration here. For example: #release_tag = 84 -""" -build_cfg = kvm_config.config() -# As the base test config is quite large, in order to save memory, we use the -# fork_and_parse() method, that creates another parser process and destroys it -# at the end of the parsing, so the memory spent can be given back to the OS. -build_cfg_path = os.path.join(kvm_test_dir, "build.cfg") -build_cfg.fork_and_parse(build_cfg_path, str) -if not kvm_utils.run_tests(build_cfg.get_generator(), job): - logging.error("KVM build step failed, exiting.") - sys.exit(1) - -str = """ + """ + build_cfg = kvm_config.config() + build_cfg_path = os.path.join(kvm_test_dir, "build.cfg") + build_cfg.fork_and_parse(build_cfg_path, str) + if not kvm_utils.run_tests(build_cfg.get_generator(), job): + logging.error("KVM build step failed, exiting.") + sys.exit(1) + + str = """ # This string will be parsed after tests.cfg. Make any desired changes to the # test configuration here. For example: #display = sdl #install|setup: timeout_multiplier = 3 -""" -tests_cfg = kvm_config.config() -tests_cfg_path = os.path.join(kvm_test_dir, "tests.cfg") -tests_cfg.fork_and_parse(tests_cfg_path, str) - -# Run the tests -kvm_utils.run_tests(tests_cfg.get_generator(), job) + """ + tests_cfg = kvm_config.config() + tests_cfg_path = os.path.join(kvm_test_dir, "tests.cfg") + tests_cfg.fork_and_parse(tests_cfg_path, str) -# Generate a nice HTML report inside the job's results dir -kvm_utils.create_report(kvm_test_dir, job.resultdir) + # Run the tests + kvm_utils.run_tests(tests_cfg.get_generator(), job) + # Generate a nice HTML report inside the job's results dir + kvm_utils.create_report(kvm_test_dir, job.resultdir)