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 <lmr@xxxxxxxxxx> --- 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 -- 1.7.6 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html