diff mbox

KVM test: Move enumerate test dicts code to kvm_utils.run_tests()

Message ID 1298296975-26640-1-git-send-email-lmr@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Meneghel Rodrigues Feb. 21, 2011, 2:02 p.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/control b/client/tests/kvm/control
index be37678..d9ff70c 100644
--- a/client/tests/kvm/control
+++ b/client/tests/kvm/control
@@ -39,7 +39,7 @@  str = """
 parser = kvm_config.Parser()
 parser.parse_file(os.path.join(kvm_test_dir, "build.cfg"))
 parser.parse_string(str)
-if not kvm_utils.run_tests(parser.get_dicts(), job):
+if not kvm_utils.run_tests(parser, job):
     logging.error("KVM build step failed, exiting.")
     sys.exit(1)
 
@@ -68,10 +68,7 @@  if args:
             pass
 parser.parse_string(str)
 
-logging.info("Selected tests:")
-for i, d in enumerate(parser.get_dicts()):
-    logging.info("Test %4d:  %s" % (i + 1, d["shortname"]))
-kvm_utils.run_tests(parser.get_dicts(), job)
+kvm_utils.run_tests(parser, job)
 
 # Generate a nice HTML report inside the job's results dir
 kvm_utils.create_report(kvm_test_dir, job.resultdir)
diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index 9e25a0a..de52b65 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -1084,20 +1084,23 @@  def get_hash_from_file(hash_path, dvd_basename):
             return line.split()[0]
 
 
-def run_tests(test_list, job):
+def run_tests(parser, job):
     """
     Runs the sequence of KVM tests based on the list of dictionaries
     generated by the configuration system, handling dependencies.
 
-    @param test_list: List with all dictionary test parameters.
+    @param parser: Config parser object.
     @param job: Autotest job object.
 
     @return: True, if all tests ran passed, False if any of them failed.
     """
+    for i, d in enumerate(parser.get_dicts()):
+        logging.info("Test %4d:  %s" % (i + 1, d["shortname"]))
+
     status_dict = {}
     failed = False
 
-    for dict in test_list:
+    for dict in parser.get_dicts():
         if dict.get("skip") == "yes":
             continue
         dependencies_satisfied = True