@@ -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
9586class 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
113111class 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+
130165def 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