diff options
author | Ewan Mellor <ewan@xensource.com> | 2007-01-09 17:38:48 +0000 |
---|---|---|
committer | Ewan Mellor <ewan@xensource.com> | 2007-01-09 17:38:48 +0000 |
commit | e3e7d81e413560eaeca19f7ec613e63ea0f02e8c (patch) | |
tree | e3014388fcf1277d020c2894208c3e6822491f1a /tools/xm-test/tests | |
parent | 00e52488131f7190f005c65a64169752a5b9b9a8 (diff) | |
download | xen-e3e7d81e413560eaeca19f7ec613e63ea0f02e8c.tar.gz xen-e3e7d81e413560eaeca19f7ec613e63ea0f02e8c.tar.bz2 xen-e3e7d81e413560eaeca19f7ec613e63ea0f02e8c.zip |
Update sched-credit test to match new format from xm sched-credit.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Diffstat (limited to 'tools/xm-test/tests')
-rw-r--r-- | tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py b/tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py index e0b1fe5846..cdbca0f757 100644 --- a/tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py +++ b/tools/xm-test/tests/sched-credit/01_sched_credit_weight_cap_pos.py @@ -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: |