Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | r""" |
| 4 | This module is the python counterpart to obmc_boot_test. |
| 5 | """ |
| 6 | |
Michael Walsh | 0b93fbf | 2017-03-02 14:42:41 -0600 | [diff] [blame] | 7 | import os |
| 8 | import imp |
| 9 | import time |
| 10 | import glob |
| 11 | import random |
Michael Walsh | 0ad0f7f | 2017-05-04 14:39:58 -0500 | [diff] [blame] | 12 | import re |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 13 | import signal |
George Keishing | d54bbc2 | 2018-08-03 08:24:58 -0500 | [diff] [blame] | 14 | try: |
| 15 | import cPickle as pickle |
| 16 | except ImportError: |
| 17 | import pickle |
Michael Walsh | dc80d67 | 2017-05-09 12:58:32 -0500 | [diff] [blame] | 18 | import socket |
Michael Walsh | 0b93fbf | 2017-03-02 14:42:41 -0600 | [diff] [blame] | 19 | |
| 20 | from robot.utils import DotDict |
| 21 | from robot.libraries.BuiltIn import BuiltIn |
| 22 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 23 | from boot_data import * |
Michael Walsh | c911681 | 2017-03-10 14:23:06 -0600 | [diff] [blame] | 24 | import gen_print as gp |
Michael Walsh | 5530229 | 2017-01-10 11:43:02 -0600 | [diff] [blame] | 25 | import gen_robot_plug_in as grpi |
Michael Walsh | f75d435 | 2019-12-05 17:01:20 -0600 | [diff] [blame] | 26 | import gen_arg as ga |
Michael Walsh | 44cef25 | 2019-08-01 12:38:56 -0500 | [diff] [blame] | 27 | import gen_valid as gv |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 28 | import gen_misc as gm |
| 29 | import gen_cmd as gc |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 30 | import gen_robot_keyword as grk |
Michael Walsh | 5530229 | 2017-01-10 11:43:02 -0600 | [diff] [blame] | 31 | import state as st |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 32 | import var_stack as vs |
Michael Walsh | c9bd2e8 | 2019-04-18 11:06:52 -0500 | [diff] [blame] | 33 | import gen_plug_in_utils as gpu |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 34 | |
Michael Walsh | 0b93fbf | 2017-03-02 14:42:41 -0600 | [diff] [blame] | 35 | base_path = os.path.dirname(os.path.dirname( |
| 36 | imp.find_module("gen_robot_print")[1])) +\ |
Michael Walsh | c911681 | 2017-03-10 14:23:06 -0600 | [diff] [blame] | 37 | os.sep |
Michael Walsh | 0b93fbf | 2017-03-02 14:42:41 -0600 | [diff] [blame] | 38 | sys.path.append(base_path + "extended/") |
| 39 | import run_keyword as rk |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 40 | |
Michael Walsh | e1e2644 | 2017-03-06 17:50:07 -0600 | [diff] [blame] | 41 | # Setting master_pid correctly influences the behavior of plug-ins like |
| 42 | # DB_Logging |
| 43 | program_pid = os.getpid() |
| 44 | master_pid = os.environ.get('AUTOBOOT_MASTER_PID', program_pid) |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 45 | pgm_name = re.sub('\\.py$', '', os.path.basename(__file__)) |
Michael Walsh | e1e2644 | 2017-03-06 17:50:07 -0600 | [diff] [blame] | 46 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 47 | # Set up boot data structures. |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 48 | os_host = BuiltIn().get_variable_value("${OS_HOST}", default="") |
| 49 | boot_table = create_boot_table(os_host=os_host) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 50 | valid_boot_types = create_valid_boot_list(boot_table) |
Michael Walsh | 0b93fbf | 2017-03-02 14:42:41 -0600 | [diff] [blame] | 51 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 52 | boot_lists = read_boot_lists() |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 53 | |
| 54 | # The maximum number of entries that can be in the boot_history global variable. |
Michael Walsh | 815b1d5 | 2018-10-30 13:32:26 -0500 | [diff] [blame] | 55 | max_boot_history = 10 |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 56 | boot_history = [] |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 57 | |
Michael Walsh | 7dc885b | 2018-03-14 17:51:59 -0500 | [diff] [blame] | 58 | state = st.return_state_constant('default_state') |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 59 | cp_setup_called = 0 |
| 60 | next_boot = "" |
| 61 | base_tool_dir_path = os.path.normpath(os.environ.get( |
| 62 | 'AUTOBOOT_BASE_TOOL_DIR_PATH', "/tmp")) + os.sep |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 63 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 64 | ffdc_dir_path = os.path.normpath(os.environ.get('FFDC_DIR_PATH', '')) + os.sep |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 65 | boot_success = 0 |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 66 | status_dir_path = os.environ.get('STATUS_DIR_PATH', "") |
| 67 | if status_dir_path != "": |
| 68 | status_dir_path = os.path.normpath(status_dir_path) + os.sep |
Michael Walsh | e58df1c | 2019-08-07 09:57:43 -0500 | [diff] [blame] | 69 | redfish_supported = BuiltIn().get_variable_value("${REDFISH_SUPPORTED}", default=False) |
| 70 | if redfish_supported: |
| 71 | default_power_on = "Redfish Power On" |
| 72 | default_power_off = "Redfish Power Off" |
| 73 | else: |
| 74 | default_power_on = "REST Power On" |
| 75 | default_power_off = "REST Power Off" |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 76 | boot_count = 0 |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 77 | |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 78 | LOG_LEVEL = BuiltIn().get_variable_value("${LOG_LEVEL}") |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 79 | AUTOBOOT_FFDC_PREFIX = os.environ.get('AUTOBOOT_FFDC_PREFIX', '') |
| 80 | ffdc_prefix = AUTOBOOT_FFDC_PREFIX |
Sunil M | 325eb54 | 2017-08-10 07:09:43 -0500 | [diff] [blame] | 81 | boot_start_time = "" |
| 82 | boot_end_time = "" |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 83 | save_stack = vs.var_stack('save_stack') |
| 84 | main_func_parm_list = ['boot_stack', 'stack_mode', 'quiet'] |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 85 | |
| 86 | |
Michael Walsh | 89de14a | 2018-10-01 16:51:37 -0500 | [diff] [blame] | 87 | def dump_ffdc_rc(): |
| 88 | r""" |
| 89 | Return the constant dump ffdc test return code value. |
| 90 | |
| 91 | When a plug-in call point program returns this value, it indicates that |
| 92 | this program should collect FFDC. |
| 93 | """ |
| 94 | |
| 95 | return 0x00000200 |
| 96 | |
| 97 | |
| 98 | def stop_test_rc(): |
| 99 | r""" |
| 100 | Return the constant stop test return code value. |
| 101 | |
| 102 | When a plug-in call point program returns this value, it indicates that |
| 103 | this program should stop running. |
| 104 | """ |
| 105 | |
| 106 | return 0x00000200 |
| 107 | |
| 108 | |
Michael Walsh | 0ad0f7f | 2017-05-04 14:39:58 -0500 | [diff] [blame] | 109 | def process_host(host, |
| 110 | host_var_name=""): |
Michael Walsh | 0ad0f7f | 2017-05-04 14:39:58 -0500 | [diff] [blame] | 111 | r""" |
| 112 | Process a host by getting the associated host name and IP address and |
| 113 | setting them in global variables. |
| 114 | |
| 115 | If the caller does not pass the host_var_name, this function will try to |
| 116 | figure out the name of the variable used by the caller for the host parm. |
| 117 | Callers are advised to explicitly specify the host_var_name when calling |
| 118 | with an exec command. In such cases, the get_arg_name cannot figure out |
| 119 | the host variable name. |
| 120 | |
| 121 | This function will then create similar global variable names by |
| 122 | removing "_host" and appending "_host_name" or "_ip" to the host variable |
| 123 | name. |
| 124 | |
| 125 | Example: |
| 126 | |
| 127 | If a call is made like this: |
| 128 | process_host(openbmc_host) |
| 129 | |
| 130 | Global variables openbmc_host_name and openbmc_ip will be set. |
| 131 | |
| 132 | Description of argument(s): |
| 133 | host A host name or IP. The name of the variable used should |
| 134 | have a suffix of "_host". |
| 135 | host_var_name The name of the variable being used as the host parm. |
| 136 | """ |
| 137 | |
| 138 | if host_var_name == "": |
| 139 | host_var_name = gp.get_arg_name(0, 1, stack_frame_ix=2) |
| 140 | |
| 141 | host_name_var_name = re.sub("host", "host_name", host_var_name) |
| 142 | ip_var_name = re.sub("host", "ip", host_var_name) |
| 143 | cmd_buf = "global " + host_name_var_name + ", " + ip_var_name + " ; " +\ |
| 144 | host_name_var_name + ", " + ip_var_name + " = gm.get_host_name_ip('" +\ |
| 145 | host + "')" |
| 146 | exec(cmd_buf) |
| 147 | |
Michael Walsh | 0ad0f7f | 2017-05-04 14:39:58 -0500 | [diff] [blame] | 148 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 149 | def process_pgm_parms(): |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 150 | r""" |
| 151 | Process the program parameters by assigning them all to corresponding |
| 152 | globals. Also, set some global values that depend on program parameters. |
| 153 | """ |
| 154 | |
| 155 | # Program parameter processing. |
| 156 | # Assign all program parms to python variables which are global to this |
| 157 | # module. |
| 158 | |
| 159 | global parm_list |
| 160 | parm_list = BuiltIn().get_variable_value("${parm_list}") |
| 161 | # The following subset of parms should be processed as integers. |
| 162 | int_list = ['max_num_tests', 'boot_pass', 'boot_fail', 'ffdc_only', |
Michael Walsh | 89de14a | 2018-10-01 16:51:37 -0500 | [diff] [blame] | 163 | 'boot_fail_threshold', 'delete_errlogs', |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 164 | 'call_post_stack_plug', 'do_pre_boot_plug_in_setup', 'quiet', |
| 165 | 'test_mode', 'debug'] |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 166 | for parm in parm_list: |
| 167 | if parm in int_list: |
| 168 | sub_cmd = "int(BuiltIn().get_variable_value(\"${" + parm +\ |
| 169 | "}\", \"0\"))" |
| 170 | else: |
| 171 | sub_cmd = "BuiltIn().get_variable_value(\"${" + parm + "}\")" |
| 172 | cmd_buf = "global " + parm + " ; " + parm + " = " + sub_cmd |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 173 | gp.dpissuing(cmd_buf) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 174 | exec(cmd_buf) |
Michael Walsh | 0ad0f7f | 2017-05-04 14:39:58 -0500 | [diff] [blame] | 175 | if re.match(r".*_host$", parm): |
| 176 | cmd_buf = "process_host(" + parm + ", '" + parm + "')" |
| 177 | exec(cmd_buf) |
| 178 | if re.match(r".*_password$", parm): |
| 179 | # Register the value of any parm whose name ends in _password. |
| 180 | # This will cause the print functions to replace passwords with |
| 181 | # asterisks in the output. |
| 182 | cmd_buf = "gp.register_passwords(" + parm + ")" |
| 183 | exec(cmd_buf) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 184 | |
| 185 | global ffdc_dir_path_style |
| 186 | global boot_list |
| 187 | global boot_stack |
| 188 | global boot_results_file_path |
| 189 | global boot_results |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 190 | global boot_history |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 191 | global ffdc_list_file_path |
Michael Walsh | e0cf8d7 | 2017-05-17 13:20:46 -0500 | [diff] [blame] | 192 | global ffdc_report_list_path |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 193 | global ffdc_summary_list_path |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 194 | |
| 195 | if ffdc_dir_path_style == "": |
| 196 | ffdc_dir_path_style = int(os.environ.get('FFDC_DIR_PATH_STYLE', '0')) |
| 197 | |
| 198 | # Convert these program parms to lists for easier processing.. |
George Keishing | 36efbc0 | 2018-12-12 10:18:23 -0600 | [diff] [blame] | 199 | boot_list = list(filter(None, boot_list.split(":"))) |
| 200 | boot_stack = list(filter(None, boot_stack.split(":"))) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 201 | |
Michael Walsh | 903e0b2 | 2017-09-19 17:00:33 -0500 | [diff] [blame] | 202 | cleanup_boot_results_file() |
| 203 | boot_results_file_path = create_boot_results_file_path(pgm_name, |
| 204 | openbmc_nickname, |
| 205 | master_pid) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 206 | |
| 207 | if os.path.isfile(boot_results_file_path): |
| 208 | # We've been called before in this run so we'll load the saved |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 209 | # boot_results and boot_history objects. |
| 210 | boot_results, boot_history =\ |
Michael Walsh | 6c64574 | 2018-08-17 15:02:17 -0500 | [diff] [blame] | 211 | pickle.load(open(boot_results_file_path, 'rb')) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 212 | else: |
| 213 | boot_results = boot_results(boot_table, boot_pass, boot_fail) |
| 214 | |
| 215 | ffdc_list_file_path = base_tool_dir_path + openbmc_nickname +\ |
| 216 | "/FFDC_FILE_LIST" |
Michael Walsh | e0cf8d7 | 2017-05-17 13:20:46 -0500 | [diff] [blame] | 217 | ffdc_report_list_path = base_tool_dir_path + openbmc_nickname +\ |
| 218 | "/FFDC_REPORT_FILE_LIST" |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 219 | |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 220 | ffdc_summary_list_path = base_tool_dir_path + openbmc_nickname +\ |
| 221 | "/FFDC_SUMMARY_FILE_LIST" |
| 222 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 223 | |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 224 | def initial_plug_in_setup(): |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 225 | r""" |
| 226 | Initialize all plug-in environment variables which do not change for the |
| 227 | duration of the program. |
| 228 | |
| 229 | """ |
| 230 | |
| 231 | global LOG_LEVEL |
| 232 | BuiltIn().set_log_level("NONE") |
| 233 | |
| 234 | BuiltIn().set_global_variable("${master_pid}", master_pid) |
| 235 | BuiltIn().set_global_variable("${FFDC_DIR_PATH}", ffdc_dir_path) |
| 236 | BuiltIn().set_global_variable("${STATUS_DIR_PATH}", status_dir_path) |
| 237 | BuiltIn().set_global_variable("${BASE_TOOL_DIR_PATH}", base_tool_dir_path) |
| 238 | BuiltIn().set_global_variable("${FFDC_LIST_FILE_PATH}", |
| 239 | ffdc_list_file_path) |
Michael Walsh | e0cf8d7 | 2017-05-17 13:20:46 -0500 | [diff] [blame] | 240 | BuiltIn().set_global_variable("${FFDC_REPORT_LIST_PATH}", |
| 241 | ffdc_report_list_path) |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 242 | BuiltIn().set_global_variable("${FFDC_SUMMARY_LIST_PATH}", |
| 243 | ffdc_summary_list_path) |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 244 | |
| 245 | BuiltIn().set_global_variable("${FFDC_DIR_PATH_STYLE}", |
| 246 | ffdc_dir_path_style) |
| 247 | BuiltIn().set_global_variable("${FFDC_CHECK}", |
| 248 | ffdc_check) |
| 249 | |
| 250 | # For each program parameter, set the corresponding AUTOBOOT_ environment |
| 251 | # variable value. Also, set an AUTOBOOT_ environment variable for every |
| 252 | # element in additional_values. |
| 253 | additional_values = ["program_pid", "master_pid", "ffdc_dir_path", |
| 254 | "status_dir_path", "base_tool_dir_path", |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 255 | "ffdc_list_file_path", "ffdc_report_list_path", |
Michael Walsh | 0a3bdb4 | 2019-01-31 16:21:44 +0000 | [diff] [blame] | 256 | "ffdc_summary_list_path", "execdir"] |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 257 | |
| 258 | plug_in_vars = parm_list + additional_values |
| 259 | |
| 260 | for var_name in plug_in_vars: |
| 261 | var_value = BuiltIn().get_variable_value("${" + var_name + "}") |
| 262 | var_name = var_name.upper() |
| 263 | if var_value is None: |
| 264 | var_value = "" |
| 265 | os.environ["AUTOBOOT_" + var_name] = str(var_value) |
| 266 | |
| 267 | BuiltIn().set_log_level(LOG_LEVEL) |
| 268 | |
Michael Walsh | 68a6116 | 2017-04-25 11:54:06 -0500 | [diff] [blame] | 269 | # Make sure the ffdc list directory exists. |
| 270 | ffdc_list_dir_path = os.path.dirname(ffdc_list_file_path) + os.sep |
| 271 | if not os.path.exists(ffdc_list_dir_path): |
| 272 | os.makedirs(ffdc_list_dir_path) |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 273 | |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 274 | |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 275 | def plug_in_setup(): |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 276 | r""" |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 277 | Initialize all changing plug-in environment variables for use by the |
| 278 | plug-in programs. |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 279 | """ |
| 280 | |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 281 | global LOG_LEVEL |
| 282 | global test_really_running |
| 283 | |
| 284 | BuiltIn().set_log_level("NONE") |
| 285 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 286 | boot_pass, boot_fail = boot_results.return_total_pass_fail() |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 287 | if boot_pass > 1: |
| 288 | test_really_running = 1 |
| 289 | else: |
| 290 | test_really_running = 0 |
| 291 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 292 | BuiltIn().set_global_variable("${test_really_running}", |
| 293 | test_really_running) |
| 294 | BuiltIn().set_global_variable("${boot_type_desc}", next_boot) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 295 | BuiltIn().set_global_variable("${boot_pass}", boot_pass) |
| 296 | BuiltIn().set_global_variable("${boot_fail}", boot_fail) |
| 297 | BuiltIn().set_global_variable("${boot_success}", boot_success) |
| 298 | BuiltIn().set_global_variable("${ffdc_prefix}", ffdc_prefix) |
Sunil M | 325eb54 | 2017-08-10 07:09:43 -0500 | [diff] [blame] | 299 | BuiltIn().set_global_variable("${boot_start_time}", boot_start_time) |
| 300 | BuiltIn().set_global_variable("${boot_end_time}", boot_end_time) |
Michael Walsh | 4c9a645 | 2016-12-13 16:03:11 -0600 | [diff] [blame] | 301 | |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 302 | # For each program parameter, set the corresponding AUTOBOOT_ environment |
| 303 | # variable value. Also, set an AUTOBOOT_ environment variable for every |
| 304 | # element in additional_values. |
| 305 | additional_values = ["boot_type_desc", "boot_success", "boot_pass", |
Sunil M | 325eb54 | 2017-08-10 07:09:43 -0500 | [diff] [blame] | 306 | "boot_fail", "test_really_running", "ffdc_prefix", |
| 307 | "boot_start_time", "boot_end_time"] |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 308 | |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 309 | plug_in_vars = additional_values |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 310 | |
| 311 | for var_name in plug_in_vars: |
| 312 | var_value = BuiltIn().get_variable_value("${" + var_name + "}") |
| 313 | var_name = var_name.upper() |
| 314 | if var_value is None: |
| 315 | var_value = "" |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 316 | os.environ["AUTOBOOT_" + var_name] = str(var_value) |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 317 | |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 318 | if debug: |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 319 | shell_rc, out_buf = \ |
| 320 | gc.cmd_fnc_u("printenv | egrep AUTOBOOT_ | sort -u") |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 321 | |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 322 | BuiltIn().set_log_level(LOG_LEVEL) |
| 323 | |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 324 | |
Michael Walsh | e0cf8d7 | 2017-05-17 13:20:46 -0500 | [diff] [blame] | 325 | def pre_boot_plug_in_setup(): |
| 326 | |
| 327 | # Clear the ffdc_list_file_path file. Plug-ins may now write to it. |
| 328 | try: |
| 329 | os.remove(ffdc_list_file_path) |
| 330 | except OSError: |
| 331 | pass |
| 332 | |
| 333 | # Clear the ffdc_report_list_path file. Plug-ins may now write to it. |
| 334 | try: |
| 335 | os.remove(ffdc_report_list_path) |
| 336 | except OSError: |
| 337 | pass |
| 338 | |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 339 | # Clear the ffdc_summary_list_path file. Plug-ins may now write to it. |
| 340 | try: |
| 341 | os.remove(ffdc_summary_list_path) |
| 342 | except OSError: |
| 343 | pass |
| 344 | |
Michael Walsh | e1974b9 | 2017-08-03 13:39:51 -0500 | [diff] [blame] | 345 | global ffdc_prefix |
| 346 | |
| 347 | seconds = time.time() |
| 348 | loc_time = time.localtime(seconds) |
| 349 | time_string = time.strftime("%y%m%d.%H%M%S.", loc_time) |
| 350 | |
| 351 | ffdc_prefix = openbmc_nickname + "." + time_string |
| 352 | |
Michael Walsh | e0cf8d7 | 2017-05-17 13:20:46 -0500 | [diff] [blame] | 353 | |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 354 | def default_sigusr1(signal_number=0, |
| 355 | frame=None): |
| 356 | r""" |
| 357 | Handle SIGUSR1 by doing nothing. |
| 358 | |
| 359 | This function assists in debugging SIGUSR1 processing by printing messages |
| 360 | to stdout and to the log.html file. |
| 361 | |
| 362 | Description of argument(s): |
| 363 | signal_number The signal number (should always be 10 for SIGUSR1). |
| 364 | frame The frame data. |
| 365 | """ |
| 366 | |
Michael Walsh | 80dddde | 2019-10-22 13:54:38 -0500 | [diff] [blame] | 367 | gp.qprintn() |
| 368 | gp.qprint_executing() |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 369 | gp.lprint_executing() |
| 370 | |
| 371 | |
| 372 | def set_default_siguser1(): |
| 373 | r""" |
| 374 | Set the default_sigusr1 function to be the SIGUSR1 handler. |
| 375 | """ |
| 376 | |
Michael Walsh | 80dddde | 2019-10-22 13:54:38 -0500 | [diff] [blame] | 377 | gp.qprintn() |
| 378 | gp.qprint_executing() |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 379 | gp.lprint_executing() |
| 380 | signal.signal(signal.SIGUSR1, default_sigusr1) |
| 381 | |
| 382 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 383 | def setup(): |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 384 | r""" |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 385 | Do general program setup tasks. |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 386 | """ |
| 387 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 388 | global cp_setup_called |
Michael Walsh | 8181674 | 2017-09-27 11:02:29 -0500 | [diff] [blame] | 389 | global transitional_boot_selected |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 390 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 391 | gp.qprintn() |
| 392 | |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 393 | set_default_siguser1() |
Michael Walsh | 8181674 | 2017-09-27 11:02:29 -0500 | [diff] [blame] | 394 | transitional_boot_selected = False |
| 395 | |
Michael Walsh | 83f4bc7 | 2017-04-20 16:49:43 -0500 | [diff] [blame] | 396 | robot_pgm_dir_path = os.path.dirname(__file__) + os.sep |
| 397 | repo_bin_path = robot_pgm_dir_path.replace("/lib/", "/bin/") |
Michael Walsh | d061c04 | 2017-05-23 14:46:57 -0500 | [diff] [blame] | 398 | # If we can't find process_plug_in_packages.py, ssh_pw or |
| 399 | # validate_plug_ins.py, then we don't have our repo bin in PATH. |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 400 | shell_rc, out_buf = gc.cmd_fnc_u("which process_plug_in_packages.py" |
| 401 | + " ssh_pw validate_plug_ins.py", quiet=1, |
Michael Walsh | d061c04 | 2017-05-23 14:46:57 -0500 | [diff] [blame] | 402 | print_output=0, show_err=0) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 403 | if shell_rc != 0: |
Michael Walsh | 83f4bc7 | 2017-04-20 16:49:43 -0500 | [diff] [blame] | 404 | os.environ['PATH'] = repo_bin_path + ":" + os.environ.get('PATH', "") |
| 405 | # Likewise, our repo lib subdir needs to be in sys.path and PYTHONPATH. |
| 406 | if robot_pgm_dir_path not in sys.path: |
| 407 | sys.path.append(robot_pgm_dir_path) |
| 408 | PYTHONPATH = os.environ.get("PYTHONPATH", "") |
| 409 | if PYTHONPATH == "": |
| 410 | os.environ['PYTHONPATH'] = robot_pgm_dir_path |
| 411 | else: |
| 412 | os.environ['PYTHONPATH'] = robot_pgm_dir_path + ":" + PYTHONPATH |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 413 | |
| 414 | validate_parms() |
| 415 | |
Michael Walsh | c108e42 | 2019-03-28 12:27:18 -0500 | [diff] [blame] | 416 | gp.qprint_pgm_header() |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 417 | |
George Keishing | efc3ff2 | 2017-12-12 11:49:25 -0600 | [diff] [blame] | 418 | grk.run_key("Set BMC Power Policy ALWAYS_POWER_OFF") |
Michael Walsh | 11cfc8c | 2017-03-31 09:40:55 -0500 | [diff] [blame] | 419 | |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 420 | initial_plug_in_setup() |
| 421 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 422 | plug_in_setup() |
| 423 | rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages( |
| 424 | call_point='setup') |
| 425 | if rc != 0: |
| 426 | error_message = "Plug-in setup failed.\n" |
Michael Walsh | c108e42 | 2019-03-28 12:27:18 -0500 | [diff] [blame] | 427 | gp.print_error_report(error_message) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 428 | BuiltIn().fail(error_message) |
| 429 | # Setting cp_setup_called lets our Teardown know that it needs to call |
| 430 | # the cleanup plug-in call point. |
| 431 | cp_setup_called = 1 |
| 432 | |
| 433 | # Keyword "FFDC" will fail if TEST_MESSAGE is not set. |
| 434 | BuiltIn().set_global_variable("${TEST_MESSAGE}", "${EMPTY}") |
Michael Walsh | 8567894 | 2017-03-27 14:34:22 -0500 | [diff] [blame] | 435 | # FFDC_LOG_PATH is used by "FFDC" keyword. |
| 436 | BuiltIn().set_global_variable("${FFDC_LOG_PATH}", ffdc_dir_path) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 437 | |
Michael Walsh | dc80d67 | 2017-05-09 12:58:32 -0500 | [diff] [blame] | 438 | # Also printed by FFDC. |
| 439 | global host_name |
| 440 | global host_ip |
| 441 | host = socket.gethostname() |
| 442 | host_name, host_ip = gm.get_host_name_ip(host) |
| 443 | |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 444 | gp.dprint_var(boot_table) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 445 | gp.dprint_var(boot_lists) |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 446 | |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 447 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 448 | def validate_parms(): |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 449 | r""" |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 450 | Validate all program parameters. |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 451 | """ |
| 452 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 453 | process_pgm_parms() |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 454 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 455 | gp.qprintn() |
| 456 | |
| 457 | global openbmc_model |
Michael Walsh | 44cef25 | 2019-08-01 12:38:56 -0500 | [diff] [blame] | 458 | gv.valid_value(openbmc_host) |
| 459 | gv.valid_value(openbmc_username) |
| 460 | gv.valid_value(openbmc_password) |
| 461 | gv.valid_value(rest_username) |
| 462 | gv.valid_value(rest_password) |
| 463 | gv.valid_value(ipmi_username) |
| 464 | gv.valid_value(ipmi_password) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 465 | if os_host != "": |
Michael Walsh | 44cef25 | 2019-08-01 12:38:56 -0500 | [diff] [blame] | 466 | gv.valid_value(os_username) |
| 467 | gv.valid_value(os_password) |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 468 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 469 | if pdu_host != "": |
Michael Walsh | 44cef25 | 2019-08-01 12:38:56 -0500 | [diff] [blame] | 470 | gv.valid_value(pdu_username) |
| 471 | gv.valid_value(pdu_password) |
| 472 | gv.valid_integer(pdu_slot_no) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 473 | if openbmc_serial_host != "": |
Michael Walsh | 44cef25 | 2019-08-01 12:38:56 -0500 | [diff] [blame] | 474 | gv.valid_integer(openbmc_serial_port) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 475 | if openbmc_model == "": |
| 476 | status, ret_values =\ |
| 477 | grk.run_key_u("Get BMC System Model") |
| 478 | openbmc_model = ret_values |
| 479 | BuiltIn().set_global_variable("${openbmc_model}", openbmc_model) |
Michael Walsh | 44cef25 | 2019-08-01 12:38:56 -0500 | [diff] [blame] | 480 | gv.valid_value(openbmc_model) |
| 481 | gv.valid_integer(max_num_tests) |
| 482 | gv.valid_integer(boot_pass) |
| 483 | gv.valid_integer(boot_fail) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 484 | |
| 485 | plug_in_packages_list = grpi.rvalidate_plug_ins(plug_in_dir_paths) |
| 486 | BuiltIn().set_global_variable("${plug_in_packages_list}", |
| 487 | plug_in_packages_list) |
| 488 | |
Michael Walsh | 44cef25 | 2019-08-01 12:38:56 -0500 | [diff] [blame] | 489 | gv.valid_value(stack_mode, valid_values=['normal', 'skip']) |
Michael Walsh | a20da40 | 2017-03-31 16:27:45 -0500 | [diff] [blame] | 490 | if len(boot_list) == 0 and len(boot_stack) == 0 and not ffdc_only: |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 491 | error_message = "You must provide either a value for either the" +\ |
| 492 | " boot_list or the boot_stack parm.\n" |
| 493 | BuiltIn().fail(gp.sprint_error(error_message)) |
| 494 | |
| 495 | valid_boot_list(boot_list, valid_boot_types) |
| 496 | valid_boot_list(boot_stack, valid_boot_types) |
| 497 | |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 498 | selected_PDU_boots = list(set(boot_list + boot_stack) |
| 499 | & set(boot_lists['PDU_reboot'])) |
Michael Walsh | 11cfc8c | 2017-03-31 09:40:55 -0500 | [diff] [blame] | 500 | |
| 501 | if len(selected_PDU_boots) > 0 and pdu_host == "": |
| 502 | error_message = "You have selected the following boots which" +\ |
| 503 | " require a PDU host but no value for pdu_host:\n" |
| 504 | error_message += gp.sprint_var(selected_PDU_boots) |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 505 | error_message += gp.sprint_var(pdu_host, fmt=gp.blank()) |
Michael Walsh | 11cfc8c | 2017-03-31 09:40:55 -0500 | [diff] [blame] | 506 | BuiltIn().fail(gp.sprint_error(error_message)) |
| 507 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 508 | return |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 509 | |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 510 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 511 | def my_get_state(): |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 512 | r""" |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 513 | Get the system state plus a little bit of wrapping. |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 514 | """ |
| 515 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 516 | global state |
| 517 | |
| 518 | req_states = ['epoch_seconds'] + st.default_req_states |
| 519 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 520 | gp.qprint_timen("Getting system state.") |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 521 | if test_mode: |
| 522 | state['epoch_seconds'] = int(time.time()) |
| 523 | else: |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 524 | state = st.get_state(req_states=req_states, quiet=quiet) |
| 525 | gp.qprint_var(state) |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 526 | |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 527 | |
Michael Walsh | 45ca6e4 | 2017-09-14 17:29:12 -0500 | [diff] [blame] | 528 | def valid_state(): |
Michael Walsh | 45ca6e4 | 2017-09-14 17:29:12 -0500 | [diff] [blame] | 529 | r""" |
| 530 | Verify that our state dictionary contains no blank values. If we don't get |
| 531 | valid state data, we cannot continue to work. |
| 532 | """ |
| 533 | |
| 534 | if st.compare_states(state, st.invalid_state_match, 'or'): |
| 535 | error_message = "The state dictionary contains blank fields which" +\ |
| 536 | " is illegal.\n" + gp.sprint_var(state) |
| 537 | BuiltIn().fail(gp.sprint_error(error_message)) |
| 538 | |
Michael Walsh | 45ca6e4 | 2017-09-14 17:29:12 -0500 | [diff] [blame] | 539 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 540 | def select_boot(): |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 541 | r""" |
| 542 | Select a boot test to be run based on our current state and return the |
| 543 | chosen boot type. |
| 544 | |
| 545 | Description of arguments: |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 546 | state The state of the machine. |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 547 | """ |
| 548 | |
Michael Walsh | 8181674 | 2017-09-27 11:02:29 -0500 | [diff] [blame] | 549 | global transitional_boot_selected |
Michael Walsh | 30dadae | 2017-02-27 14:25:52 -0600 | [diff] [blame] | 550 | global boot_stack |
| 551 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 552 | gp.qprint_timen("Selecting a boot test.") |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 553 | |
Michael Walsh | 8181674 | 2017-09-27 11:02:29 -0500 | [diff] [blame] | 554 | if transitional_boot_selected and not boot_success: |
| 555 | prior_boot = next_boot |
| 556 | boot_candidate = boot_stack.pop() |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 557 | gp.qprint_timen("The prior '" + next_boot + "' was chosen to" |
| 558 | + " transition to a valid state for '" + boot_candidate |
| 559 | + "' which was at the top of the boot_stack. Since" |
| 560 | + " the '" + next_boot + "' failed, the '" |
| 561 | + boot_candidate + "' has been removed from the stack" |
| 562 | + " to avoid and endless failure loop.") |
Michael Walsh | 8181674 | 2017-09-27 11:02:29 -0500 | [diff] [blame] | 563 | if len(boot_stack) == 0: |
| 564 | return "" |
| 565 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 566 | my_get_state() |
Michael Walsh | 45ca6e4 | 2017-09-14 17:29:12 -0500 | [diff] [blame] | 567 | valid_state() |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 568 | |
Michael Walsh | 8181674 | 2017-09-27 11:02:29 -0500 | [diff] [blame] | 569 | transitional_boot_selected = False |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 570 | stack_popped = 0 |
| 571 | if len(boot_stack) > 0: |
| 572 | stack_popped = 1 |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 573 | gp.qprint_dashes() |
| 574 | gp.qprint_var(boot_stack) |
| 575 | gp.qprint_dashes() |
| 576 | skip_boot_printed = 0 |
| 577 | while len(boot_stack) > 0: |
| 578 | boot_candidate = boot_stack.pop() |
| 579 | if stack_mode == 'normal': |
| 580 | break |
| 581 | else: |
| 582 | if st.compare_states(state, boot_table[boot_candidate]['end']): |
| 583 | if not skip_boot_printed: |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 584 | gp.qprint_var(stack_mode) |
| 585 | gp.qprintn() |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 586 | gp.qprint_timen("Skipping the following boot tests" |
| 587 | + " which are unnecessary since their" |
| 588 | + " required end states match the" |
| 589 | + " current machine state:") |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 590 | skip_boot_printed = 1 |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 591 | gp.qprint_var(boot_candidate) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 592 | boot_candidate = "" |
| 593 | if boot_candidate == "": |
| 594 | gp.qprint_dashes() |
| 595 | gp.qprint_var(boot_stack) |
| 596 | gp.qprint_dashes() |
| 597 | return boot_candidate |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 598 | if st.compare_states(state, boot_table[boot_candidate]['start']): |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 599 | gp.qprint_timen("The machine state is valid for a '" |
| 600 | + boot_candidate + "' boot test.") |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 601 | gp.qprint_dashes() |
| 602 | gp.qprint_var(boot_stack) |
| 603 | gp.qprint_dashes() |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 604 | return boot_candidate |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 605 | else: |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 606 | gp.qprint_timen("The machine state does not match the required" |
| 607 | + " starting state for a '" + boot_candidate |
| 608 | + "' boot test:") |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 609 | gp.qprint_varx("boot_table_start_entry", |
| 610 | boot_table[boot_candidate]['start']) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 611 | boot_stack.append(boot_candidate) |
Michael Walsh | 8181674 | 2017-09-27 11:02:29 -0500 | [diff] [blame] | 612 | transitional_boot_selected = True |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 613 | popped_boot = boot_candidate |
| 614 | |
| 615 | # Loop through your list selecting a boot_candidates |
| 616 | boot_candidates = [] |
| 617 | for boot_candidate in boot_list: |
| 618 | if st.compare_states(state, boot_table[boot_candidate]['start']): |
| 619 | if stack_popped: |
| 620 | if st.compare_states(boot_table[boot_candidate]['end'], |
Gunnar Mills | 096cd56 | 2018-03-26 10:19:12 -0500 | [diff] [blame] | 621 | boot_table[popped_boot]['start']): |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 622 | boot_candidates.append(boot_candidate) |
| 623 | else: |
| 624 | boot_candidates.append(boot_candidate) |
| 625 | |
| 626 | if len(boot_candidates) == 0: |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 627 | gp.qprint_timen("The user's boot list contained no boot tests" |
| 628 | + " which are valid for the current machine state.") |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 629 | boot_candidate = default_power_on |
| 630 | if not st.compare_states(state, boot_table[default_power_on]['start']): |
| 631 | boot_candidate = default_power_off |
| 632 | boot_candidates.append(boot_candidate) |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 633 | gp.qprint_timen("Using default '" + boot_candidate |
| 634 | + "' boot type to transition to valid state.") |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 635 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 636 | gp.dprint_var(boot_candidates) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 637 | |
| 638 | # Randomly select a boot from the candidate list. |
| 639 | boot = random.choice(boot_candidates) |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 640 | |
| 641 | return boot |
Michael Walsh | 0bbd860 | 2016-11-22 11:31:49 -0600 | [diff] [blame] | 642 | |
Michael Walsh | 5530229 | 2017-01-10 11:43:02 -0600 | [diff] [blame] | 643 | |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 644 | def print_defect_report(ffdc_file_list): |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 645 | r""" |
| 646 | Print a defect report. |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 647 | |
| 648 | Description of argument(s): |
| 649 | ffdc_file_list A list of files which were collected by our ffdc functions. |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 650 | """ |
| 651 | |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 652 | # Making deliberate choice to NOT run plug_in_setup(). We don't want |
| 653 | # ffdc_prefix updated. |
| 654 | rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages( |
| 655 | call_point='ffdc_report', stop_on_plug_in_failure=0) |
| 656 | |
Michael Walsh | e0cf8d7 | 2017-05-17 13:20:46 -0500 | [diff] [blame] | 657 | # Get additional header data which may have been created by ffdc plug-ins. |
| 658 | # Also, delete the individual header files to cleanup. |
| 659 | cmd_buf = "file_list=$(cat " + ffdc_report_list_path + " 2>/dev/null)" +\ |
| 660 | " ; [ ! -z \"${file_list}\" ] && cat ${file_list}" +\ |
| 661 | " 2>/dev/null ; rm -rf ${file_list} 2>/dev/null || :" |
| 662 | shell_rc, more_header_info = gc.cmd_fnc_u(cmd_buf, print_output=0, |
| 663 | show_err=0) |
| 664 | |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 665 | # Get additional summary data which may have been created by ffdc plug-ins. |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 666 | # Also, delete the individual header files to cleanup. |
| 667 | cmd_buf = "file_list=$(cat " + ffdc_summary_list_path + " 2>/dev/null)" +\ |
| 668 | " ; [ ! -z \"${file_list}\" ] && cat ${file_list}" +\ |
| 669 | " 2>/dev/null ; rm -rf ${file_list} 2>/dev/null || :" |
| 670 | shell_rc, ffdc_summary_info = gc.cmd_fnc_u(cmd_buf, print_output=0, |
| 671 | show_err=0) |
| 672 | |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 673 | # ffdc_list_file_path contains a list of any ffdc files created by plug- |
| 674 | # ins, etc. Read that data into a list. |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 675 | try: |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 676 | plug_in_ffdc_list = \ |
| 677 | open(ffdc_list_file_path, 'r').read().rstrip("\n").split("\n") |
George Keishing | 36efbc0 | 2018-12-12 10:18:23 -0600 | [diff] [blame] | 678 | plug_in_ffdc_list = list(filter(None, plug_in_ffdc_list)) |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 679 | except IOError: |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 680 | plug_in_ffdc_list = [] |
| 681 | |
| 682 | # Combine the files from plug_in_ffdc_list with the ffdc_file_list passed |
| 683 | # in. Eliminate duplicates and sort the list. |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 684 | ffdc_file_list = sorted(set(ffdc_file_list + plug_in_ffdc_list)) |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 685 | |
| 686 | if status_file_path != "": |
| 687 | ffdc_file_list.insert(0, status_file_path) |
| 688 | |
| 689 | # Convert the list to a printable list. |
| 690 | printable_ffdc_file_list = "\n".join(ffdc_file_list) |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 691 | |
Michael Walsh | 68a6116 | 2017-04-25 11:54:06 -0500 | [diff] [blame] | 692 | # Open ffdc_file_list for writing. We will write a complete list of |
| 693 | # FFDC files to it for possible use by plug-ins like cp_stop_check. |
| 694 | ffdc_list_file = open(ffdc_list_file_path, 'w') |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 695 | ffdc_list_file.write(printable_ffdc_file_list + "\n") |
| 696 | ffdc_list_file.close() |
| 697 | |
| 698 | indent = 0 |
| 699 | width = 90 |
| 700 | linefeed = 1 |
| 701 | char = "=" |
Michael Walsh | 68a6116 | 2017-04-25 11:54:06 -0500 | [diff] [blame] | 702 | |
| 703 | gp.qprintn() |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 704 | gp.qprint_dashes(indent, width, linefeed, char) |
Michael Walsh | 68a6116 | 2017-04-25 11:54:06 -0500 | [diff] [blame] | 705 | gp.qprintn("Copy this data to the defect:\n") |
| 706 | |
Michael Walsh | e0cf8d7 | 2017-05-17 13:20:46 -0500 | [diff] [blame] | 707 | if len(more_header_info) > 0: |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 708 | gp.qprintn(more_header_info) |
Michael Walsh | dc80d67 | 2017-05-09 12:58:32 -0500 | [diff] [blame] | 709 | gp.qpvars(host_name, host_ip, openbmc_nickname, openbmc_host, |
| 710 | openbmc_host_name, openbmc_ip, openbmc_username, |
Michael Walsh | 0a3bdb4 | 2019-01-31 16:21:44 +0000 | [diff] [blame] | 711 | openbmc_password, rest_username, rest_password, ipmi_username, |
| 712 | ipmi_password, os_host, os_host_name, os_ip, os_username, |
Michael Walsh | dc80d67 | 2017-05-09 12:58:32 -0500 | [diff] [blame] | 713 | os_password, pdu_host, pdu_host_name, pdu_ip, pdu_username, |
| 714 | pdu_password, pdu_slot_no, openbmc_serial_host, |
| 715 | openbmc_serial_host_name, openbmc_serial_ip, openbmc_serial_port) |
Michael Walsh | 68a6116 | 2017-04-25 11:54:06 -0500 | [diff] [blame] | 716 | |
| 717 | gp.qprintn() |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 718 | print_boot_history(boot_history) |
Michael Walsh | 68a6116 | 2017-04-25 11:54:06 -0500 | [diff] [blame] | 719 | gp.qprintn() |
| 720 | gp.qprint_var(state) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 721 | gp.qprintn() |
| 722 | gp.qprintn("FFDC data files:") |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 723 | gp.qprintn(printable_ffdc_file_list) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 724 | gp.qprintn() |
Michael Walsh | 341c21e | 2017-01-17 16:25:20 -0600 | [diff] [blame] | 725 | |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 726 | if len(ffdc_summary_info) > 0: |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 727 | gp.qprintn(ffdc_summary_info) |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 728 | |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 729 | gp.qprint_dashes(indent, width, linefeed, char) |
Michael Walsh | 68a6116 | 2017-04-25 11:54:06 -0500 | [diff] [blame] | 730 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 731 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 732 | def my_ffdc(): |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 733 | r""" |
| 734 | Collect FFDC data. |
| 735 | """ |
| 736 | |
| 737 | global state |
| 738 | |
| 739 | plug_in_setup() |
| 740 | rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages( |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 741 | call_point='ffdc', stop_on_plug_in_failure=0) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 742 | |
| 743 | AUTOBOOT_FFDC_PREFIX = os.environ['AUTOBOOT_FFDC_PREFIX'] |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 744 | status, ffdc_file_list = grk.run_key_u("FFDC ffdc_prefix=" |
| 745 | + AUTOBOOT_FFDC_PREFIX |
| 746 | + " ffdc_function_list=" |
| 747 | + ffdc_function_list, ignore=1) |
Michael Walsh | 83f4bc7 | 2017-04-20 16:49:43 -0500 | [diff] [blame] | 748 | if status != 'PASS': |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 749 | gp.qprint_error("Call to ffdc failed.\n") |
Michael Walsh | c9bd2e8 | 2019-04-18 11:06:52 -0500 | [diff] [blame] | 750 | if type(ffdc_file_list) is not list: |
| 751 | ffdc_file_list = [] |
| 752 | # Leave a record for caller that "soft" errors occurred. |
| 753 | soft_errors = 1 |
| 754 | gpu.save_plug_in_value(soft_errors, pgm_name) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 755 | |
| 756 | my_get_state() |
| 757 | |
Michael Walsh | b2e53ec | 2017-10-30 15:04:36 -0500 | [diff] [blame] | 758 | print_defect_report(ffdc_file_list) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 759 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 760 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 761 | def print_test_start_message(boot_keyword): |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 762 | r""" |
| 763 | Print a message indicating what boot test is about to run. |
| 764 | |
| 765 | Description of arguments: |
| 766 | boot_keyword The name of the boot which is to be run |
| 767 | (e.g. "BMC Power On"). |
| 768 | """ |
| 769 | |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 770 | global boot_history |
Sunil M | 325eb54 | 2017-08-10 07:09:43 -0500 | [diff] [blame] | 771 | global boot_start_time |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 772 | |
| 773 | doing_msg = gp.sprint_timen("Doing \"" + boot_keyword + "\".") |
Sunil M | 325eb54 | 2017-08-10 07:09:43 -0500 | [diff] [blame] | 774 | |
| 775 | # Set boot_start_time for use by plug-ins. |
| 776 | boot_start_time = doing_msg[1:33] |
| 777 | gp.qprint_var(boot_start_time) |
| 778 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 779 | gp.qprint(doing_msg) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 780 | |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 781 | update_boot_history(boot_history, doing_msg, max_boot_history) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 782 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 783 | |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 784 | def stop_boot_test(signal_number=0, |
| 785 | frame=None): |
| 786 | r""" |
| 787 | Handle SIGUSR1 by aborting the boot test that is running. |
| 788 | |
| 789 | Description of argument(s): |
| 790 | signal_number The signal number (should always be 10 for SIGUSR1). |
| 791 | frame The frame data. |
| 792 | """ |
| 793 | |
Michael Walsh | 80dddde | 2019-10-22 13:54:38 -0500 | [diff] [blame] | 794 | gp.qprintn() |
| 795 | gp.qprint_executing() |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 796 | gp.lprint_executing() |
| 797 | |
| 798 | # Restore original sigusr1 handler. |
| 799 | set_default_siguser1() |
| 800 | |
| 801 | message = "The caller has asked that the boot test be stopped and marked" |
| 802 | message += " as a failure." |
| 803 | |
| 804 | function_stack = gm.get_function_stack() |
| 805 | if "wait_state" in function_stack: |
Michael Walsh | c44aa53 | 2019-06-14 13:33:29 -0500 | [diff] [blame] | 806 | st.set_exit_wait_early_message(message) |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 807 | else: |
| 808 | BuiltIn().fail(gp.sprint_error(message)) |
| 809 | |
| 810 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 811 | def run_boot(boot): |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 812 | r""" |
| 813 | Run the specified boot. |
| 814 | |
| 815 | Description of arguments: |
| 816 | boot The name of the boot test to be performed. |
| 817 | """ |
| 818 | |
| 819 | global state |
| 820 | |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 821 | signal.signal(signal.SIGUSR1, stop_boot_test) |
| 822 | gp.qprint_timen("stop_boot_test is armed.") |
| 823 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 824 | print_test_start_message(boot) |
| 825 | |
| 826 | plug_in_setup() |
| 827 | rc, shell_rc, failed_plug_in_name = \ |
| 828 | grpi.rprocess_plug_in_packages(call_point="pre_boot") |
| 829 | if rc != 0: |
| 830 | error_message = "Plug-in failed with non-zero return code.\n" +\ |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 831 | gp.sprint_var(rc, fmt=gp.hexa()) |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 832 | set_default_siguser1() |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 833 | BuiltIn().fail(gp.sprint_error(error_message)) |
| 834 | |
| 835 | if test_mode: |
| 836 | # In test mode, we'll pretend the boot worked by assigning its |
| 837 | # required end state to the default state value. |
Michael Walsh | 30dadae | 2017-02-27 14:25:52 -0600 | [diff] [blame] | 838 | state = st.strip_anchor_state(boot_table[boot]['end']) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 839 | else: |
| 840 | # Assertion: We trust that the state data was made fresh by the |
| 841 | # caller. |
| 842 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 843 | gp.qprintn() |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 844 | |
| 845 | if boot_table[boot]['method_type'] == "keyword": |
Michael Walsh | 0b93fbf | 2017-03-02 14:42:41 -0600 | [diff] [blame] | 846 | rk.my_run_keywords(boot_table[boot].get('lib_file_path', ''), |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 847 | boot_table[boot]['method'], |
| 848 | quiet=quiet) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 849 | |
| 850 | if boot_table[boot]['bmc_reboot']: |
| 851 | st.wait_for_comm_cycle(int(state['epoch_seconds'])) |
Michael Walsh | 30dadae | 2017-02-27 14:25:52 -0600 | [diff] [blame] | 852 | plug_in_setup() |
| 853 | rc, shell_rc, failed_plug_in_name = \ |
| 854 | grpi.rprocess_plug_in_packages(call_point="post_reboot") |
| 855 | if rc != 0: |
Michael Walsh | 0b93fbf | 2017-03-02 14:42:41 -0600 | [diff] [blame] | 856 | error_message = "Plug-in failed with non-zero return code.\n" |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 857 | error_message += gp.sprint_var(rc, fmt=gp.hexa()) |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 858 | set_default_siguser1() |
Michael Walsh | 30dadae | 2017-02-27 14:25:52 -0600 | [diff] [blame] | 859 | BuiltIn().fail(gp.sprint_error(error_message)) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 860 | else: |
| 861 | match_state = st.anchor_state(state) |
| 862 | del match_state['epoch_seconds'] |
| 863 | # Wait for the state to change in any way. |
| 864 | st.wait_state(match_state, wait_time=state_change_timeout, |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 865 | interval="10 seconds", invert=1) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 866 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 867 | gp.qprintn() |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 868 | if boot_table[boot]['end']['chassis'] == "Off": |
| 869 | boot_timeout = power_off_timeout |
| 870 | else: |
| 871 | boot_timeout = power_on_timeout |
| 872 | st.wait_state(boot_table[boot]['end'], wait_time=boot_timeout, |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 873 | interval="10 seconds") |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 874 | |
| 875 | plug_in_setup() |
| 876 | rc, shell_rc, failed_plug_in_name = \ |
| 877 | grpi.rprocess_plug_in_packages(call_point="post_boot") |
| 878 | if rc != 0: |
| 879 | error_message = "Plug-in failed with non-zero return code.\n" +\ |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 880 | gp.sprint_var(rc, fmt=gp.hexa()) |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 881 | set_default_siguser1() |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 882 | BuiltIn().fail(gp.sprint_error(error_message)) |
| 883 | |
Michael Walsh | f566fb1 | 2019-02-01 14:35:09 -0600 | [diff] [blame] | 884 | # Restore original sigusr1 handler. |
| 885 | set_default_siguser1() |
| 886 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 887 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 888 | def test_loop_body(): |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 889 | r""" |
| 890 | The main loop body for the loop in main_py. |
| 891 | |
| 892 | Description of arguments: |
| 893 | boot_count The iteration number (starts at 1). |
| 894 | """ |
| 895 | |
| 896 | global boot_count |
| 897 | global state |
| 898 | global next_boot |
| 899 | global boot_success |
Sunil M | 325eb54 | 2017-08-10 07:09:43 -0500 | [diff] [blame] | 900 | global boot_end_time |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 901 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 902 | gp.qprintn() |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 903 | |
| 904 | next_boot = select_boot() |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 905 | if next_boot == "": |
| 906 | return True |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 907 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 908 | boot_count += 1 |
| 909 | gp.qprint_timen("Starting boot " + str(boot_count) + ".") |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 910 | |
Michael Walsh | e0cf8d7 | 2017-05-17 13:20:46 -0500 | [diff] [blame] | 911 | pre_boot_plug_in_setup() |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 912 | |
| 913 | cmd_buf = ["run_boot", next_boot] |
| 914 | boot_status, msg = BuiltIn().run_keyword_and_ignore_error(*cmd_buf) |
| 915 | if boot_status == "FAIL": |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 916 | gp.qprint(msg) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 917 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 918 | gp.qprintn() |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 919 | if boot_status == "PASS": |
| 920 | boot_success = 1 |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 921 | completion_msg = gp.sprint_timen("BOOT_SUCCESS: \"" + next_boot |
| 922 | + "\" succeeded.") |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 923 | else: |
| 924 | boot_success = 0 |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 925 | completion_msg = gp.sprint_timen("BOOT_FAILED: \"" + next_boot |
| 926 | + "\" failed.") |
Sunil M | 325eb54 | 2017-08-10 07:09:43 -0500 | [diff] [blame] | 927 | |
| 928 | # Set boot_end_time for use by plug-ins. |
| 929 | boot_end_time = completion_msg[1:33] |
| 930 | gp.qprint_var(boot_end_time) |
| 931 | |
| 932 | gp.qprint(completion_msg) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 933 | |
| 934 | boot_results.update(next_boot, boot_status) |
| 935 | |
| 936 | plug_in_setup() |
| 937 | # NOTE: A post_test_case call point failure is NOT counted as a boot |
| 938 | # failure. |
| 939 | rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages( |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 940 | call_point='post_test_case', stop_on_plug_in_failure=0) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 941 | |
| 942 | plug_in_setup() |
| 943 | rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages( |
Michael Walsh | 89de14a | 2018-10-01 16:51:37 -0500 | [diff] [blame] | 944 | call_point='ffdc_check', shell_rc=dump_ffdc_rc(), |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 945 | stop_on_plug_in_failure=1, stop_on_non_zero_rc=1) |
Michael Walsh | 12059e2 | 2019-03-21 11:03:45 -0500 | [diff] [blame] | 946 | if ffdc_check == "All" or\ |
Michael Walsh | 89de14a | 2018-10-01 16:51:37 -0500 | [diff] [blame] | 947 | shell_rc == dump_ffdc_rc(): |
Michael Walsh | 83f4bc7 | 2017-04-20 16:49:43 -0500 | [diff] [blame] | 948 | status, ret_values = grk.run_key_u("my_ffdc", ignore=1) |
| 949 | if status != 'PASS': |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 950 | gp.qprint_error("Call to my_ffdc failed.\n") |
Michael Walsh | c9bd2e8 | 2019-04-18 11:06:52 -0500 | [diff] [blame] | 951 | # Leave a record for caller that "soft" errors occurred. |
| 952 | soft_errors = 1 |
| 953 | gpu.save_plug_in_value(soft_errors, pgm_name) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 954 | |
Michael Walsh | aabef1e | 2017-09-20 15:16:17 -0500 | [diff] [blame] | 955 | if delete_errlogs: |
| 956 | # We need to purge error logs between boots or they build up. |
| 957 | grk.run_key("Delete Error logs", ignore=1) |
Michael Walsh | d139f28 | 2017-04-04 18:00:23 -0500 | [diff] [blame] | 958 | |
Michael Walsh | 952f9b0 | 2017-03-09 13:11:14 -0600 | [diff] [blame] | 959 | boot_results.print_report() |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 960 | gp.qprint_timen("Finished boot " + str(boot_count) + ".") |
Michael Walsh | 952f9b0 | 2017-03-09 13:11:14 -0600 | [diff] [blame] | 961 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 962 | plug_in_setup() |
| 963 | rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages( |
Michael Walsh | 89de14a | 2018-10-01 16:51:37 -0500 | [diff] [blame] | 964 | call_point='stop_check', shell_rc=stop_test_rc(), |
| 965 | stop_on_non_zero_rc=1) |
| 966 | if shell_rc == stop_test_rc(): |
Michael Walsh | 3ba8ecd | 2018-04-24 11:33:25 -0500 | [diff] [blame] | 967 | message = "Stopping as requested by user.\n" |
Michael Walsh | 80dddde | 2019-10-22 13:54:38 -0500 | [diff] [blame] | 968 | gp.qprint_time(message) |
Michael Walsh | 3ba8ecd | 2018-04-24 11:33:25 -0500 | [diff] [blame] | 969 | BuiltIn().fail(message) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 970 | |
Michael Walsh | d139f28 | 2017-04-04 18:00:23 -0500 | [diff] [blame] | 971 | # This should help prevent ConnectionErrors. |
Michael Walsh | 0960b38 | 2017-06-22 16:23:37 -0500 | [diff] [blame] | 972 | grk.run_key_u("Close All Connections") |
Michael Walsh | d139f28 | 2017-04-04 18:00:23 -0500 | [diff] [blame] | 973 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 974 | return True |
| 975 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 976 | |
Michael Walsh | 83f4bc7 | 2017-04-20 16:49:43 -0500 | [diff] [blame] | 977 | def obmc_boot_test_teardown(): |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 978 | r""" |
Michael Walsh | f75d435 | 2019-12-05 17:01:20 -0600 | [diff] [blame] | 979 | Clean up after the main keyword. |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 980 | """ |
Michael Walsh | f75d435 | 2019-12-05 17:01:20 -0600 | [diff] [blame] | 981 | gp.qprint_executing() |
| 982 | |
| 983 | if ga.psutil_imported: |
| 984 | ga.terminate_descendants() |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 985 | |
| 986 | if cp_setup_called: |
| 987 | plug_in_setup() |
| 988 | rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages( |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 989 | call_point='cleanup', stop_on_plug_in_failure=0) |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 990 | |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 991 | if 'boot_results_file_path' in globals(): |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 992 | # Save boot_results and boot_history objects to a file in case they are |
Michael Walsh | 6c64574 | 2018-08-17 15:02:17 -0500 | [diff] [blame] | 993 | # needed again. |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 994 | gp.qprint_timen("Saving boot_results to the following path.") |
| 995 | gp.qprint_var(boot_results_file_path) |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 996 | pickle.dump((boot_results, boot_history), |
Michael Walsh | 6c64574 | 2018-08-17 15:02:17 -0500 | [diff] [blame] | 997 | open(boot_results_file_path, 'wb'), |
Michael Walsh | 600876d | 2017-05-30 17:58:58 -0500 | [diff] [blame] | 998 | pickle.HIGHEST_PROTOCOL) |
Michael Walsh | 0b93fbf | 2017-03-02 14:42:41 -0600 | [diff] [blame] | 999 | |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 1000 | global save_stack |
| 1001 | # Restore any global values saved on the save_stack. |
| 1002 | for parm_name in main_func_parm_list: |
| 1003 | # Get the parm_value if it was saved on the stack. |
| 1004 | try: |
| 1005 | parm_value = save_stack.pop(parm_name) |
Joy Onyerikwu | 004ad3c | 2018-06-11 16:29:56 -0500 | [diff] [blame] | 1006 | except BaseException: |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 1007 | # If it was not saved, no further action is required. |
| 1008 | continue |
| 1009 | |
| 1010 | # Restore the saved value. |
| 1011 | cmd_buf = "BuiltIn().set_global_variable(\"${" + parm_name +\ |
| 1012 | "}\", parm_value)" |
| 1013 | gp.dpissuing(cmd_buf) |
| 1014 | exec(cmd_buf) |
| 1015 | |
| 1016 | gp.dprintn(save_stack.sprint_obj()) |
| 1017 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 1018 | |
Michael Walsh | c911681 | 2017-03-10 14:23:06 -0600 | [diff] [blame] | 1019 | def test_teardown(): |
Michael Walsh | c911681 | 2017-03-10 14:23:06 -0600 | [diff] [blame] | 1020 | r""" |
| 1021 | Clean up after this test case. |
| 1022 | """ |
| 1023 | |
| 1024 | gp.qprintn() |
Michael Walsh | f75d435 | 2019-12-05 17:01:20 -0600 | [diff] [blame] | 1025 | gp.qprint_executing() |
| 1026 | |
| 1027 | if ga.psutil_imported: |
| 1028 | ga.terminate_descendants() |
| 1029 | |
Michael Walsh | c911681 | 2017-03-10 14:23:06 -0600 | [diff] [blame] | 1030 | cmd_buf = ["Print Error", |
| 1031 | "A keyword timeout occurred ending this program.\n"] |
| 1032 | BuiltIn().run_keyword_if_timeout_occurred(*cmd_buf) |
| 1033 | |
Michael Walsh | c108e42 | 2019-03-28 12:27:18 -0500 | [diff] [blame] | 1034 | gp.qprint_pgm_footer() |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 1035 | |
Michael Walsh | c911681 | 2017-03-10 14:23:06 -0600 | [diff] [blame] | 1036 | |
Michael Walsh | 89de14a | 2018-10-01 16:51:37 -0500 | [diff] [blame] | 1037 | def post_stack(): |
| 1038 | r""" |
| 1039 | Process post_stack plug-in programs. |
| 1040 | """ |
| 1041 | |
| 1042 | if not call_post_stack_plug: |
| 1043 | # The caller does not wish to have post_stack plug-in processing done. |
| 1044 | return |
| 1045 | |
| 1046 | global boot_success |
| 1047 | |
| 1048 | # NOTE: A post_stack call-point failure is NOT counted as a boot failure. |
| 1049 | pre_boot_plug_in_setup() |
| 1050 | # For the purposes of the following plug-ins, mark the "boot" as a success. |
| 1051 | boot_success = 1 |
| 1052 | plug_in_setup() |
Michael Walsh | 815b1d5 | 2018-10-30 13:32:26 -0500 | [diff] [blame] | 1053 | rc, shell_rc, failed_plug_in_name, history =\ |
| 1054 | grpi.rprocess_plug_in_packages(call_point='post_stack', |
| 1055 | stop_on_plug_in_failure=0, |
| 1056 | return_history=True) |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 1057 | for doing_msg in history: |
| 1058 | update_boot_history(boot_history, doing_msg, max_boot_history) |
Michael Walsh | 815b1d5 | 2018-10-30 13:32:26 -0500 | [diff] [blame] | 1059 | if rc != 0: |
| 1060 | boot_success = 0 |
Michael Walsh | 89de14a | 2018-10-01 16:51:37 -0500 | [diff] [blame] | 1061 | |
| 1062 | plug_in_setup() |
Michael Walsh | 815b1d5 | 2018-10-30 13:32:26 -0500 | [diff] [blame] | 1063 | rc, shell_rc, failed_plug_in_name =\ |
| 1064 | grpi.rprocess_plug_in_packages(call_point='ffdc_check', |
| 1065 | shell_rc=dump_ffdc_rc(), |
| 1066 | stop_on_plug_in_failure=1, |
| 1067 | stop_on_non_zero_rc=1) |
| 1068 | if shell_rc == dump_ffdc_rc(): |
Michael Walsh | 89de14a | 2018-10-01 16:51:37 -0500 | [diff] [blame] | 1069 | status, ret_values = grk.run_key_u("my_ffdc", ignore=1) |
| 1070 | if status != 'PASS': |
| 1071 | gp.qprint_error("Call to my_ffdc failed.\n") |
Michael Walsh | c9bd2e8 | 2019-04-18 11:06:52 -0500 | [diff] [blame] | 1072 | # Leave a record for caller that "soft" errors occurred. |
| 1073 | soft_errors = 1 |
| 1074 | gpu.save_plug_in_value(soft_errors, pgm_name) |
Michael Walsh | 89de14a | 2018-10-01 16:51:37 -0500 | [diff] [blame] | 1075 | |
| 1076 | plug_in_setup() |
| 1077 | rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages( |
| 1078 | call_point='stop_check', shell_rc=stop_test_rc(), |
| 1079 | stop_on_non_zero_rc=1) |
| 1080 | if shell_rc == stop_test_rc(): |
| 1081 | message = "Stopping as requested by user.\n" |
Michael Walsh | 80dddde | 2019-10-22 13:54:38 -0500 | [diff] [blame] | 1082 | gp.qprint_time(message) |
Michael Walsh | 89de14a | 2018-10-01 16:51:37 -0500 | [diff] [blame] | 1083 | BuiltIn().fail(message) |
| 1084 | |
| 1085 | |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 1086 | def obmc_boot_test_py(loc_boot_stack=None, |
| 1087 | loc_stack_mode=None, |
| 1088 | loc_quiet=None): |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 1089 | r""" |
| 1090 | Do main program processing. |
| 1091 | """ |
| 1092 | |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 1093 | global save_stack |
| 1094 | |
Michael Walsh | f75d435 | 2019-12-05 17:01:20 -0600 | [diff] [blame] | 1095 | ga.set_term_options(term_requests={'pgm_names': ['process_plug_in_packages.py']}) |
| 1096 | |
George Keishing | 36efbc0 | 2018-12-12 10:18:23 -0600 | [diff] [blame] | 1097 | gp.dprintn() |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 1098 | # Process function parms. |
| 1099 | for parm_name in main_func_parm_list: |
| 1100 | # Get parm's value. |
George Keishing | 36efbc0 | 2018-12-12 10:18:23 -0600 | [diff] [blame] | 1101 | parm_value = eval("loc_" + parm_name) |
| 1102 | gp.dpvars(parm_name, parm_value) |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 1103 | |
George Keishing | 36efbc0 | 2018-12-12 10:18:23 -0600 | [diff] [blame] | 1104 | if parm_value is not None: |
Michael Walsh | ff34000 | 2017-08-29 11:18:27 -0500 | [diff] [blame] | 1105 | # Save the global value on a stack. |
| 1106 | cmd_buf = "save_stack.push(BuiltIn().get_variable_value(\"${" +\ |
| 1107 | parm_name + "}\"), \"" + parm_name + "\")" |
| 1108 | gp.dpissuing(cmd_buf) |
| 1109 | exec(cmd_buf) |
| 1110 | |
| 1111 | # Set the global value to the passed value. |
| 1112 | cmd_buf = "BuiltIn().set_global_variable(\"${" + parm_name +\ |
| 1113 | "}\", loc_" + parm_name + ")" |
| 1114 | gp.dpissuing(cmd_buf) |
| 1115 | exec(cmd_buf) |
| 1116 | |
| 1117 | gp.dprintn(save_stack.sprint_obj()) |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 1118 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 1119 | setup() |
| 1120 | |
Michael Walsh | cd9fbfd | 2017-09-19 12:00:08 -0500 | [diff] [blame] | 1121 | init_boot_pass, init_boot_fail = boot_results.return_total_pass_fail() |
| 1122 | |
Michael Walsh | a20da40 | 2017-03-31 16:27:45 -0500 | [diff] [blame] | 1123 | if ffdc_only: |
| 1124 | gp.qprint_timen("Caller requested ffdc_only.") |
Michael Walsh | 986d8ae | 2019-07-17 10:02:23 -0500 | [diff] [blame] | 1125 | if do_pre_boot_plug_in_setup: |
| 1126 | pre_boot_plug_in_setup() |
Michael Walsh | 83f4bc7 | 2017-04-20 16:49:43 -0500 | [diff] [blame] | 1127 | grk.run_key_u("my_ffdc") |
Michael Walsh | 764d2f8 | 2017-04-27 16:01:08 -0500 | [diff] [blame] | 1128 | return |
Michael Walsh | a20da40 | 2017-03-31 16:27:45 -0500 | [diff] [blame] | 1129 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 1130 | # Process caller's boot_stack. |
| 1131 | while (len(boot_stack) > 0): |
| 1132 | test_loop_body() |
| 1133 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 1134 | gp.qprint_timen("Finished processing stack.") |
Michael Walsh | 30dadae | 2017-02-27 14:25:52 -0600 | [diff] [blame] | 1135 | |
Michael Walsh | 89de14a | 2018-10-01 16:51:37 -0500 | [diff] [blame] | 1136 | post_stack() |
| 1137 | |
Michael Walsh | 6741f74 | 2017-02-20 16:16:38 -0600 | [diff] [blame] | 1138 | # Process caller's boot_list. |
| 1139 | if len(boot_list) > 0: |
| 1140 | for ix in range(1, max_num_tests + 1): |
| 1141 | test_loop_body() |
| 1142 | |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 1143 | gp.qprint_timen("Completed all requested boot tests.") |
| 1144 | |
| 1145 | boot_pass, boot_fail = boot_results.return_total_pass_fail() |
Michael Walsh | cd9fbfd | 2017-09-19 12:00:08 -0500 | [diff] [blame] | 1146 | new_fail = boot_fail - init_boot_fail |
| 1147 | if new_fail > boot_fail_threshold: |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 1148 | error_message = "Boot failures exceed the boot failure" +\ |
| 1149 | " threshold:\n" +\ |
Michael Walsh | cd9fbfd | 2017-09-19 12:00:08 -0500 | [diff] [blame] | 1150 | gp.sprint_var(new_fail) +\ |
Michael Walsh | b5839d0 | 2017-04-12 16:11:20 -0500 | [diff] [blame] | 1151 | gp.sprint_var(boot_fail_threshold) |
| 1152 | BuiltIn().fail(gp.sprint_error(error_message)) |