debuggers.hg

view tools/xm-test/tests/pause/01_pause_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: Paul Larson <pl@us.ibm.com>
6 # Description:
7 # Positive Tests:
8 # Tests for xm pause
9 # 1) Create domain, verify it's up with console
10 # 2) pause the domain
11 # 3) verify it's paused by failure to connect console
13 import time
14 import commands
16 from XmTestLib import *
18 # Create a domain (default XmTestDomain, with our ramdisk)
19 domain = XmTestDomain()
21 # Start it
22 try:
23 console = domain.start()
24 except DomainError, e:
25 if verbose:
26 print "Failed to create test domain because:"
27 print e.extra
28 FAIL(str(e))
30 try:
31 # Make sure a command succeeds
32 run = console.runCmd("ls")
33 except ConsoleError, e:
34 FAIL(str(e))
36 # Close the console
37 domain.closeConsole()
39 # Pause the domain
40 status, output = traceCommand("xm pause %s" % domain.getName())
41 if status != 0:
42 FAIL("xm pause returned invalid %i != 0", status)
44 # Try to attach a console to it
45 try:
46 console = domain.getConsole()
47 console.setHistorySaveCmds(value=True)
48 run = console.runCmd("ls")
49 #If we get here, console attached to paused domain (unexpected)
50 FAIL("console attached to supposedly paused domain")
51 except ConsoleError, e:
52 pass
54 # Close the console
55 domain.closeConsole()
57 status, output = traceCommand("xm unpause %s" % domain.getName())
58 if status != 0:
59 FAIL("xm unpause returned invalid %i != 0", status)
61 # Stop the domain (nice shutdown)
62 domain.stop()