Skip to content

Commit 4fb955d

Browse files
committed
2 parents 7033057 + 549802e commit 4fb955d

File tree

3 files changed

+66
-10
lines changed

3 files changed

+66
-10
lines changed

common/OpTestIPMI.py

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ def terminate(self):
112112
def close(self):
113113
if self.state == IPMIConsoleState.DISCONNECTED:
114114
return
115+
if not self.sol.isalive():
116+
print "IPMI SOL Console is already disconnected"
117+
return
115118
try:
116119
self.sol.send("\r")
117120
self.sol.send('~.')

testcases/OpTestInbandUsbInterface.py

+17
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,39 @@ def full_suite():
5858
def skiroot_full_suite():
5959
return unittest.defaultTestLoader.loadTestsFromTestCase(SkirootInbandUSB)
6060

61+
conf = OpTestConfiguration.conf
62+
6163
class BasicInbandUSB(BasicInbandIPMI):
6264
def setUp(self, ipmi_method=BMC_CONST.IPMITOOL_USB):
65+
self.bmc_type = conf.args.bmc_type
66+
if "FSP" in self.bmc_type:
67+
self.skipTest("OP BMC specific")
6368
super(BasicInbandUSB, self).setUp(ipmi_method=ipmi_method)
6469

6570
class InbandUSB(OpTestInbandIPMI):
6671
def setUp(self, ipmi_method=BMC_CONST.IPMITOOL_USB):
72+
self.bmc_type = conf.args.bmc_type
73+
if "FSP" in self.bmc_type:
74+
self.skipTest("OP BMC specific")
6775
super(InbandUSB, self).setUp(ipmi_method=ipmi_method)
6876

6977
class SkirootBasicInbandUSB(SkirootBasicInbandIPMI):
7078
def setUp(self, ipmi_method=BMC_CONST.IPMITOOL_USB):
79+
self.bmc_type = conf.args.bmc_type
80+
if "FSP" in self.bmc_type:
81+
self.skipTest("OP BMC specific")
7182
super(SkirootBasicInbandUSB, self).setUp(ipmi_method=ipmi_method)
7283

7384
class SkirootInbandUSB(SkirootFullInbandIPMI):
7485
def setUp(self, ipmi_method=BMC_CONST.IPMITOOL_USB):
86+
self.bmc_type = conf.args.bmc_type
87+
if "FSP" in self.bmc_type:
88+
self.skipTest("OP BMC specific")
7589
super(SkirootInbandUSB, self).setUp(ipmi_method=ipmi_method)
7690

7791
class ExperimentalInbandUSB(ExperimentalInbandIPMI):
7892
def setUp(self, ipmi_method=BMC_CONST.IPMITOOL_USB):
93+
self.bmc_type = conf.args.bmc_type
94+
if "FSP" in self.bmc_type:
95+
self.skipTest("OP BMC specific")
7996
super(ExperimentalInbandUSB, self).setUp(ipmi_method=ipmi_method)

testcases/OpTestKernel.py

+46-10
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ def setUp(self):
5353
self.platform = conf.platform()
5454
self.bmc_type = conf.args.bmc_type
5555
self.util = self.cv_SYSTEM.util
56-
self.cv_SYSTEM.goto_state(OpSystemState.OS)
57-
self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
58-
5956

6057
##
6158
# @brief This function will test the kernel crash followed by system
@@ -66,14 +63,7 @@ def setUp(self):
6663
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
6764
#
6865
def kernel_crash(self):
69-
# Get OS level
70-
self.cv_HOST.host_get_OS_Level()
71-
72-
# Get Kernel Version
73-
l_kernel = self.cv_HOST.host_get_kernel_version()
74-
7566
console = self.cv_SYSTEM.sys_get_ipmi_console()
76-
self.cv_SYSTEM.host_console_login()
7767
self.cv_SYSTEM.host_console_unique_prompt()
7868
console.run_command("uname -a")
7969
console.run_command("cat /etc/os-release")
@@ -90,10 +80,17 @@ def kernel_crash(self):
9080
console.close()
9181
self.cv_HOST.ssh.state = SSHConnectionState.DISCONNECTED
9282
print "System booted fine to host OS..."
83+
self.cv_SYSTEM.set_state(OpSystemState.OS)
9384
return BMC_CONST.FW_SUCCESS
9485

9586
class KernelCrash_KdumpEnable(OpTestKernelBase):
9687

88+
def setup_test(self):
89+
self.cv_SYSTEM.goto_state(OpSystemState.OS)
90+
self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
91+
console = self.cv_SYSTEM.sys_get_ipmi_console()
92+
self.cv_SYSTEM.host_console_login()
93+
9794
##
9895
# @brief This function will test the kernel crash followed by crash kernel dump
9996
# and subsequent system IPL
@@ -104,6 +101,7 @@ class KernelCrash_KdumpEnable(OpTestKernelBase):
104101
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
105102
#
106103
def runTest(self):
104+
self.setup_test()
107105
self.cv_HOST.host_check_command("kdump")
108106
os_level = self.cv_HOST.host_get_OS_Level()
109107
self.cv_HOST.host_run_command("stty cols 300;stty rows 30")
@@ -112,6 +110,12 @@ def runTest(self):
112110

113111
class KernelCrash_KdumpDisable(OpTestKernelBase):
114112

113+
def setup_test(self):
114+
self.cv_SYSTEM.goto_state(OpSystemState.OS)
115+
self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
116+
console = self.cv_SYSTEM.sys_get_ipmi_console()
117+
self.cv_SYSTEM.host_console_login()
118+
115119
##
116120
# @brief This function will test the kernel crash followed by system IPL
117121
# 1. Make sure kdump service is stopped before test
@@ -121,14 +125,46 @@ class KernelCrash_KdumpDisable(OpTestKernelBase):
121125
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
122126
#
123127
def runTest(self):
128+
self.setup_test()
124129
self.cv_HOST.host_check_command("kdump")
125130
os_level = self.cv_HOST.host_get_OS_Level()
126131
self.cv_HOST.host_run_command("stty cols 300;stty rows 30")
127132
self.cv_HOST.host_disable_kdump_service(os_level)
128133
self.kernel_crash()
129134

135+
class SkirootKernelCrash(OpTestKernelBase, unittest.TestCase):
136+
def setup_test(self):
137+
self.cv_SYSTEM.goto_state(OpSystemState.PETITBOOT_SHELL)
138+
self.c = self.cv_SYSTEM.sys_get_ipmi_console()
139+
self.cv_SYSTEM.host_console_unique_prompt()
140+
output = self.c.run_command("cat /proc/cmdline")
141+
res = ""
142+
for pair in output[0].split(" "):
143+
if "xmon" in pair:
144+
pair = "xmon=off"
145+
res = "%s %s" % (res, pair)
146+
bootargs = "\'%s\'" % res
147+
print bootargs
148+
self.c.run_command("nvram -p ibm,skiboot --update-config bootargs=%s" % bootargs)
149+
self.cv_SYSTEM.goto_state(OpSystemState.OFF)
150+
self.cv_SYSTEM.goto_state(OpSystemState.PETITBOOT_SHELL)
151+
152+
##
153+
# @brief This tests the Skiroot kernel crash followed by system IPL
154+
# 1. Skiroot kernel has by default xmon is on, so made it off
155+
# 2. Trigger kernel crash: echo c > /proc/sysrq-trigger
156+
# 3. Check for system booting
157+
#
158+
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
159+
#
160+
def runTest(self):
161+
self.setup_test()
162+
self.cv_SYSTEM.sys_set_bootdev_no_override()
163+
self.kernel_crash()
164+
130165
def crash_suite():
131166
s = unittest.TestSuite()
132167
s.addTest(KernelCrash_KdumpEnable())
133168
s.addTest(KernelCrash_KdumpDisable())
169+
s.addTest(SkirootKernelCrash())
134170
return s

0 commit comments

Comments
 (0)