From patchwork Mon Jul 18 02:44:18 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: 985362 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6I2kN3J032217 for ; Mon, 18 Jul 2011 02:46:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756526Ab1GRCoY (ORCPT ); Sun, 17 Jul 2011 22:44:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16308 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756508Ab1GRCoX (ORCPT ); Sun, 17 Jul 2011 22:44:23 -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.14.4/8.14.4) with ESMTP id p6I2iL3Q024951 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 17 Jul 2011 22:44:22 -0400 Received: from freedom.redhat.com (vpn-9-95.rdu.redhat.com [10.11.9.95]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6I2iJHB015047; Sun, 17 Jul 2011 22:44:20 -0400 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, dlaor@redhat.com, Lucas Meneghel Rodrigues Subject: [PATCH] KVM test: Make it possible to configure preserve_srcdir Date: Sun, 17 Jul 2011 23:44:18 -0300 Message-Id: <1310957058-32095-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, 18 Jul 2011 02:46:23 +0000 (UTC) The test base class attribute preserve_srcdir controls whether the source directory is erased or not at the beginning of a new test. It defaults to False for several reasons. However, developers wanting to try kvm_autotest on their machines might like to keep the sources between tests, so it's not necessary to re-fetch the code over and over. So, make this attribute configurable by adding an initialize() method to the kvm test, that will set preserve_srcdir according to the test config value of 'preserve_srcdir', not surprisingly. Also, defaults this variable to 'yes'. People wanting to set up automated testing environments (server) will probably want to change this value to 'no', but at least the case 'developer using autotest' scenario is covered with sensible defaults. Signed-off-by: Lucas Meneghel Rodrigues --- client/tests/kvm/build.cfg.sample | 2 ++ client/tests/kvm/kvm.py | 8 ++++++++ client/tests/kvm/unittests.cfg.sample | 2 ++ 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/client/tests/kvm/build.cfg.sample b/client/tests/kvm/build.cfg.sample index 0bccd65..d4aea95 100644 --- a/client/tests/kvm/build.cfg.sample +++ b/client/tests/kvm/build.cfg.sample @@ -16,6 +16,8 @@ variants: load_modules = no # Save the results of this build on test.resultsdir? save_results = no + # Preserve the source code directory between tests? + preserve_srcdir = yes variants: - localtar: install_mode = localtar diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py index c69ad46..5f9632f 100644 --- a/client/tests/kvm/kvm.py +++ b/client/tests/kvm/kvm.py @@ -23,6 +23,14 @@ class kvm(test.test): version = 1 env_version = 1 + + def initialize(self, params): + # Change the value of the preserve_srcdir attribute according to + # the value present on the configuration file (defaults to yes) + if params.get("preserve_srcdir", "yes") == "yes": + self.preserve_srcdir = True + + def run_once(self, params): # Convert params to a Params object params = virt_utils.Params(params) diff --git a/client/tests/kvm/unittests.cfg.sample b/client/tests/kvm/unittests.cfg.sample index 16556b5..dfab508 100644 --- a/client/tests/kvm/unittests.cfg.sample +++ b/client/tests/kvm/unittests.cfg.sample @@ -46,6 +46,8 @@ variants: load_modules = no # Save the results of this build on test.resultsdir? save_results = no + # Preserve the source code directory between tests? + preserve_srcdir = yes variants: - git: mode = git