@@ -53,9 +53,6 @@ def setUp(self):
53
53
self .platform = conf .platform ()
54
54
self .bmc_type = conf .args .bmc_type
55
55
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
-
59
56
60
57
##
61
58
# @brief This function will test the kernel crash followed by system
@@ -66,14 +63,7 @@ def setUp(self):
66
63
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
67
64
#
68
65
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
-
75
66
console = self .cv_SYSTEM .sys_get_ipmi_console ()
76
- self .cv_SYSTEM .host_console_login ()
77
67
self .cv_SYSTEM .host_console_unique_prompt ()
78
68
console .run_command ("uname -a" )
79
69
console .run_command ("cat /etc/os-release" )
@@ -90,10 +80,17 @@ def kernel_crash(self):
90
80
console .close ()
91
81
self .cv_HOST .ssh .state = SSHConnectionState .DISCONNECTED
92
82
print "System booted fine to host OS..."
83
+ self .cv_SYSTEM .set_state (OpSystemState .OS )
93
84
return BMC_CONST .FW_SUCCESS
94
85
95
86
class KernelCrash_KdumpEnable (OpTestKernelBase ):
96
87
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
+
97
94
##
98
95
# @brief This function will test the kernel crash followed by crash kernel dump
99
96
# and subsequent system IPL
@@ -104,6 +101,7 @@ class KernelCrash_KdumpEnable(OpTestKernelBase):
104
101
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
105
102
#
106
103
def runTest (self ):
104
+ self .setup_test ()
107
105
self .cv_HOST .host_check_command ("kdump" )
108
106
os_level = self .cv_HOST .host_get_OS_Level ()
109
107
self .cv_HOST .host_run_command ("stty cols 300;stty rows 30" )
@@ -112,6 +110,12 @@ def runTest(self):
112
110
113
111
class KernelCrash_KdumpDisable (OpTestKernelBase ):
114
112
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
+
115
119
##
116
120
# @brief This function will test the kernel crash followed by system IPL
117
121
# 1. Make sure kdump service is stopped before test
@@ -121,14 +125,46 @@ class KernelCrash_KdumpDisable(OpTestKernelBase):
121
125
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
122
126
#
123
127
def runTest (self ):
128
+ self .setup_test ()
124
129
self .cv_HOST .host_check_command ("kdump" )
125
130
os_level = self .cv_HOST .host_get_OS_Level ()
126
131
self .cv_HOST .host_run_command ("stty cols 300;stty rows 30" )
127
132
self .cv_HOST .host_disable_kdump_service (os_level )
128
133
self .kernel_crash ()
129
134
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
+
130
165
def crash_suite ():
131
166
s = unittest .TestSuite ()
132
167
s .addTest (KernelCrash_KdumpEnable ())
133
168
s .addTest (KernelCrash_KdumpDisable ())
169
+ s .addTest (SkirootKernelCrash ())
134
170
return s
0 commit comments