def pause(message="Hit enter to continue..."): r""" Print the message, with time stamp, and pause until the user hits enter. Description of argument(s): message The message to be printed to stdout. """ gp.print_time(message) try: input() except SyntaxError: pass return
def post_stack(): r""" Process post_stack plug-in programs. """ if not call_post_stack_plug: # The caller does not wish to have post_stack plug-in processing done. return global boot_success # NOTE: A post_stack call-point failure is NOT counted as a boot failure. pre_boot_plug_in_setup() # For the purposes of the following plug-ins, mark the "boot" as a success. boot_success = 1 plug_in_setup() rc, shell_rc, failed_plug_in_name, history =\ grpi.rprocess_plug_in_packages(call_point='post_stack', stop_on_plug_in_failure=0, return_history=True) last_ten.extend(history) # Trim list to max number of entries. del last_ten[:max(0, len(last_ten) - max_boot_history)] if rc != 0: boot_success = 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 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) 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.print_time(message) BuiltIn().fail(message)
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=0x00000200, stop_on_plug_in_failure=1, stop_on_non_zero_rc=1) if boot_status != "PASS" or ffdc_check == "All" or shell_rc == 0x00000200: status, ret_values = grk.run_key_u("my_ffdc", ignore=1) if status != 'PASS': gp.qprint_error("Call to my_ffdc failed.\n") if delete_errlogs: # We need to purge error logs between boots or they build up. grk.run_key("Delete Error logs", 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=0x00000200, stop_on_non_zero_rc=1) if shell_rc == 0x00000200: message = "Stopping as requested by user.\n" gp.print_time(message) BuiltIn().fail(message) # This should help prevent ConnectionErrors. grk.run_key_u("Close All Connections") return True