KVM test: Make it possible to configure preserve_srcdir
PATCH 1/1 KVM test: Make it possible to configure preserve_srcdir
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.
--- 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(-)
client/tests/kvm/build.cfg.sample +2 -0
@@ -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
client/tests/kvm/kvm.py +8 -0
@@ -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)
client/tests/kvm/unittests.cfg.sample +2 -0
@@ -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
Signature · 1 line
1.7.6