[KVM-AUTOTEST PATCH] KVM test: timedrift: pass parameters to the get_time() helper function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/kvm_tests.py |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index 8cc89f1..e678039 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -630,10 +630,16 @@ def run_timedrift(test, params, env):
         for tid, mask in prev_masks.items():
             commands.getoutput("taskset -p %s %s" % (mask, tid))
 
-    def get_time():
+    def get_time(session, time_command, time_filter_re, time_format):
         """
         Returns the host time and guest time.
 
+        @param session: A shell session.
+        @param time_command: Command to issue to get the current guest time.
+        @param time_filter_re: Regex filter to apply on the output of
+                time_command in order to get the current time.
+        @param time_format: Format string to pass to time.strptime() with the
+                result of the regex filter.
         @return: A tuple containing the host time and guest time.
         """
         host_time = time.time()
@@ -685,7 +691,8 @@ def run_timedrift(test, params, env):
 
     try:
         # Get time before load
-        (host_time_0, guest_time_0) = get_time()
+        (host_time_0, guest_time_0) = get_time(session, time_command,
+                                               time_filter_re, time_format)
 
         # Run some load on the guest
         logging.info("Starting load on guest...")
@@ -719,7 +726,8 @@ def run_timedrift(test, params, env):
         time.sleep(load_duration)
 
         # Get time delta after load
-        (host_time_1, guest_time_1) = get_time()
+        (host_time_1, guest_time_1) = get_time(session, time_command,
+                                               time_filter_re, time_format)
 
         # Report results
         host_delta = host_time_1 - host_time_0
@@ -747,7 +755,8 @@ def run_timedrift(test, params, env):
     time.sleep(rest_duration)
 
     # Get time after rest
-    (host_time_2, guest_time_2) = get_time()
+    (host_time_2, guest_time_2) = get_time(session, time_command,
+                                           time_filter_re, time_format)
 
     # Report results
     host_delta_total = host_time_2 - host_time_0
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux