WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Update sched-credit test to match new for

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Update sched-credit test to match new format from xm sched-credit.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 10 Jan 2007 04:01:10 -0800
Delivery-date: Wed, 10 Jan 2007 04:04:21 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1168364328 0
# Node ID 7fd4e256196b6b9f5b47377622e663ebd7b856b9
# Parent  56e2341f02c44a3e424e41ec393dd7fbd86b4969
Update sched-credit test to match new format from xm sched-credit.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py |   33 
++++++----
 1 files changed, 20 insertions(+), 13 deletions(-)

diff -r 56e2341f02c4 -r 7fd4e256196b 
tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py
--- a/tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py        
Tue Jan 09 17:25:28 2007 +0000
+++ b/tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py        
Tue Jan 09 17:38:48 2007 +0000
@@ -2,14 +2,27 @@
 #
 # Sched-credit tests modified from SEDF tests
 #
+
+import re
+
 from XmTestLib import *
 
+paramsRE = re.compile(r'^[^ ]* *[^ ]* *([^ ]*) *([^ ]*)$')
+
 def get_sched_credit_params(domain):
-    status, output = traceCommand("xm sched-credit -d %s" %(domain.getName()))
-    params = output.strip('{}').split(', ')
-    cap = int(params[0].split(':')[1].strip(' '))
-    weight = int(params[1].split(':')[1].strip(' '))
-    return (status, (weight, cap))
+    status, output = traceCommand("xm sched-credit -d %s | tail -1" %
+                                  domain.getName())
+
+    if status != 0:
+        FAIL("Getting sched-credit parameters return non-zero rv (%d)",
+             status)
+
+    m = paramsRE.match(output)
+    if not m:
+        FAIL("xm sched-credit gave bad output")
+    weight = int(m.group(1))
+    cap = int(m.group(2))
+    return (weight, cap)
 
 def set_sched_credit_weight(domain, weight):
     status, output = traceCommand("xm sched-credit -d %s -w %d" 
%(domain.getName(), weight))
@@ -31,11 +44,8 @@ except DomainError, e:
     FAIL(str(e))
 
 # check default param values
-(status, params) = get_sched_credit_params(domain)
-if status != 0:
-    FAIL("Getting sched-credit parameters return non-zero rv (%d)", status)
+(weight, cap) = get_sched_credit_params(domain)
 
-(weight, cap) = params
 if weight != 256:
     FAIL("default weight is 256 (got %d)", weight)
 if cap != 0:
@@ -51,11 +61,8 @@ if status != 0:
     FAIL("Setting sched-credit cap return non-zero rv (%d)", status)
 
 # check new param values
-(status, params) = get_sched_credit_params(domain)
-if status != 0:
-    FAIL("Getting sched-credit parameters return non-zero rv (%d)", status)
+(weight, cap) = get_sched_credit_params(domain)
 
-(weight, cap) = params
 if weight != 512:
     FAIL("expected weight of 512 (got %d)", weight)
 if cap != 100:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Update sched-credit test to match new format from xm sched-credit., Xen patchbot-unstable <=