ia64/xen-unstable

view tools/xm-test/tests/create/14_create_blockroot_pos.py @ 8087:9964f27fd80b

Fix console handling; saveLog call was broken if ConsoleError occurred.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Sun Nov 27 10:46:26 2005 +0000 (2005-11-27)
parents ecb5997f7b25
children 1dc393b65019
line source
1 #!/usr/bin/python
3 # Copyright (C) International Business Machines Corp., 2005
4 # Authors: Dan Smith <danms@us.ibm.com>
6 from XmTestLib import *
8 import os
10 CONF_FILE = "/tmp/14_create_blockroot_pos.conf"
12 rdpath = os.path.abspath(os.environ.get("RD_PATH"))
14 # status, output = traceCommand("losetup -f %s" % rdpath)
15 # if status != 0:
16 # FAIL("Unable to get a free loop device")
17 #
18 # if verbose:
19 # print "Using %s" % output
21 opts = {"memory" : "64",
22 "root" : "/dev/hda1",
23 "name" : "14_create_blockroot",
24 "kernel" : getDefaultKernel() }
26 domain = XenDomain(opts=opts)
28 domain.configAddDisk("file:%s/initrd.img" % rdpath, "hda1", "w")
30 try:
31 domain.start()
32 except DomainError, e:
33 FAIL(str(e))
35 waitForBoot()
37 try:
38 console = XmConsole(domain.getName(), historySaveCmds=True)
39 except ConsoleError, e:
40 FAIL(str(e))
42 try:
43 # console.debugMe = True
44 console.sendInput("foo")
45 run = console.runCmd("ls")
47 except ConsoleError, e:
48 saveLog(console.getHistory())
49 FAIL(str(e))
51 if run["return"] != 0:
52 FAIL("DomU 'ls' failed")