blob: 8c4714bf7f6b2b130ba6a4876669737202f44339 [file] [log] [blame]
Leah McNuttc9c9cde2016-10-07 16:53:52 +00001*** Settings ***
Michael Walsh0bbd8602016-11-22 11:31:49 -06002Documentation Do random repeated boots based on the state of the BMC machine.
3... The number of repetitions is designated by ${max_num_tests}. Keyword
4... names that are listed in @{AVAIL_BOOTS} become the selection of possible
5... boots for the test.
Leah McNuttc9c9cde2016-10-07 16:53:52 +00006
Leah McNuttc9c9cde2016-10-07 16:53:52 +00007Resource ../lib/dvt/obmc_driver_vars.txt
8Resource ../lib/list_utils.robot
Michael Walsh0bbd8602016-11-22 11:31:49 -06009Resource ../lib/openbmc_ffdc.robot
10
11Library ../lib/gen_robot_print.py
Michael Walsh55302292017-01-10 11:43:02 -060012Library ../lib/gen_misc.py
Michael Walsh0bbd8602016-11-22 11:31:49 -060013Library ../lib/gen_robot_plug_in.py
14Library ../lib/gen_robot_valid.py
15Library ../lib/state.py
16Library ../lib/boot/powerons.py
17Library ../lib/boot/poweroffs.py
18Library ../lib/obmc_boot_test.py
19
20# WITH NAME boot_results
21
22*** Variables ***
23# Initialize program parameters variables.
24# Create parm_list containing all of our program parameters. This is used by
25# 'Rqprint Pgm Header'
26@{parm_list} openbmc_nickname openbmc_host openbmc_username
27... openbmc_password os_host os_username os_password pdu_host
28... pdu_username pdu_password pdu_slot_no openbmc_serial_host
29... openbmc_serial_port boot_stack boot_list max_num_tests
30... plug_in_dir_paths status_file_path openbmc_model boot_pass boot_fail
Michael Walsh55302292017-01-10 11:43:02 -060031... ffdc_dir_path_style ffdc_check state_change_timeout power_on_timeout
32... power_on_timeout test_mode quiet debug
Michael Walsh0bbd8602016-11-22 11:31:49 -060033
34# Initialize each program parameter.
35${openbmc_nickname} ${EMPTY}
36${openbmc_host} ${EMPTY}
37${openbmc_username} root
38${openbmc_password} 0penBmc
39${os_host} ${EMPTY}
40${os_username} root
41${os_password} P@ssw0rd
42${pdu_host} ${EMPTY}
43${pdu_username} admin
44${pdu_password} admin
45${pdu_slot_no} ${EMPTY}
46${openbmc_serial_host} ${EMPTY}
47${openbmc_serial_port} ${EMPTY}
48${boot_stack} ${EMPTY}
49${boot_list} ${EMPTY}
50${max_num_tests} 0
51${plug_in_dir_paths} ${EMPTY}
52${status_file_path} ${EMPTY}
53${openbmc_model} ${EMPTY}
54# The reason boot_pass and boot_fail are parameters is that it is possible to
55# be called by a program that has already done some tests. This allows us to
56# keep the grand total.
57${boot_pass} ${0}
58${boot_fail} ${0}
Michael Walshb4125952016-12-13 15:49:50 -060059${ffdc_dir_path_style} ${EMPTY}
60${ffdc_check} ${EMPTY}
Michael Walsh55302292017-01-10 11:43:02 -060061${state_change_timeout} 1 min
62${power_on_timeout} 14 mins
63${power_off_timeout} 2 mins
Michael Walsh0bbd8602016-11-22 11:31:49 -060064${test_mode} 0
65${quiet} 0
66${debug} 0
67
Michael Walshb4125952016-12-13 15:49:50 -060068
Michael Walsh0bbd8602016-11-22 11:31:49 -060069# Plug-in variables.
70${shell_rc} 0x00000000
71${fail_on_plug_in_failure} 1
72${return_on_non_zero_rc} 0
73
74${next_boot} ${EMPTY}
75# State dictionary. Initializing to a realistic state for testing in
76# test_mode.
Michael Walsh0bbd8602016-11-22 11:31:49 -060077
78# Flag variables.
79${cp_setup_called} ${0}
80# test_really_running is needed by DB_Logging plug-in.
81${test_really_running} ${1}
Leah McNuttc9c9cde2016-10-07 16:53:52 +000082
83*** Test Cases ***
Michael Walsh0bbd8602016-11-22 11:31:49 -060084Randomized Boot Testing
85 [Documentation] Performs random, repeated boots.
86 [Tags] Randomized_boot_testing
Leah McNuttc9c9cde2016-10-07 16:53:52 +000087
88 # Call the Main keyword to prevent any dots from appearing in the console
89 # due to top level keywords.
90 Main
91
92*** Keywords ***
Michael Walsh0bbd8602016-11-22 11:31:49 -060093###############################################################################
Leah McNuttc9c9cde2016-10-07 16:53:52 +000094Main
Michael Walsh0bbd8602016-11-22 11:31:49 -060095 [Teardown] Program Teardown
Leah McNuttc9c9cde2016-10-07 16:53:52 +000096
Michael Walsh0bbd8602016-11-22 11:31:49 -060097 Setup
Leah McNuttc9c9cde2016-10-07 16:53:52 +000098
Michael Walsh0bbd8602016-11-22 11:31:49 -060099 :For ${BOOT_COUNT} IN RANGE ${max_num_tests}
100 \ Test Loop Body ${BOOT_COUNT}
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000101
Michael Walsh341c21e2017-01-17 16:25:20 -0600102 Rqprint Timen Completed all requested boot tests.
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000103
Michael Walsh0bbd8602016-11-22 11:31:49 -0600104###############################################################################
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000105
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000106
Michael Walsh0bbd8602016-11-22 11:31:49 -0600107###############################################################################
108Setup
109 [Documentation] Do general program setup tasks.
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000110
Michael Walsh0bbd8602016-11-22 11:31:49 -0600111 Validate Parms
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000112
Michael Walsh0bbd8602016-11-22 11:31:49 -0600113 Rqprint Pgm Header
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000114
Michael Walsh0bbd8602016-11-22 11:31:49 -0600115 Create Boot Results Table
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000116
Michael Walsh0bbd8602016-11-22 11:31:49 -0600117 # Preserve the values of boot_pass/boot_fail that were passed in.
118 Set Global Variable ${initial_boot_pass} ${boot_pass}
119 Set Global Variable ${initial_boot_fail} ${boot_fail}
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000120
Michael Walsh0bbd8602016-11-22 11:31:49 -0600121 # Call "setup" plug-ins, if any.
122 Plug In Setup
123 ${rc} ${shell_rc} ${failed_plug_in_name}= Rprocess Plug In Packages
124 ... call_point=setup
125 Should Be Equal '${rc}' '${0}'
126
127 # Keyword "FFDC" will fail if TEST_MESSAGE is not set.
128 Set Global Variable ${TEST_MESSAGE} ${EMPTY}
129
130 # Setting cp_setup_called lets our Teardown know that it needs to call
131 # the cleanup plug-in call point.
132 Set Global Variable ${cp_setup_called} ${1}
133
134 Rqprint Timen Getting system state.
135 # The state dictionary must be primed before calling Test Loop Body.
136 ${temp_state}= Run Keyword If '${test_mode}' == '0' Get State
137 ... ELSE Create Dictionary &{default_state}
138 Set Global Variable &{state} &{temp_state}
Michael Walsh341c21e2017-01-17 16:25:20 -0600139 Rqpvars state
Michael Walsh0bbd8602016-11-22 11:31:49 -0600140
141###############################################################################
142
143
144###############################################################################
145Validate Parms
146 [Documentation] Validate all program parameters.
147
Michael Walsh341c21e2017-01-17 16:25:20 -0600148 Rqprintn
Michael Walsh0bbd8602016-11-22 11:31:49 -0600149
150 Rvalid Value AVAIL_BOOTS
151 Rvalid Value openbmc_host
152 Rvalid Value openbmc_username
153 Rvalid Value openbmc_password
154 # os_host is optional so no validation is being done.
Michael Walshb4125952016-12-13 15:49:50 -0600155 Run Keyword If '${OS_HOST}' != '${EMPTY}' Run Keywords
156 ... Rvalid Value os_username AND
157 ... Rvalid Value os_password
Michael Walsh0bbd8602016-11-22 11:31:49 -0600158 Rvalid Value pdu_host
159 Rvalid Value pdu_username
160 Rvalid Value pdu_password
161 Rvalid Integer pdu_slot_no
162 Rvalid Value openbmc_serial_host
163 Rvalid Integer openbmc_serial_port
164 Rvalid Integer max_num_tests
165 Rvalid Value openbmc_model
166 Rvalid Integer boot_pass
167 Rvalid Integer boot_fail
168
169 ${boot_pass_temp}= Convert To Integer ${boot_pass}
170 Set Global Variable ${boot_pass} ${boot_pass_temp}
171 ${boot_fail_temp}= Convert To Integer ${boot_fail}
172 Set Global Variable ${boot_fail} ${boot_fail_temp}
173
174 ${temp_arr}= Rvalidate Plug Ins ${plug_in_dir_paths}
175 Set Global Variable @{plug_in_packages_list} @{temp_arr}
176
Michael Walsh55302292017-01-10 11:43:02 -0600177 Run Keyword If '${openbmc_nickname}' == '${EMPTY}'
178 ... Set Global Variable ${openbmc_nickname} ${openbmc_host}
179
Michael Walshb4125952016-12-13 15:49:50 -0600180 Set FFDC Dir Path Style
181
Michael Walsh341c21e2017-01-17 16:25:20 -0600182 ${default_state}= Return Default State
183 Set Global Variable ${state} ${default_state}
184 Set Global Variable ${default_state} ${default_state}
185
Michael Walshb4125952016-12-13 15:49:50 -0600186###############################################################################
187
188
189###############################################################################
190Set FFDC Dir Path Style
191
192 Run Keyword If '${ffdc_dir_path_style}' != '${EMPTY}' Return from Keyword
193
194 ${temp}= Run Keyword and Continue On Failure Get Environment Variable
195 ... FFDC_DIR_PATH_STYLE ${0}
196
197 Set Global Variable ${ffdc_dir_path_style} ${temp}
198
Michael Walsh0bbd8602016-11-22 11:31:49 -0600199###############################################################################
200
201
202###############################################################################
203Program Teardown
204 [Documentation] Clean up after this program.
205
206 Run Keyword If '${cp_setup_called}' == '1' Run Keywords
207 ... Plug In Setup AND
208 ... Rprocess Plug In Packages call_point=cleanup
209 ... stop_on_plug_in_failure=1
210
211 Rqprint Pgm Footer
212
213###############################################################################
214
215
216###############################################################################
217Test Loop Body
218 [Documentation] The main loop body for the loop in "main".
219 [Arguments] ${BOOT_COUNT}
220
221 Rqprintn
222 Rqprint Timen Starting boot ${BOOT_COUNT+1} of ${max_num_tests}.
223
Michael Walsh341c21e2017-01-17 16:25:20 -0600224 Rqpvars state
225
226 ${loc_next_boot}= Select Boot ${state}
Michael Walsh0bbd8602016-11-22 11:31:49 -0600227 Set Global Variable ${next_boot} ${loc_next_boot}
228
Michael Walsh55302292017-01-10 11:43:02 -0600229 # Clear this file. Plug-ins may now write to it.
230 Remove File ${FFDC_LIST_FILE_PATH}
231
Michael Walsh0bbd8602016-11-22 11:31:49 -0600232 ${status} ${msg}= Run Keyword And Ignore Error Run Boot ${next_boot}
233 Run Keyword If '${status}' == 'FAIL' rprint ${msg}
234
Michael Walsh341c21e2017-01-17 16:25:20 -0600235 Rqprintn
Michael Walsh0bbd8602016-11-22 11:31:49 -0600236 Run Keyword If '${BOOT_STATUS}' == 'PASS' Run Keywords
237 ... Set Global Variable ${boot_success} ${1} AND
238 ... Rqprint Timen BOOT_SUCCESS: "${next_boot}" succeeded.
239 ... ELSE Run Keywords
240 ... Set Global Variable ${boot_success} ${0} AND
241 ... Rqprint Timen BOOT_FAILED: ${next_boot} failed.
242
243 Update Boot Results Table ${next_boot} ${BOOT_STATUS}
244
245 # NOTE: A post_test_case call point failure is NOT counted as a boot
246 # failure.
247 Plug In Setup
248 ${rc} ${shell_rc} ${failed_plug_in_name}= Rprocess Plug In Packages
249 ... call_point=post_test_case stop_on_plug_in_failure=1
250
Michael Walsh55302292017-01-10 11:43:02 -0600251 ${rc} ${shell_rc} ${failed_plug_in_name}= Rprocess Plug In Packages
252 ... call_point=ffdc_check shell_rc=${0x00000200}
253 ... stop_on_plug_in_failure=1 stop_on_non_zero_rc=1
254
255 Run Keyword If
256 ... '${BOOT_STATUS}' != 'PASS' or '${FFDC_CHECK}' == 'All' or '${shell_rc}' == '${0x00000200}'
Michael Walsh0bbd8602016-11-22 11:31:49 -0600257 ... Run Keyword and Continue On Failure My FFDC
258
259 # Run plug-ins to see if we ought to stop execution.
260 Plug In Setup
261 ${rc} ${shell_rc} ${failed_plug_in_name}= Rprocess Plug In Packages
262 ... call_point=stop_check
263 Run Keyword If '${rc}' != '${0}' Run Keywords
264 ... Rprint Error Report Stopping as requested by user.
265 ... Fail
266
267 Print Boot Results Table
268 Rqprint Timen Finished boot ${BOOT_COUNT+1} of ${max_num_tests}.
269
270 Rqprint Timen Getting system state.
271 # The state must be refreshed before calling Test Loop Body again.
272 ${temp_state}= Run Keyword If '${test_mode}' == '0' Get State
273 ... quiet=${1}
274 ... ELSE Create Dictionary &{default_state}
275 Set Global Variable &{state} &{temp_state}
Michael Walsh341c21e2017-01-17 16:25:20 -0600276 Rqpvars state
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000277
Michael Walsh0bbd8602016-11-22 11:31:49 -0600278###############################################################################
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000279
Michael Walsh0bbd8602016-11-22 11:31:49 -0600280
281###############################################################################
282Run Boot
283 [Documentation] Run the selected boot and mark the status when complete.
284 [Arguments] ${boot_keyword}
285 [Teardown] Set Global Variable ${BOOT_STATUS} ${KEYWORD STATUS}
286
287 # boot_keyword The name of the boot to run, which corresponds to the
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000288 # keyword to run. (i.e "BMC Power On")
289
Michael Walsh0bbd8602016-11-22 11:31:49 -0600290 Print Test Start Message ${boot_keyword}
Leah McNuttc9c9cde2016-10-07 16:53:52 +0000291
Michael Walsh0bbd8602016-11-22 11:31:49 -0600292 Plug In Setup
293 ${rc} ${shell_rc} ${failed_plug_in_name}= Rprocess Plug In Packages
294 ... call_point=pre_boot
295 Should Be Equal '${rc}' '${0}'
296
297 @{cmd_buf}= Create List ${boot_keyword}
298 rqpissuing_keyword ${cmd_buf} ${test_mode}
299 Run Keyword If '${test_mode}' == '0' Run Keyword @{cmd_buf}
300
301 Plug In Setup
302 ${rc} ${shell_rc} ${failed_plug_in_name}= Rprocess Plug In Packages
303 ... call_point=post_boot
304 Should Be Equal '${rc}' '${0}'
305
306###############################################################################
307
308