def test_loop_body(): r""" The main loop body for the loop in main_py. Description of arguments: boot_count The iteration number (starts at 1). """ global boot_count global state global next_boot global boot_success global boot_end_time gp.qprintn() next_boot = select_boot() if next_boot == "": return True boot_count += 1 gp.qprint_timen("Starting boot " + str(boot_count) + ".") pre_boot_plug_in_setup() cmd_buf = ["run_boot", next_boot] boot_status, msg = BuiltIn().run_keyword_and_ignore_error(*cmd_buf) if boot_status == "FAIL": gp.qprint(msg) gp.qprintn() if boot_status == "PASS": boot_success = 1 completion_msg = gp.sprint_timen("BOOT_SUCCESS: \"" + next_boot + "\" succeeded.") else: boot_success = 0 completion_msg = gp.sprint_timen("BOOT_FAILED: \"" + next_boot + "\" failed.") # Set boot_end_time for use by plug-ins. boot_end_time = completion_msg[1:33] gp.qprint_var(boot_end_time) gp.qprint(completion_msg) boot_results.update(next_boot, boot_status) plug_in_setup() # NOTE: A post_test_case call point failure is NOT counted as a boot # failure. rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages( call_point='post_test_case', stop_on_plug_in_failure=0) plug_in_setup() rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages( call_point='ffdc_check', shell_rc=dump_ffdc_rc(), stop_on_plug_in_failure=1, stop_on_non_zero_rc=1) if ffdc_check == "All" or\ shell_rc == dump_ffdc_rc(): status, ret_values = grk.run_key_u("my_ffdc", ignore=1) if status != 'PASS': gp.qprint_error("Call to my_ffdc failed.\n") # Leave a record for caller that "soft" errors occurred. soft_errors = 1 gpu.save_plug_in_value(soft_errors, pgm_name) if delete_errlogs: # print error logs before delete status, error_logs = grk.run_key_u("Get Error Logs") pels = pel.peltool("-l", ignore_err=1) log.print_error_logs(error_logs, "AdditionalData Message Severity") gp.qprint_var(pels) # We need to purge error logs between boots or they build up. grk.run_key(delete_errlogs_cmd, ignore=1) grk.run_key(delete_bmcdump_cmd, ignore=1) boot_results.print_report() gp.qprint_timen("Finished boot " + str(boot_count) + ".") plug_in_setup() rc, shell_rc, failed_plug_in_name = grpi.rprocess_plug_in_packages( call_point='stop_check', shell_rc=stop_test_rc(), stop_on_non_zero_rc=1) if shell_rc == stop_test_rc(): message = "Stopping as requested by user.\n" gp.qprint_time(message) BuiltIn().fail(message) # This should help prevent ConnectionErrors. # Purge all redfish and REST connection sessions. if redfish_delete_sessions: grk.run_key_u("Close All Connections", ignore=1) grk.run_key_u("Delete All Redfish Sessions", ignore=1) return True
def obmc_boot_test_py(loc_boot_stack=None, loc_stack_mode=None, loc_quiet=None): r""" Do main program processing. """ global save_stack ga.set_term_options(term_requests={'pgm_names': ['process_plug_in_packages.py']}) gp.dprintn() # Process function parms. for parm_name in main_func_parm_list: # Get parm's value. parm_value = eval("loc_" + parm_name) gp.dpvars(parm_name, parm_value) if parm_value is not None: # Save the global value on a stack. cmd_buf = "save_stack.push(BuiltIn().get_variable_value(\"${" +\ parm_name + "}\"), \"" + parm_name + "\")" gp.dpissuing(cmd_buf) exec(cmd_buf) # Set the global value to the passed value. cmd_buf = "BuiltIn().set_global_variable(\"${" + parm_name +\ "}\", loc_" + parm_name + ")" gp.dpissuing(cmd_buf) exec(cmd_buf) gp.dprintn(save_stack.sprint_obj()) setup() init_boot_pass, init_boot_fail = boot_results.return_total_pass_fail() if ffdc_only: gp.qprint_timen("Caller requested ffdc_only.") if do_pre_boot_plug_in_setup: pre_boot_plug_in_setup() grk.run_key_u("my_ffdc") return if delete_errlogs: # print error logs before delete status, error_logs = grk.run_key_u("Get Error Logs") pels = pel.peltool("-l", ignore_err=1) log.print_error_logs(error_logs, "AdditionalData Message Severity") gp.qprint_var(pels) # Delete errlogs prior to doing any boot tests. grk.run_key(delete_errlogs_cmd, ignore=1) grk.run_key(delete_bmcdump_cmd, ignore=1) # Process caller's boot_stack. while (len(boot_stack) > 0): test_loop_body() gp.qprint_timen("Finished processing stack.") post_stack() # Process caller's boot_list. if len(boot_list) > 0: for ix in range(1, max_num_tests + 1): test_loop_body() gp.qprint_timen("Completed all requested boot tests.") boot_pass, boot_fail = boot_results.return_total_pass_fail() new_fail = boot_fail - init_boot_fail if new_fail > boot_fail_threshold: error_message = "Boot failures exceed the boot failure" +\ " threshold:\n" +\ gp.sprint_var(new_fail) +\ gp.sprint_var(boot_fail_threshold) BuiltIn().fail(gp.sprint_error(error_message))