| Index: client/tests/kvm/kvm.py
|
| diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
|
| index 4af2767ce497daab9060e119d8f2341d5ce14c7c..bb17f28c6242e27681ace5d4659d31749a441078 100644
|
| --- a/client/tests/kvm/kvm.py
|
| +++ b/client/tests/kvm/kvm.py
|
| @@ -1,7 +1,7 @@
|
| import os, logging, imp
|
| from autotest_lib.client.bin import test
|
| from autotest_lib.client.common_lib import error
|
| -import kvm_utils, kvm_preprocessing
|
| +from autotest_lib.client.virt import virt_utils, virt_env_process
|
|
|
|
|
| class kvm(test.test):
|
| @@ -25,7 +25,7 @@ class kvm(test.test):
|
|
|
| def run_once(self, params):
|
| # Convert params to a Params object
|
| - params = kvm_utils.Params(params)
|
| + params = virt_utils.Params(params)
|
|
|
| # If a dependency test prior to this test has failed, let's fail
|
| # it right away as TestNA.
|
| @@ -42,13 +42,13 @@ class kvm(test.test):
|
|
|
| # Set the log file dir for the logging mechanism used by kvm_subprocess
|
| # (this must be done before unpickling env)
|
| - kvm_utils.set_log_file_dir(self.debugdir)
|
| + virt_utils.set_log_file_dir(self.debugdir)
|
|
|
| # Open the environment file
|
| logging.info("Unpickling env. You may see some harmless error "
|
| "messages.")
|
| env_filename = os.path.join(self.bindir, params.get("env", "env"))
|
| - env = kvm_utils.Env(env_filename, self.env_version)
|
| + env = virt_utils.Env(env_filename, self.env_version)
|
|
|
| test_passed = False
|
|
|
| @@ -59,11 +59,19 @@ class kvm(test.test):
|
| # test type
|
| t_type = params.get("type")
|
| # Verify if we have the correspondent source file for it
|
| - subtest_dir = os.path.join(self.bindir, "tests")
|
| - module_path = os.path.join(subtest_dir, "%s.py" % t_type)
|
| - if not os.path.isfile(module_path):
|
| - raise error.TestError("No %s.py test file found" %
|
| - t_type)
|
| + virt_dir = os.path.dirname(virt_utils.__file__)
|
| + subtest_dir_virt = os.path.join(virt_dir, "tests")
|
| + subtest_dir_kvm = os.path.join(self.bindir, "tests")
|
| + subtest_dir = None
|
| + for d in [subtest_dir_kvm, subtest_dir_virt]:
|
| + module_path = os.path.join(d, "%s.py" % t_type)
|
| + if os.path.isfile(module_path):
|
| + subtest_dir = d
|
| + break
|
| + if subtest_dir is None:
|
| + raise error.TestError("Could not find test file %s.py "
|
| + "on either %s or %s directory" %
|
| + subtest_dir_kvm, subtest_dir_virt)
|
| # Load the test module
|
| f, p, d = imp.find_module(t_type, [subtest_dir])
|
| test_module = imp.load_module(t_type, f, p, d)
|
| @@ -71,7 +79,7 @@ class kvm(test.test):
|
|
|
| # Preprocess
|
| try:
|
| - kvm_preprocessing.preprocess(self, params, env)
|
| + virt_env_process.preprocess(self, params, env)
|
| finally:
|
| env.save()
|
| # Run the test function
|
| @@ -86,7 +94,7 @@ class kvm(test.test):
|
| logging.error("Test failed: %s: %s",
|
| e.__class__.__name__, e)
|
| try:
|
| - kvm_preprocessing.postprocess_on_error(
|
| + virt_env_process.postprocess_on_error(
|
| self, params, env)
|
| finally:
|
| env.save()
|
| @@ -96,7 +104,7 @@ class kvm(test.test):
|
| # Postprocess
|
| try:
|
| try:
|
| - kvm_preprocessing.postprocess(self, params, env)
|
| + virt_env_process.postprocess(self, params, env)
|
| except Exception, e:
|
| if test_passed:
|
| raise
|
|
|