aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test/tests/sysrq/03_sysrq_withreboot_pos.py
blob: d314b40ccfabe5f6e97f95f8ac4b7637946ee17b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python

# Copyright (C) International Business Machines Corp., 2005
# Author: Dan Smith <danms@us.ibm.com>

from XmTestLib import *

import time

if ENABLE_HVM_SUPPORT:
    SKIP("Sysrq not supported for HVM domains")

domain = XmTestDomain()

try:
    console = domain.start()
except DomainError, e:
    if verbose:
        print "Failed to create domain:"
    print e.extra
    FAIL(str(e))

status, output = traceCommand("xm reboot %s" % domain.getName())
if status != 0:
    FAIL("reboot %s failed with %i != 0" % (domain.getName(), status))

# Wait for the reboot to finish
time.sleep(20)

status, output = traceCommand("xm sysrq %s s" % domain.getName())
if status != 0:
    FAIL("sysrq failed with %i != 0" % status)

try:
    run = console.runCmd("dmesg | grep -i reboot")
except ConsoleError, e:
    FAIL(str(e))

if run == 0:
    FAIL("reboot/sysrq resulted in reboot!")