From patchwork Fri Aug 7 23:03:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 40052 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n77N1ejS031740 for ; Fri, 7 Aug 2009 23:01:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756522AbZHGXBE (ORCPT ); Fri, 7 Aug 2009 19:01:04 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756311AbZHGXBD (ORCPT ); Fri, 7 Aug 2009 19:01:03 -0400 Received: from mx2.redhat.com ([66.187.237.31]:47783 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754724AbZHGXBC (ORCPT ); Fri, 7 Aug 2009 19:01:02 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n77N12r1014479; Fri, 7 Aug 2009 19:01:02 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n77N11lI028969; Fri, 7 Aug 2009 19:01:01 -0400 Received: from localhost.localdomain (dhcp-1-31.tlv.redhat.com [10.35.1.31]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n77N0xnK025261; Fri, 7 Aug 2009 19:01:00 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH] KVM test: timedrift: pass parameters to the get_time() helper function Date: Sat, 8 Aug 2009 02:03:38 +0300 Message-Id: <90183a035ae6e0fd5e63af51ce63102f576326a9.1249686169.git.mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Michael Goldish --- 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