debuggers.hg

view tools/xm-test/tests/vcpu-pin/01_vcpu-pin_basic_pos.py @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children
line source
1 #!/usr/bin/python
3 # Copyright (C) International Business Machines Corp., 2005
4 # Author: Dan Smith <danms@us.ibm.com>
6 # 1) Make sure we have a multi cpu system
7 # 2) Create a test domain and pin its VCPU0 to CPU 0 and then 1
9 import sys;
10 import re;
12 from XmTestLib import *
14 # Verify that we can run this test on this host
15 if smpConcurrencyLevel() <= 1:
16 print "*** NOTE: This machine does not have more than one physical"
17 print " or logical cpu. The vcpu-pin test cannot be run!"
18 SKIP("Host not capable of running test")
20 domain = XmTestDomain()
22 try:
23 domain.start(noConsole=True)
24 except DomainError, e:
25 if verbose:
26 print "Failed to create test domain because:"
27 print e.extra
28 FAIL(str(e))
30 status, output = traceCommand("xm vcpu-pin %s 0 0" % domain.getName())
32 if status != 0:
33 FAIL("xm vcpu-pin returned invalid %i != 0" % status)
35 cpu = getVcpuInfo(domain.getName())[0]
37 if cpu != 0:
38 FAIL("failed to switch VCPU 0 to CPU 0")
40 status, output = traceCommand("xm vcpu-pin %s 0 1" % domain.getName())
42 if status != 0:
43 FAIL("xm vcpu-pin returned invalid %i != 0" % status)
45 cpu = getVcpuInfo(domain.getName())[0]
47 if cpu != 1:
48 FAIL("failed to switch VCPU 0 to CPU 1")
50 domain.stop()