Skip to contentSkip to conversation

KVM test utils: Add kvm_stat profiling to run_tests

PATCH New Lucas Meneghel Rodrigues 1 participant 1 message Jan 10, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM test utils: Add kvm_stat profiling to run_tests

Add kvm_stat profiling to the helper function run_tests, so every kvm test run through this function but build will present kvm_stat data on the profiling directory.

---
 client/tests/kvm/kvm_utils.py |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)
client/tests/kvm/kvm_utils.py +20 -3
index 2bbbe22..7152816 100644
@@ -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:
Signature · 1 line
1.6.5.2