mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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.
This commit is contained in:
1 parent
a71d394cc3
commit
574b65be2f
1 file changed
+14
-4
@@ -18,6 +18,13 @@ except DomainError, e:
|
||||
print e.extra
|
||||
FAIL(str(e))
|
||||
|
||||
try:
|
||||
console = XmConsole(domain.getName())
|
||||
except ConsoleError, e:
|
||||
FAIL(str(e))
|
||||
|
||||
console.closeConsole()
|
||||
|
||||
status, output = traceCommand("xm reboot %s" % domain.getName())
|
||||
|
||||
if status != 0:
|
||||
@@ -40,8 +47,11 @@ console.closeConsole()
|
||||
|
||||
domain.destroy()
|
||||
|
||||
items = re.split(" +", run["output"])
|
||||
uptime = int(items[3])
|
||||
if uptime > 1:
|
||||
FAIL("Uptime too large (%i > 1 minutes); domain didn't reboot")
|
||||
match = re.match("^[^up]*up ([0-9]+).*$", run["output"])
|
||||
if match:
|
||||
if int(match.group(1)) > 1:
|
||||
FAIL("Uptime too large (%i > 1 minutes); domain didn't reboot")
|
||||
else:
|
||||
FAIL("Invalid uptime string: %s (%s)" % (run["output"], match.group(1)))
|
||||
|
||||
|
||||