blob: 76f804d5fac0f016eb468f5a26ceaa24a21069a1 [file] [log] [blame]
Michael Walsh0bbd8602016-11-22 11:31:49 -06001#!/usr/bin/env python
2
3r"""
4This module is the python counterpart to obmc_boot_test.
5"""
6
Michael Walsh0b93fbf2017-03-02 14:42:41 -06007import os
8import imp
9import time
10import glob
11import random
Michael Walsh0ad0f7f2017-05-04 14:39:58 -050012import re
Michael Walsh0b93fbf2017-03-02 14:42:41 -060013import cPickle as pickle
Michael Walshdc80d672017-05-09 12:58:32 -050014import socket
Michael Walsh0b93fbf2017-03-02 14:42:41 -060015
16from robot.utils import DotDict
17from robot.libraries.BuiltIn import BuiltIn
18
Michael Walsh6741f742017-02-20 16:16:38 -060019from boot_data import *
Michael Walshc9116812017-03-10 14:23:06 -060020import gen_print as gp
Michael Walsh0bbd8602016-11-22 11:31:49 -060021import gen_robot_print as grp
Michael Walsh55302292017-01-10 11:43:02 -060022import gen_robot_plug_in as grpi
Michael Walsh6741f742017-02-20 16:16:38 -060023import gen_robot_valid as grv
24import gen_misc as gm
25import gen_cmd as gc
Michael Walshb5839d02017-04-12 16:11:20 -050026import gen_robot_keyword as grk
Michael Walsh55302292017-01-10 11:43:02 -060027import state as st
Michael Walsh0bbd8602016-11-22 11:31:49 -060028
Michael Walsh0b93fbf2017-03-02 14:42:41 -060029base_path = os.path.dirname(os.path.dirname(
30 imp.find_module("gen_robot_print")[1])) +\
Michael Walshc9116812017-03-10 14:23:06 -060031 os.sep
Michael Walsh0b93fbf2017-03-02 14:42:41 -060032sys.path.append(base_path + "extended/")
33import run_keyword as rk
Michael Walsh0bbd8602016-11-22 11:31:49 -060034
Michael Walshe1e26442017-03-06 17:50:07 -060035# Setting master_pid correctly influences the behavior of plug-ins like
36# DB_Logging
37program_pid = os.getpid()
38master_pid = os.environ.get('AUTOBOOT_MASTER_PID', program_pid)
39
Michael Walshb5839d02017-04-12 16:11:20 -050040# Set up boot data structures.
41boot_table = create_boot_table()
42valid_boot_types = create_valid_boot_list(boot_table)
Michael Walsh0b93fbf2017-03-02 14:42:41 -060043
Michael Walsh6741f742017-02-20 16:16:38 -060044boot_lists = read_boot_lists()
45last_ten = []
Michael Walsh6741f742017-02-20 16:16:38 -060046
47state = st.return_default_state()
48cp_setup_called = 0
49next_boot = ""
50base_tool_dir_path = os.path.normpath(os.environ.get(
51 'AUTOBOOT_BASE_TOOL_DIR_PATH', "/tmp")) + os.sep
Michael Walshb5839d02017-04-12 16:11:20 -050052
Michael Walsh6741f742017-02-20 16:16:38 -060053ffdc_dir_path = os.path.normpath(os.environ.get('FFDC_DIR_PATH', '')) + os.sep
Michael Walsh6741f742017-02-20 16:16:38 -060054boot_success = 0
Michael Walsh6741f742017-02-20 16:16:38 -060055status_dir_path = os.environ.get('STATUS_DIR_PATH', "")
56if status_dir_path != "":
57 status_dir_path = os.path.normpath(status_dir_path) + os.sep
Michael Walsh0b93fbf2017-03-02 14:42:41 -060058default_power_on = "REST Power On"
59default_power_off = "REST Power Off"
Michael Walsh6741f742017-02-20 16:16:38 -060060boot_count = 0
Michael Walsh0bbd8602016-11-22 11:31:49 -060061
Michael Walsh85678942017-03-27 14:34:22 -050062LOG_LEVEL = BuiltIn().get_variable_value("${LOG_LEVEL}")
Michael Walshe1974b92017-08-03 13:39:51 -050063ffdc_prefix = ""
Michael Walsh85678942017-03-27 14:34:22 -050064
65
66###############################################################################
Michael Walsh0ad0f7f2017-05-04 14:39:58 -050067def process_host(host,
68 host_var_name=""):
69
70 r"""
71 Process a host by getting the associated host name and IP address and
72 setting them in global variables.
73
74 If the caller does not pass the host_var_name, this function will try to
75 figure out the name of the variable used by the caller for the host parm.
76 Callers are advised to explicitly specify the host_var_name when calling
77 with an exec command. In such cases, the get_arg_name cannot figure out
78 the host variable name.
79
80 This function will then create similar global variable names by
81 removing "_host" and appending "_host_name" or "_ip" to the host variable
82 name.
83
84 Example:
85
86 If a call is made like this:
87 process_host(openbmc_host)
88
89 Global variables openbmc_host_name and openbmc_ip will be set.
90
91 Description of argument(s):
92 host A host name or IP. The name of the variable used should
93 have a suffix of "_host".
94 host_var_name The name of the variable being used as the host parm.
95 """
96
97 if host_var_name == "":
98 host_var_name = gp.get_arg_name(0, 1, stack_frame_ix=2)
99
100 host_name_var_name = re.sub("host", "host_name", host_var_name)
101 ip_var_name = re.sub("host", "ip", host_var_name)
102 cmd_buf = "global " + host_name_var_name + ", " + ip_var_name + " ; " +\
103 host_name_var_name + ", " + ip_var_name + " = gm.get_host_name_ip('" +\
104 host + "')"
105 exec(cmd_buf)
106
107###############################################################################
108
109
110###############################################################################
Michael Walshb5839d02017-04-12 16:11:20 -0500111def process_pgm_parms():
112
113 r"""
114 Process the program parameters by assigning them all to corresponding
115 globals. Also, set some global values that depend on program parameters.
116 """
117
118 # Program parameter processing.
119 # Assign all program parms to python variables which are global to this
120 # module.
121
122 global parm_list
123 parm_list = BuiltIn().get_variable_value("${parm_list}")
124 # The following subset of parms should be processed as integers.
125 int_list = ['max_num_tests', 'boot_pass', 'boot_fail', 'ffdc_only',
126 'boot_fail_threshold', 'quiet', 'test_mode', 'debug']
127 for parm in parm_list:
128 if parm in int_list:
129 sub_cmd = "int(BuiltIn().get_variable_value(\"${" + parm +\
130 "}\", \"0\"))"
131 else:
132 sub_cmd = "BuiltIn().get_variable_value(\"${" + parm + "}\")"
133 cmd_buf = "global " + parm + " ; " + parm + " = " + sub_cmd
134 exec(cmd_buf)
Michael Walsh0ad0f7f2017-05-04 14:39:58 -0500135 if re.match(r".*_host$", parm):
136 cmd_buf = "process_host(" + parm + ", '" + parm + "')"
137 exec(cmd_buf)
138 if re.match(r".*_password$", parm):
139 # Register the value of any parm whose name ends in _password.
140 # This will cause the print functions to replace passwords with
141 # asterisks in the output.
142 cmd_buf = "gp.register_passwords(" + parm + ")"
143 exec(cmd_buf)
Michael Walshb5839d02017-04-12 16:11:20 -0500144
145 global ffdc_dir_path_style
146 global boot_list
147 global boot_stack
148 global boot_results_file_path
149 global boot_results
150 global ffdc_list_file_path
Michael Walshe0cf8d72017-05-17 13:20:46 -0500151 global ffdc_report_list_path
Michael Walsh600876d2017-05-30 17:58:58 -0500152 global ffdc_summary_list_path
Michael Walshb5839d02017-04-12 16:11:20 -0500153
154 if ffdc_dir_path_style == "":
155 ffdc_dir_path_style = int(os.environ.get('FFDC_DIR_PATH_STYLE', '0'))
156
157 # Convert these program parms to lists for easier processing..
158 boot_list = filter(None, boot_list.split(":"))
159 boot_stack = filter(None, boot_stack.split(":"))
160
161 boot_results_file_path = "/tmp/" + openbmc_nickname + ":pid_" +\
162 str(master_pid) + ":boot_results"
163
164 if os.path.isfile(boot_results_file_path):
165 # We've been called before in this run so we'll load the saved
166 # boot_results object.
167 boot_results = pickle.load(open(boot_results_file_path, 'rb'))
168 else:
169 boot_results = boot_results(boot_table, boot_pass, boot_fail)
170
171 ffdc_list_file_path = base_tool_dir_path + openbmc_nickname +\
172 "/FFDC_FILE_LIST"
Michael Walshe0cf8d72017-05-17 13:20:46 -0500173 ffdc_report_list_path = base_tool_dir_path + openbmc_nickname +\
174 "/FFDC_REPORT_FILE_LIST"
Michael Walshb5839d02017-04-12 16:11:20 -0500175
Michael Walsh600876d2017-05-30 17:58:58 -0500176 ffdc_summary_list_path = base_tool_dir_path + openbmc_nickname +\
177 "/FFDC_SUMMARY_FILE_LIST"
178
Michael Walshb5839d02017-04-12 16:11:20 -0500179###############################################################################
180
181
182###############################################################################
Michael Walsh85678942017-03-27 14:34:22 -0500183def initial_plug_in_setup():
184
185 r"""
186 Initialize all plug-in environment variables which do not change for the
187 duration of the program.
188
189 """
190
191 global LOG_LEVEL
192 BuiltIn().set_log_level("NONE")
193
194 BuiltIn().set_global_variable("${master_pid}", master_pid)
195 BuiltIn().set_global_variable("${FFDC_DIR_PATH}", ffdc_dir_path)
196 BuiltIn().set_global_variable("${STATUS_DIR_PATH}", status_dir_path)
197 BuiltIn().set_global_variable("${BASE_TOOL_DIR_PATH}", base_tool_dir_path)
198 BuiltIn().set_global_variable("${FFDC_LIST_FILE_PATH}",
199 ffdc_list_file_path)
Michael Walshe0cf8d72017-05-17 13:20:46 -0500200 BuiltIn().set_global_variable("${FFDC_REPORT_LIST_PATH}",
201 ffdc_report_list_path)
Michael Walsh600876d2017-05-30 17:58:58 -0500202 BuiltIn().set_global_variable("${FFDC_SUMMARY_LIST_PATH}",
203 ffdc_summary_list_path)
Michael Walsh85678942017-03-27 14:34:22 -0500204
205 BuiltIn().set_global_variable("${FFDC_DIR_PATH_STYLE}",
206 ffdc_dir_path_style)
207 BuiltIn().set_global_variable("${FFDC_CHECK}",
208 ffdc_check)
209
210 # For each program parameter, set the corresponding AUTOBOOT_ environment
211 # variable value. Also, set an AUTOBOOT_ environment variable for every
212 # element in additional_values.
213 additional_values = ["program_pid", "master_pid", "ffdc_dir_path",
214 "status_dir_path", "base_tool_dir_path",
Michael Walsh600876d2017-05-30 17:58:58 -0500215 "ffdc_list_file_path", "ffdc_report_list_path",
216 "ffdc_summary_list_path"]
Michael Walsh85678942017-03-27 14:34:22 -0500217
218 plug_in_vars = parm_list + additional_values
219
220 for var_name in plug_in_vars:
221 var_value = BuiltIn().get_variable_value("${" + var_name + "}")
222 var_name = var_name.upper()
223 if var_value is None:
224 var_value = ""
225 os.environ["AUTOBOOT_" + var_name] = str(var_value)
226
227 BuiltIn().set_log_level(LOG_LEVEL)
228
Michael Walsh68a61162017-04-25 11:54:06 -0500229 # Make sure the ffdc list directory exists.
230 ffdc_list_dir_path = os.path.dirname(ffdc_list_file_path) + os.sep
231 if not os.path.exists(ffdc_list_dir_path):
232 os.makedirs(ffdc_list_dir_path)
Michael Walsh85678942017-03-27 14:34:22 -0500233
234###############################################################################
235
Michael Walsh0bbd8602016-11-22 11:31:49 -0600236
237###############################################################################
Michael Walsh0bbd8602016-11-22 11:31:49 -0600238def plug_in_setup():
239
240 r"""
Michael Walsh85678942017-03-27 14:34:22 -0500241 Initialize all changing plug-in environment variables for use by the
242 plug-in programs.
Michael Walsh0bbd8602016-11-22 11:31:49 -0600243 """
244
Michael Walsh85678942017-03-27 14:34:22 -0500245 global LOG_LEVEL
246 global test_really_running
247
248 BuiltIn().set_log_level("NONE")
249
Michael Walsh6741f742017-02-20 16:16:38 -0600250 boot_pass, boot_fail = boot_results.return_total_pass_fail()
Michael Walsh0bbd8602016-11-22 11:31:49 -0600251 if boot_pass > 1:
252 test_really_running = 1
253 else:
254 test_really_running = 0
255
Michael Walsh6741f742017-02-20 16:16:38 -0600256 BuiltIn().set_global_variable("${test_really_running}",
257 test_really_running)
258 BuiltIn().set_global_variable("${boot_type_desc}", next_boot)
Michael Walsh6741f742017-02-20 16:16:38 -0600259 BuiltIn().set_global_variable("${boot_pass}", boot_pass)
260 BuiltIn().set_global_variable("${boot_fail}", boot_fail)
261 BuiltIn().set_global_variable("${boot_success}", boot_success)
262 BuiltIn().set_global_variable("${ffdc_prefix}", ffdc_prefix)
Michael Walsh4c9a6452016-12-13 16:03:11 -0600263
Michael Walsh0bbd8602016-11-22 11:31:49 -0600264 # For each program parameter, set the corresponding AUTOBOOT_ environment
265 # variable value. Also, set an AUTOBOOT_ environment variable for every
266 # element in additional_values.
267 additional_values = ["boot_type_desc", "boot_success", "boot_pass",
Michael Walsh85678942017-03-27 14:34:22 -0500268 "boot_fail", "test_really_running", "ffdc_prefix"]
Michael Walsh0bbd8602016-11-22 11:31:49 -0600269
Michael Walsh85678942017-03-27 14:34:22 -0500270 plug_in_vars = additional_values
Michael Walsh0bbd8602016-11-22 11:31:49 -0600271
272 for var_name in plug_in_vars:
273 var_value = BuiltIn().get_variable_value("${" + var_name + "}")
274 var_name = var_name.upper()
275 if var_value is None:
276 var_value = ""
Michael Walsh6741f742017-02-20 16:16:38 -0600277 os.environ["AUTOBOOT_" + var_name] = str(var_value)
Michael Walsh0bbd8602016-11-22 11:31:49 -0600278
Michael Walsh0bbd8602016-11-22 11:31:49 -0600279 if debug:
Michael Walsh6741f742017-02-20 16:16:38 -0600280 shell_rc, out_buf = \
281 gc.cmd_fnc_u("printenv | egrep AUTOBOOT_ | sort -u")
Michael Walsh0bbd8602016-11-22 11:31:49 -0600282
Michael Walsh85678942017-03-27 14:34:22 -0500283 BuiltIn().set_log_level(LOG_LEVEL)
284
Michael Walsh0bbd8602016-11-22 11:31:49 -0600285###############################################################################
286
287
288###############################################################################
Michael Walshe0cf8d72017-05-17 13:20:46 -0500289def pre_boot_plug_in_setup():
290
291 # Clear the ffdc_list_file_path file. Plug-ins may now write to it.
292 try:
293 os.remove(ffdc_list_file_path)
294 except OSError:
295 pass
296
297 # Clear the ffdc_report_list_path file. Plug-ins may now write to it.
298 try:
299 os.remove(ffdc_report_list_path)
300 except OSError:
301 pass
302
Michael Walsh600876d2017-05-30 17:58:58 -0500303 # Clear the ffdc_summary_list_path file. Plug-ins may now write to it.
304 try:
305 os.remove(ffdc_summary_list_path)
306 except OSError:
307 pass
308
Michael Walshe1974b92017-08-03 13:39:51 -0500309 global ffdc_prefix
310
311 seconds = time.time()
312 loc_time = time.localtime(seconds)
313 time_string = time.strftime("%y%m%d.%H%M%S.", loc_time)
314
315 ffdc_prefix = openbmc_nickname + "." + time_string
316
Michael Walshe0cf8d72017-05-17 13:20:46 -0500317###############################################################################
318
319
320###############################################################################
Michael Walsh6741f742017-02-20 16:16:38 -0600321def setup():
Michael Walsh0bbd8602016-11-22 11:31:49 -0600322
323 r"""
Michael Walsh6741f742017-02-20 16:16:38 -0600324 Do general program setup tasks.
Michael Walsh0bbd8602016-11-22 11:31:49 -0600325 """
326
Michael Walsh6741f742017-02-20 16:16:38 -0600327 global cp_setup_called
Michael Walsh0bbd8602016-11-22 11:31:49 -0600328
Michael Walshb5839d02017-04-12 16:11:20 -0500329 gp.qprintn()
330
Michael Walsh83f4bc72017-04-20 16:49:43 -0500331 robot_pgm_dir_path = os.path.dirname(__file__) + os.sep
332 repo_bin_path = robot_pgm_dir_path.replace("/lib/", "/bin/")
Michael Walshd061c042017-05-23 14:46:57 -0500333 # If we can't find process_plug_in_packages.py, ssh_pw or
334 # validate_plug_ins.py, then we don't have our repo bin in PATH.
335 shell_rc, out_buf = gc.cmd_fnc_u("which process_plug_in_packages.py" +
336 " ssh_pw validate_plug_ins.py", quiet=1,
337 print_output=0, show_err=0)
Michael Walshb5839d02017-04-12 16:11:20 -0500338 if shell_rc != 0:
Michael Walsh83f4bc72017-04-20 16:49:43 -0500339 os.environ['PATH'] = repo_bin_path + ":" + os.environ.get('PATH', "")
340 # Likewise, our repo lib subdir needs to be in sys.path and PYTHONPATH.
341 if robot_pgm_dir_path not in sys.path:
342 sys.path.append(robot_pgm_dir_path)
343 PYTHONPATH = os.environ.get("PYTHONPATH", "")
344 if PYTHONPATH == "":
345 os.environ['PYTHONPATH'] = robot_pgm_dir_path
346 else:
347 os.environ['PYTHONPATH'] = robot_pgm_dir_path + ":" + PYTHONPATH
Michael Walsh6741f742017-02-20 16:16:38 -0600348
349 validate_parms()
350
351 grp.rqprint_pgm_header()
352
George Keishingd85b28f2017-08-17 00:31:54 -0500353 # TODO: Need to fix to switch between old and new.
354 # Disabling for a brief moment.
355 #grk.run_key("Set BMC Power Policy ${RESTORE_LAST_STATE}")
Michael Walsh11cfc8c2017-03-31 09:40:55 -0500356
Michael Walsh85678942017-03-27 14:34:22 -0500357 initial_plug_in_setup()
358
Michael Walsh6741f742017-02-20 16:16:38 -0600359 plug_in_setup()
360 rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages(
361 call_point='setup')
362 if rc != 0:
363 error_message = "Plug-in setup failed.\n"
364 grp.rprint_error_report(error_message)
365 BuiltIn().fail(error_message)
366 # Setting cp_setup_called lets our Teardown know that it needs to call
367 # the cleanup plug-in call point.
368 cp_setup_called = 1
369
370 # Keyword "FFDC" will fail if TEST_MESSAGE is not set.
371 BuiltIn().set_global_variable("${TEST_MESSAGE}", "${EMPTY}")
Michael Walsh85678942017-03-27 14:34:22 -0500372 # FFDC_LOG_PATH is used by "FFDC" keyword.
373 BuiltIn().set_global_variable("${FFDC_LOG_PATH}", ffdc_dir_path)
Michael Walsh6741f742017-02-20 16:16:38 -0600374
Michael Walshdc80d672017-05-09 12:58:32 -0500375 # Also printed by FFDC.
376 global host_name
377 global host_ip
378 host = socket.gethostname()
379 host_name, host_ip = gm.get_host_name_ip(host)
380
Michael Walshb5839d02017-04-12 16:11:20 -0500381 gp.dprint_var(boot_table, 1)
382 gp.dprint_var(boot_lists)
Michael Walsh0bbd8602016-11-22 11:31:49 -0600383
384###############################################################################
385
386
387###############################################################################
Michael Walsh6741f742017-02-20 16:16:38 -0600388def validate_parms():
Michael Walsh0bbd8602016-11-22 11:31:49 -0600389
390 r"""
Michael Walsh6741f742017-02-20 16:16:38 -0600391 Validate all program parameters.
Michael Walsh0bbd8602016-11-22 11:31:49 -0600392 """
393
Michael Walshb5839d02017-04-12 16:11:20 -0500394 process_pgm_parms()
Michael Walsh0bbd8602016-11-22 11:31:49 -0600395
Michael Walshb5839d02017-04-12 16:11:20 -0500396 gp.qprintn()
397
398 global openbmc_model
Michael Walsh6741f742017-02-20 16:16:38 -0600399 grv.rvalid_value("openbmc_host")
400 grv.rvalid_value("openbmc_username")
401 grv.rvalid_value("openbmc_password")
402 if os_host != "":
403 grv.rvalid_value("os_username")
404 grv.rvalid_value("os_password")
Michael Walsh0bbd8602016-11-22 11:31:49 -0600405
Michael Walsh6741f742017-02-20 16:16:38 -0600406 if pdu_host != "":
407 grv.rvalid_value("pdu_username")
408 grv.rvalid_value("pdu_password")
Michael Walsh85678942017-03-27 14:34:22 -0500409 grv.rvalid_integer("pdu_slot_no")
Michael Walsh6741f742017-02-20 16:16:38 -0600410 if openbmc_serial_host != "":
411 grv.rvalid_integer("openbmc_serial_port")
Michael Walshb5839d02017-04-12 16:11:20 -0500412 if openbmc_model == "":
413 status, ret_values =\
414 grk.run_key_u("Get BMC System Model")
415 openbmc_model = ret_values
416 BuiltIn().set_global_variable("${openbmc_model}", openbmc_model)
Michael Walsh6741f742017-02-20 16:16:38 -0600417 grv.rvalid_value("openbmc_model")
Michael Walshb5839d02017-04-12 16:11:20 -0500418 grv.rvalid_integer("max_num_tests")
Michael Walsh6741f742017-02-20 16:16:38 -0600419 grv.rvalid_integer("boot_pass")
420 grv.rvalid_integer("boot_fail")
421
422 plug_in_packages_list = grpi.rvalidate_plug_ins(plug_in_dir_paths)
423 BuiltIn().set_global_variable("${plug_in_packages_list}",
424 plug_in_packages_list)
425
Michael Walshb5839d02017-04-12 16:11:20 -0500426 grv.rvalid_value("stack_mode", valid_values=['normal', 'skip'])
Michael Walsha20da402017-03-31 16:27:45 -0500427 if len(boot_list) == 0 and len(boot_stack) == 0 and not ffdc_only:
Michael Walsh6741f742017-02-20 16:16:38 -0600428 error_message = "You must provide either a value for either the" +\
429 " boot_list or the boot_stack parm.\n"
430 BuiltIn().fail(gp.sprint_error(error_message))
431
432 valid_boot_list(boot_list, valid_boot_types)
433 valid_boot_list(boot_stack, valid_boot_types)
434
Michael Walsh11cfc8c2017-03-31 09:40:55 -0500435 selected_PDU_boots = list(set(boot_list + boot_stack) &
436 set(boot_lists['PDU_reboot']))
437
438 if len(selected_PDU_boots) > 0 and pdu_host == "":
439 error_message = "You have selected the following boots which" +\
440 " require a PDU host but no value for pdu_host:\n"
441 error_message += gp.sprint_var(selected_PDU_boots)
442 error_message += gp.sprint_var(pdu_host, 2)
443 BuiltIn().fail(gp.sprint_error(error_message))
444
Michael Walsh6741f742017-02-20 16:16:38 -0600445 return
Michael Walsh0bbd8602016-11-22 11:31:49 -0600446
447###############################################################################
448
449
450###############################################################################
Michael Walsh6741f742017-02-20 16:16:38 -0600451def my_get_state():
Michael Walsh0bbd8602016-11-22 11:31:49 -0600452
453 r"""
Michael Walsh6741f742017-02-20 16:16:38 -0600454 Get the system state plus a little bit of wrapping.
Michael Walsh0bbd8602016-11-22 11:31:49 -0600455 """
456
Michael Walsh6741f742017-02-20 16:16:38 -0600457 global state
458
459 req_states = ['epoch_seconds'] + st.default_req_states
460
Michael Walshb5839d02017-04-12 16:11:20 -0500461 gp.qprint_timen("Getting system state.")
Michael Walsh6741f742017-02-20 16:16:38 -0600462 if test_mode:
463 state['epoch_seconds'] = int(time.time())
464 else:
Michael Walshb5839d02017-04-12 16:11:20 -0500465 state = st.get_state(req_states=req_states, quiet=quiet)
466 gp.qprint_var(state)
Michael Walsh341c21e2017-01-17 16:25:20 -0600467
468###############################################################################
469
470
471###############################################################################
Michael Walsh6741f742017-02-20 16:16:38 -0600472def select_boot():
Michael Walsh341c21e2017-01-17 16:25:20 -0600473
474 r"""
475 Select a boot test to be run based on our current state and return the
476 chosen boot type.
477
478 Description of arguments:
Michael Walsh6741f742017-02-20 16:16:38 -0600479 state The state of the machine.
Michael Walsh341c21e2017-01-17 16:25:20 -0600480 """
481
Michael Walsh30dadae2017-02-27 14:25:52 -0600482 global boot_stack
483
Michael Walshb5839d02017-04-12 16:11:20 -0500484 gp.qprint_timen("Selecting a boot test.")
Michael Walsh6741f742017-02-20 16:16:38 -0600485
486 my_get_state()
487
488 stack_popped = 0
489 if len(boot_stack) > 0:
490 stack_popped = 1
Michael Walshb5839d02017-04-12 16:11:20 -0500491 gp.qprint_dashes()
492 gp.qprint_var(boot_stack)
493 gp.qprint_dashes()
494 skip_boot_printed = 0
495 while len(boot_stack) > 0:
496 boot_candidate = boot_stack.pop()
497 if stack_mode == 'normal':
498 break
499 else:
500 if st.compare_states(state, boot_table[boot_candidate]['end']):
501 if not skip_boot_printed:
502 gp.print_var(stack_mode)
503 gp.printn()
504 gp.print_timen("Skipping the following boot tests" +
505 " which are unnecessary since their" +
506 " required end states match the" +
507 " current machine state:")
508 skip_boot_printed = 1
509 gp.print_var(boot_candidate)
510 boot_candidate = ""
511 if boot_candidate == "":
512 gp.qprint_dashes()
513 gp.qprint_var(boot_stack)
514 gp.qprint_dashes()
515 return boot_candidate
Michael Walsh6741f742017-02-20 16:16:38 -0600516 if st.compare_states(state, boot_table[boot_candidate]['start']):
Michael Walshb5839d02017-04-12 16:11:20 -0500517 gp.qprint_timen("The machine state is valid for a '" +
518 boot_candidate + "' boot test.")
519 gp.qprint_dashes()
520 gp.qprint_var(boot_stack)
521 gp.qprint_dashes()
Michael Walsh6741f742017-02-20 16:16:38 -0600522 return boot_candidate
Michael Walsh341c21e2017-01-17 16:25:20 -0600523 else:
Michael Walshb5839d02017-04-12 16:11:20 -0500524 gp.qprint_timen("The machine state does not match the required" +
525 " starting state for a '" + boot_candidate +
526 "' boot test:")
527 gp.print_varx("boot_table[" + boot_candidate + "][start]",
528 boot_table[boot_candidate]['start'], 1)
Michael Walsh6741f742017-02-20 16:16:38 -0600529 boot_stack.append(boot_candidate)
530 popped_boot = boot_candidate
531
532 # Loop through your list selecting a boot_candidates
533 boot_candidates = []
534 for boot_candidate in boot_list:
535 if st.compare_states(state, boot_table[boot_candidate]['start']):
536 if stack_popped:
537 if st.compare_states(boot_table[boot_candidate]['end'],
538 boot_table[popped_boot]['start']):
539 boot_candidates.append(boot_candidate)
540 else:
541 boot_candidates.append(boot_candidate)
542
543 if len(boot_candidates) == 0:
Michael Walshb5839d02017-04-12 16:11:20 -0500544 gp.qprint_timen("The user's boot list contained no boot tests" +
545 " which are valid for the current machine state.")
Michael Walsh6741f742017-02-20 16:16:38 -0600546 boot_candidate = default_power_on
547 if not st.compare_states(state, boot_table[default_power_on]['start']):
548 boot_candidate = default_power_off
549 boot_candidates.append(boot_candidate)
Michael Walshb5839d02017-04-12 16:11:20 -0500550 gp.qprint_timen("Using default '" + boot_candidate +
551 "' boot type to transition to valid state.")
Michael Walsh6741f742017-02-20 16:16:38 -0600552
Michael Walshb5839d02017-04-12 16:11:20 -0500553 gp.dprint_var(boot_candidates)
Michael Walsh6741f742017-02-20 16:16:38 -0600554
555 # Randomly select a boot from the candidate list.
556 boot = random.choice(boot_candidates)
Michael Walsh341c21e2017-01-17 16:25:20 -0600557
558 return boot
Michael Walsh0bbd8602016-11-22 11:31:49 -0600559
560###############################################################################
Michael Walsh55302292017-01-10 11:43:02 -0600561
562
563###############################################################################
Michael Walsh341c21e2017-01-17 16:25:20 -0600564def print_last_boots():
565
566 r"""
567 Print the last ten boots done with their time stamps.
568 """
569
570 # indent 0, 90 chars wide, linefeed, char is "="
Michael Walshb5839d02017-04-12 16:11:20 -0500571 gp.qprint_dashes(0, 90)
572 gp.qprintn("Last 10 boots:\n")
Michael Walsh341c21e2017-01-17 16:25:20 -0600573
574 for boot_entry in last_ten:
575 grp.rqprint(boot_entry)
Michael Walshb5839d02017-04-12 16:11:20 -0500576 gp.qprint_dashes(0, 90)
Michael Walsh341c21e2017-01-17 16:25:20 -0600577
578###############################################################################
579
580
581###############################################################################
Michael Walsh341c21e2017-01-17 16:25:20 -0600582def print_defect_report():
583
584 r"""
585 Print a defect report.
586 """
587
Michael Walsh600876d2017-05-30 17:58:58 -0500588 # Making deliberate choice to NOT run plug_in_setup(). We don't want
589 # ffdc_prefix updated.
590 rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages(
591 call_point='ffdc_report', stop_on_plug_in_failure=0)
592
Michael Walsh341c21e2017-01-17 16:25:20 -0600593 # At some point I'd like to have the 'Call FFDC Methods' return a list
594 # of files it has collected. In that case, the following "ls" command
595 # would no longer be needed. For now, however, glob shows the files
596 # named in FFDC_LIST_FILE_PATH so I will refrain from printing those
597 # out (so we don't see duplicates in the list).
598
Michael Walshe0cf8d72017-05-17 13:20:46 -0500599 # Get additional header data which may have been created by ffdc plug-ins.
600 # Also, delete the individual header files to cleanup.
601 cmd_buf = "file_list=$(cat " + ffdc_report_list_path + " 2>/dev/null)" +\
602 " ; [ ! -z \"${file_list}\" ] && cat ${file_list}" +\
603 " 2>/dev/null ; rm -rf ${file_list} 2>/dev/null || :"
604 shell_rc, more_header_info = gc.cmd_fnc_u(cmd_buf, print_output=0,
605 show_err=0)
606
Michael Walsh600876d2017-05-30 17:58:58 -0500607 # Get additional header data which may have been created by ffdc plug-ins.
608 # Also, delete the individual header files to cleanup.
609 cmd_buf = "file_list=$(cat " + ffdc_summary_list_path + " 2>/dev/null)" +\
610 " ; [ ! -z \"${file_list}\" ] && cat ${file_list}" +\
611 " 2>/dev/null ; rm -rf ${file_list} 2>/dev/null || :"
612 shell_rc, ffdc_summary_info = gc.cmd_fnc_u(cmd_buf, print_output=0,
613 show_err=0)
614
Michael Walsh341c21e2017-01-17 16:25:20 -0600615 LOG_PREFIX = BuiltIn().get_variable_value("${LOG_PREFIX}")
616
Michael Walshe0cf8d72017-05-17 13:20:46 -0500617 output = '\n'.join(sorted(glob.glob(LOG_PREFIX + '*')))
Michael Walsh341c21e2017-01-17 16:25:20 -0600618 try:
Michael Walsh6741f742017-02-20 16:16:38 -0600619 ffdc_list = open(ffdc_list_file_path, 'r')
Michael Walsh341c21e2017-01-17 16:25:20 -0600620 except IOError:
621 ffdc_list = ""
622
Michael Walsh68a61162017-04-25 11:54:06 -0500623 # Open ffdc_file_list for writing. We will write a complete list of
624 # FFDC files to it for possible use by plug-ins like cp_stop_check.
625 ffdc_list_file = open(ffdc_list_file_path, 'w')
626
627 gp.qprintn()
628 # indent=0, width=90, linefeed=1, char="="
629 gp.qprint_dashes(0, 90, 1, "=")
630 gp.qprintn("Copy this data to the defect:\n")
631
Michael Walshe0cf8d72017-05-17 13:20:46 -0500632 if len(more_header_info) > 0:
633 gp.printn(more_header_info)
Michael Walshdc80d672017-05-09 12:58:32 -0500634 gp.qpvars(host_name, host_ip, openbmc_nickname, openbmc_host,
635 openbmc_host_name, openbmc_ip, openbmc_username,
636 openbmc_password, os_host, os_host_name, os_ip, os_username,
637 os_password, pdu_host, pdu_host_name, pdu_ip, pdu_username,
638 pdu_password, pdu_slot_no, openbmc_serial_host,
639 openbmc_serial_host_name, openbmc_serial_ip, openbmc_serial_port)
Michael Walsh68a61162017-04-25 11:54:06 -0500640
641 gp.qprintn()
642
643 print_last_boots()
644 gp.qprintn()
645 gp.qprint_var(state)
646
Michael Walshb5839d02017-04-12 16:11:20 -0500647 gp.qprintn()
648 gp.qprintn("FFDC data files:")
Michael Walsh341c21e2017-01-17 16:25:20 -0600649 if status_file_path != "":
Michael Walshb5839d02017-04-12 16:11:20 -0500650 gp.qprintn(status_file_path)
Michael Walsh68a61162017-04-25 11:54:06 -0500651 ffdc_list_file.write(status_file_path + "\n")
Michael Walsh341c21e2017-01-17 16:25:20 -0600652
Michael Walshb5839d02017-04-12 16:11:20 -0500653 gp.qprintn(output)
654 # gp.qprintn(ffdc_list)
655 gp.qprintn()
Michael Walsh341c21e2017-01-17 16:25:20 -0600656
Michael Walsh600876d2017-05-30 17:58:58 -0500657 if len(ffdc_summary_info) > 0:
658 gp.printn(ffdc_summary_info)
659
Michael Walshb5839d02017-04-12 16:11:20 -0500660 gp.qprint_dashes(0, 90, 1, "=")
Michael Walsh341c21e2017-01-17 16:25:20 -0600661
Michael Walsh68a61162017-04-25 11:54:06 -0500662 ffdc_list_file.write(output + "\n")
663 ffdc_list_file.close()
664
Michael Walsh341c21e2017-01-17 16:25:20 -0600665###############################################################################
Michael Walsh6741f742017-02-20 16:16:38 -0600666
667
668###############################################################################
669def my_ffdc():
670
671 r"""
672 Collect FFDC data.
673 """
674
675 global state
676
677 plug_in_setup()
678 rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages(
Michael Walsh600876d2017-05-30 17:58:58 -0500679 call_point='ffdc', stop_on_plug_in_failure=0)
Michael Walsh6741f742017-02-20 16:16:38 -0600680
681 AUTOBOOT_FFDC_PREFIX = os.environ['AUTOBOOT_FFDC_PREFIX']
Michael Walsh83f4bc72017-04-20 16:49:43 -0500682 status, ret_values = grk.run_key_u("FFDC ffdc_prefix=" +
683 AUTOBOOT_FFDC_PREFIX +
684 " ffdc_function_list=" +
685 ffdc_function_list, ignore=1)
686 if status != 'PASS':
Michael Walsh3328caf2017-03-21 17:04:08 -0500687 gp.print_error("Call to ffdc failed.\n")
Michael Walsh6741f742017-02-20 16:16:38 -0600688
689 my_get_state()
690
691 print_defect_report()
692
693###############################################################################
694
695
696###############################################################################
697def print_test_start_message(boot_keyword):
698
699 r"""
700 Print a message indicating what boot test is about to run.
701
702 Description of arguments:
703 boot_keyword The name of the boot which is to be run
704 (e.g. "BMC Power On").
705 """
706
707 global last_ten
708
709 doing_msg = gp.sprint_timen("Doing \"" + boot_keyword + "\".")
Michael Walshb5839d02017-04-12 16:11:20 -0500710 gp.qprint(doing_msg)
Michael Walsh6741f742017-02-20 16:16:38 -0600711
712 last_ten.append(doing_msg)
713
714 if len(last_ten) > 10:
715 del last_ten[0]
716
717###############################################################################
718
719
720###############################################################################
721def run_boot(boot):
722
723 r"""
724 Run the specified boot.
725
726 Description of arguments:
727 boot The name of the boot test to be performed.
728 """
729
730 global state
731
732 print_test_start_message(boot)
733
734 plug_in_setup()
735 rc, shell_rc, failed_plug_in_name = \
736 grpi.rprocess_plug_in_packages(call_point="pre_boot")
737 if rc != 0:
738 error_message = "Plug-in failed with non-zero return code.\n" +\
739 gp.sprint_var(rc, 1)
740 BuiltIn().fail(gp.sprint_error(error_message))
741
742 if test_mode:
743 # In test mode, we'll pretend the boot worked by assigning its
744 # required end state to the default state value.
Michael Walsh30dadae2017-02-27 14:25:52 -0600745 state = st.strip_anchor_state(boot_table[boot]['end'])
Michael Walsh6741f742017-02-20 16:16:38 -0600746 else:
747 # Assertion: We trust that the state data was made fresh by the
748 # caller.
749
Michael Walshb5839d02017-04-12 16:11:20 -0500750 gp.qprintn()
Michael Walsh6741f742017-02-20 16:16:38 -0600751
752 if boot_table[boot]['method_type'] == "keyword":
Michael Walsh0b93fbf2017-03-02 14:42:41 -0600753 rk.my_run_keywords(boot_table[boot].get('lib_file_path', ''),
Michael Walshb5839d02017-04-12 16:11:20 -0500754 boot_table[boot]['method'],
755 quiet=quiet)
Michael Walsh6741f742017-02-20 16:16:38 -0600756
757 if boot_table[boot]['bmc_reboot']:
758 st.wait_for_comm_cycle(int(state['epoch_seconds']))
Michael Walsh30dadae2017-02-27 14:25:52 -0600759 plug_in_setup()
760 rc, shell_rc, failed_plug_in_name = \
761 grpi.rprocess_plug_in_packages(call_point="post_reboot")
762 if rc != 0:
Michael Walsh0b93fbf2017-03-02 14:42:41 -0600763 error_message = "Plug-in failed with non-zero return code.\n"
764 error_message += gp.sprint_var(rc, 1)
Michael Walsh30dadae2017-02-27 14:25:52 -0600765 BuiltIn().fail(gp.sprint_error(error_message))
Michael Walsh6741f742017-02-20 16:16:38 -0600766 else:
767 match_state = st.anchor_state(state)
768 del match_state['epoch_seconds']
769 # Wait for the state to change in any way.
770 st.wait_state(match_state, wait_time=state_change_timeout,
Michael Walsh600876d2017-05-30 17:58:58 -0500771 interval="10 seconds", invert=1)
Michael Walsh6741f742017-02-20 16:16:38 -0600772
Michael Walshb5839d02017-04-12 16:11:20 -0500773 gp.qprintn()
Michael Walsh6741f742017-02-20 16:16:38 -0600774 if boot_table[boot]['end']['chassis'] == "Off":
775 boot_timeout = power_off_timeout
776 else:
777 boot_timeout = power_on_timeout
778 st.wait_state(boot_table[boot]['end'], wait_time=boot_timeout,
Michael Walsh600876d2017-05-30 17:58:58 -0500779 interval="10 seconds")
Michael Walsh6741f742017-02-20 16:16:38 -0600780
781 plug_in_setup()
782 rc, shell_rc, failed_plug_in_name = \
783 grpi.rprocess_plug_in_packages(call_point="post_boot")
784 if rc != 0:
785 error_message = "Plug-in failed with non-zero return code.\n" +\
786 gp.sprint_var(rc, 1)
787 BuiltIn().fail(gp.sprint_error(error_message))
788
789###############################################################################
790
791
792###############################################################################
793def test_loop_body():
794
795 r"""
796 The main loop body for the loop in main_py.
797
798 Description of arguments:
799 boot_count The iteration number (starts at 1).
800 """
801
802 global boot_count
803 global state
804 global next_boot
805 global boot_success
806
Michael Walshb5839d02017-04-12 16:11:20 -0500807 gp.qprintn()
Michael Walsh6741f742017-02-20 16:16:38 -0600808
809 next_boot = select_boot()
Michael Walshb5839d02017-04-12 16:11:20 -0500810 if next_boot == "":
811 return True
Michael Walsh6741f742017-02-20 16:16:38 -0600812
Michael Walshb5839d02017-04-12 16:11:20 -0500813 boot_count += 1
814 gp.qprint_timen("Starting boot " + str(boot_count) + ".")
Michael Walsh6741f742017-02-20 16:16:38 -0600815
Michael Walshe0cf8d72017-05-17 13:20:46 -0500816 pre_boot_plug_in_setup()
Michael Walsh6741f742017-02-20 16:16:38 -0600817
818 cmd_buf = ["run_boot", next_boot]
819 boot_status, msg = BuiltIn().run_keyword_and_ignore_error(*cmd_buf)
820 if boot_status == "FAIL":
Michael Walshb5839d02017-04-12 16:11:20 -0500821 gp.qprint(msg)
Michael Walsh6741f742017-02-20 16:16:38 -0600822
Michael Walshb5839d02017-04-12 16:11:20 -0500823 gp.qprintn()
Michael Walsh6741f742017-02-20 16:16:38 -0600824 if boot_status == "PASS":
825 boot_success = 1
Michael Walshb5839d02017-04-12 16:11:20 -0500826 gp.qprint_timen("BOOT_SUCCESS: \"" + next_boot + "\" succeeded.")
Michael Walsh6741f742017-02-20 16:16:38 -0600827 else:
828 boot_success = 0
Michael Walshb5839d02017-04-12 16:11:20 -0500829 gp.qprint_timen("BOOT_FAILED: \"" + next_boot + "\" failed.")
Michael Walsh6741f742017-02-20 16:16:38 -0600830
831 boot_results.update(next_boot, boot_status)
832
833 plug_in_setup()
834 # NOTE: A post_test_case call point failure is NOT counted as a boot
835 # failure.
836 rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages(
Michael Walsh600876d2017-05-30 17:58:58 -0500837 call_point='post_test_case', stop_on_plug_in_failure=0)
Michael Walsh6741f742017-02-20 16:16:38 -0600838
839 plug_in_setup()
840 rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages(
841 call_point='ffdc_check', shell_rc=0x00000200,
842 stop_on_plug_in_failure=1, stop_on_non_zero_rc=1)
843 if boot_status != "PASS" or ffdc_check == "All" or shell_rc == 0x00000200:
Michael Walsh83f4bc72017-04-20 16:49:43 -0500844 status, ret_values = grk.run_key_u("my_ffdc", ignore=1)
845 if status != 'PASS':
Michael Walsh3328caf2017-03-21 17:04:08 -0500846 gp.print_error("Call to my_ffdc failed.\n")
Michael Walsh6741f742017-02-20 16:16:38 -0600847
Michael Walshd139f282017-04-04 18:00:23 -0500848 # We need to purge error logs between boots or they build up.
Michael Walshb5839d02017-04-12 16:11:20 -0500849 grk.run_key("Delete Error logs", ignore=1)
Michael Walshd139f282017-04-04 18:00:23 -0500850
Michael Walsh952f9b02017-03-09 13:11:14 -0600851 boot_results.print_report()
Michael Walshb5839d02017-04-12 16:11:20 -0500852 gp.qprint_timen("Finished boot " + str(boot_count) + ".")
Michael Walsh952f9b02017-03-09 13:11:14 -0600853
Michael Walsh6741f742017-02-20 16:16:38 -0600854 plug_in_setup()
855 rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages(
856 call_point='stop_check')
857 if rc != 0:
858 error_message = "Stopping as requested by user.\n"
859 grp.rprint_error_report(error_message)
860 BuiltIn().fail(error_message)
861
Michael Walshd139f282017-04-04 18:00:23 -0500862 # This should help prevent ConnectionErrors.
Michael Walsh0960b382017-06-22 16:23:37 -0500863 grk.run_key_u("Close All Connections")
Michael Walshd139f282017-04-04 18:00:23 -0500864
Michael Walsh6741f742017-02-20 16:16:38 -0600865 return True
866
867###############################################################################
868
869
870###############################################################################
Michael Walsh83f4bc72017-04-20 16:49:43 -0500871def obmc_boot_test_teardown():
Michael Walsh6741f742017-02-20 16:16:38 -0600872
873 r"""
Michael Walshc9116812017-03-10 14:23:06 -0600874 Clean up after the Main keyword.
Michael Walsh6741f742017-02-20 16:16:38 -0600875 """
876
877 if cp_setup_called:
878 plug_in_setup()
879 rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages(
Michael Walsh600876d2017-05-30 17:58:58 -0500880 call_point='cleanup', stop_on_plug_in_failure=0)
Michael Walsh6741f742017-02-20 16:16:38 -0600881
Michael Walsh600876d2017-05-30 17:58:58 -0500882 if 'boot_results_file_path' in globals():
883 # Save boot_results object to a file in case it is needed again.
884 gp.qprint_timen("Saving boot_results to the following path.")
885 gp.qprint_var(boot_results_file_path)
886 pickle.dump(boot_results, open(boot_results_file_path, 'wb'),
887 pickle.HIGHEST_PROTOCOL)
Michael Walsh0b93fbf2017-03-02 14:42:41 -0600888
Michael Walsh6741f742017-02-20 16:16:38 -0600889###############################################################################
890
891
892###############################################################################
Michael Walshc9116812017-03-10 14:23:06 -0600893def test_teardown():
894
895 r"""
896 Clean up after this test case.
897 """
898
899 gp.qprintn()
900 cmd_buf = ["Print Error",
901 "A keyword timeout occurred ending this program.\n"]
902 BuiltIn().run_keyword_if_timeout_occurred(*cmd_buf)
903
Michael Walshb5839d02017-04-12 16:11:20 -0500904 grp.rqprint_pgm_footer()
905
Michael Walshc9116812017-03-10 14:23:06 -0600906###############################################################################
907
908
909###############################################################################
Michael Walsh83f4bc72017-04-20 16:49:43 -0500910def obmc_boot_test_py(alt_boot_stack=None):
Michael Walsh6741f742017-02-20 16:16:38 -0600911
912 r"""
913 Do main program processing.
914 """
915
Michael Walshb5839d02017-04-12 16:11:20 -0500916 if alt_boot_stack is not None:
917 BuiltIn().set_global_variable("${boot_stack}", alt_boot_stack)
918
Michael Walsh6741f742017-02-20 16:16:38 -0600919 setup()
920
Michael Walsha20da402017-03-31 16:27:45 -0500921 if ffdc_only:
922 gp.qprint_timen("Caller requested ffdc_only.")
Michael Walshe0cf8d72017-05-17 13:20:46 -0500923 pre_boot_plug_in_setup()
Michael Walsh83f4bc72017-04-20 16:49:43 -0500924 grk.run_key_u("my_ffdc")
Michael Walsh764d2f82017-04-27 16:01:08 -0500925 return
Michael Walsha20da402017-03-31 16:27:45 -0500926
Michael Walsh6741f742017-02-20 16:16:38 -0600927 # Process caller's boot_stack.
928 while (len(boot_stack) > 0):
929 test_loop_body()
930
Michael Walshb5839d02017-04-12 16:11:20 -0500931 gp.qprint_timen("Finished processing stack.")
Michael Walsh30dadae2017-02-27 14:25:52 -0600932
Michael Walsh6741f742017-02-20 16:16:38 -0600933 # Process caller's boot_list.
934 if len(boot_list) > 0:
935 for ix in range(1, max_num_tests + 1):
936 test_loop_body()
937
Michael Walshb5839d02017-04-12 16:11:20 -0500938 gp.qprint_timen("Completed all requested boot tests.")
939
940 boot_pass, boot_fail = boot_results.return_total_pass_fail()
941 if boot_fail > boot_fail_threshold:
942 error_message = "Boot failures exceed the boot failure" +\
943 " threshold:\n" +\
944 gp.sprint_var(boot_fail) +\
945 gp.sprint_var(boot_fail_threshold)
946 BuiltIn().fail(gp.sprint_error(error_message))
Michael Walsh6741f742017-02-20 16:16:38 -0600947
948###############################################################################