ia64/xen-unstable

view tools/xm-test/tests/unpause/01_unpause_basic_pos.py @ 14532:ac5c0a100868

Fix typos.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Fri Mar 23 11:12:25 2007 +0000 (2007-03-23)
parents 7869f58ff551
children
line source
1 #!/usr/bin/python
3 # Copyright (C) International Business Machines Corp., 2005
4 # Author: Paul Larson <pl@us.ibm.com>
6 # Description:
7 # Positive Tests:
8 # Tests for xm unpause
9 # 1) Create domain, verify it's up with console
10 # 2) randomly pause and unpause the domain
11 # 3) unpause it one last time
12 # 4) verify it's still alive with console
14 import time
15 import commands
16 from random import *
18 from XmTestLib import *
20 # Create a domain (default XmTestDomain, with our ramdisk)
21 domain = XmTestDomain()
23 # Start it
24 try:
25 console = domain.start()
26 except DomainError, e:
27 if verbose:
28 print "Failed to create test domain because:"
29 print e.extra
30 FAIL(str(e))
32 try:
33 # Make sure a command succeeds
34 run = console.runCmd("ls")
35 except ConsoleError, e:
36 FAIL(str(e))
38 # Close the console
39 domain.closeConsole()
41 seed(time.time())
43 for i in range(100):
44 pauseit = randint(0,1)
45 if(pauseit):
46 # Pause the domain
47 status, output = traceCommand("xm pause %s" % domain.getName())
48 if status != 0:
49 FAIL("xm pause returned invalid %i != 0", status)
50 else:
51 # Unpause the domain
52 status, output = traceCommand("xm unpause %s" % domain.getName())
53 if status != 0:
54 FAIL("xm unpause returned invalid %i != 0", status)
56 # Make sure the domain is unpaused before we finish up
57 status, output = traceCommand("xm unpause %s" % domain.getName())
58 if status != 0:
59 FAIL("xm unpause returned invalid %i != 0", status)
61 # Are we still alive after all that?
62 try:
63 console = domain.getConsole()
64 run = console.runCmd("ls")
65 except ConsoleError, e:
66 FAIL(str(e))
68 # Close the console
69 domain.closeConsole()
71 if run["return"] != 0:
72 FAIL("console failed to attach to supposedly unpaused domain")
74 # Stop the domain (nice shutdown)
75 domain.stop()