direct-io.hg

changeset 7852:28eec8977024

Make 01_reboot test more robust.
We need to attach a console before rebooting to make sure the domain did
actually boot in the first place. Also, use a better method for pulling out
the uptime string.
author dan@guaranine.beaverton.ibm.com
date Wed Nov 16 20:32:36 2005 +0100 (2005-11-16)
parents 8ed932ab9f2a
children cbf6f95e9c62
files tools/xm-test/tests/reboot/01_reboot_basic_pos.py
line diff
     1.1 --- a/tools/xm-test/tests/reboot/01_reboot_basic_pos.py	Wed Nov 16 13:38:16 2005 +0100
     1.2 +++ b/tools/xm-test/tests/reboot/01_reboot_basic_pos.py	Wed Nov 16 20:32:36 2005 +0100
     1.3 @@ -18,6 +18,13 @@ except DomainError, e:
     1.4          print e.extra
     1.5      FAIL(str(e))
     1.6  
     1.7 +try:
     1.8 +    console = XmConsole(domain.getName())
     1.9 +except ConsoleError, e:
    1.10 +    FAIL(str(e))
    1.11 +
    1.12 +console.closeConsole()
    1.13 +
    1.14  status, output = traceCommand("xm reboot %s" % domain.getName())
    1.15  
    1.16  if status != 0:
    1.17 @@ -40,8 +47,11 @@ console.closeConsole()
    1.18  
    1.19  domain.destroy()
    1.20  
    1.21 -items = re.split(" +", run["output"])
    1.22 -uptime = int(items[3])
    1.23 -if uptime > 1:
    1.24 -    FAIL("Uptime too large (%i > 1 minutes); domain didn't reboot")
    1.25 +match = re.match("^[^up]*up ([0-9]+).*$", run["output"])
    1.26 +if match:
    1.27 +    if int(match.group(1)) > 1:
    1.28 +        FAIL("Uptime too large (%i > 1 minutes); domain didn't reboot")
    1.29 +else:
    1.30 +    FAIL("Invalid uptime string: %s (%s)" % (run["output"], match.group(1)))
    1.31  
    1.32 +