~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to tools/xm-test/tests/sedf/05_sedf_extratime_pos.py

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
# Copyright (C) International Business Machines Corp., 2005
 
4
# Author: Dan Smith <danms@us.ibm.com>
 
5
# Author: Ryan Harper <ryanh@us.ibm.com>
 
6
 
 
7
from XmTestLib import *
 
8
 
 
9
def get_sedf_params(domain):
 
10
    status, output = traceCommand("xm sched-sedf %s" %(domain.getName()))
 
11
    return (status, output.split('\n')[1].split())
 
12
 
 
13
 
 
14
domain = XmTestDomain(extraConfig = {"sched":"sedf"})
 
15
 
 
16
try:
 
17
    domain.start(noConsole=True)
 
18
except DomainError, e:
 
19
    if verbose:
 
20
        print "Failed to create test domain because:"
 
21
        print e.extra
 
22
    FAIL(str(e))
 
23
 
 
24
# get current param values as baseline
 
25
(status, params) = get_sedf_params(domain)
 
26
 
 
27
# check rv
 
28
if status != 0:
 
29
    FAIL("Getting sedf parameters return non-zero rv (%d)", status)
 
30
 
 
31
# parse out current params
 
32
(name, domid, p, s, l, e, w) = params
 
33
 
 
34
# toggle extratime value
 
35
extratime = str((int(e)+1)%2)
 
36
 
 
37
direction = "disable"
 
38
# NB: when disabling extratime(=0), must pass in a slice
 
39
opts = "%s -e %s" %(domain.getName(), extratime)
 
40
if extratime == "0":
 
41
    opts += " -s %s" %( str( (float(p)/2)+1 ) )
 
42
    direction = "enable"
 
43
    
 
44
(status, output) = traceCommand("xm sched-sedf %s" %(opts))
 
45
 
 
46
# check rv
 
47
if status != 0:
 
48
   FAIL("Setting sedf parameters return non-zero rv (%d)" % status)
 
49
 
 
50
# validate
 
51
(s,params) = get_sedf_params(domain)
 
52
 
 
53
# check rv
 
54
if s != 0:
 
55
    FAIL("Getting sedf parameters return non-zero rv (%d)" % s)
 
56
 
 
57
(name,domid,p1,s1,l1,e1,w1) = params
 
58
 
 
59
if e1 != extratime:
 
60
    FAIL("Failed to %s extratime" %(direction))
 
61
 
 
62
# Stop the domain (nice shutdown)
 
63
domain.stop()