diff mbox

KVM test utils: Add kvm_stat profiling to run_tests

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

Commit Message

Lucas Meneghel Rodrigues Jan. 10, 2010, 12:13 a.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index 2bbbe22..7152816 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -902,9 +902,26 @@  def run_tests(test_list, job):
                     break
         if dependencies_satisfied:
             test_iterations = int(dict.get("iterations", 1))
-            current_status = job.run_test("kvm", params=dict,
-                                          tag=dict.get("shortname"),
-                                          iterations=test_iterations)
+            test_tag = dict.get("shortname")
+            # Setting up kvm_stat profiling during test execution.
+            # We don't need kvm_stat profiling on the build tests.
+            if "build" in test_tag:
+                # None because it's the default value on the base_test class
+                # and the value None is specifically checked there.
+                profile = None
+            else:
+                profile = True
+
+            if profile:
+                job.profilers.add('kvm_stat')
+            # We need only one execution, profiled, hence we're passing
+            # the profile_only parameter to job.run_test().
+            current_status = job.run_test("kvm", params=dict, tag=test_tag,
+                                          iterations=test_iterations,
+                                          profile_only=profile)
+            if profile:
+                job.profilers.delete('kvm_stat')
+
             if not current_status:
                 failed = True
         else: