Added flight recorder and more boot messages.
All checks were successful
Run test asserts / Test-Asserts (push) Successful in -8s

This commit is contained in:
Willem Cazander 2024-06-29 15:47:52 +02:00
parent 97088650d4
commit c1a52773ac
16 changed files with 176 additions and 94 deletions

View file

@ -17,21 +17,19 @@
#
# Supported environment variables by this script;
#
# FAIL_AFTER_PATH=.
# Enabled automatic screenshots saving in case of failures in the supplied path.
#
# FAIL_AFTER_BOOT=30
# BOOT_WATCHDOG=30
# Enables the boot watchdog timer which will exit openMSX after the timeout(in seconds).
# To cancel this timer give an `fail_after 0` or any new fail_after command.
# (exits with status 124 see `man timeout`)
#
set fail_after_prev_timer 0
set fail_after_prev_id 0
set fail_after_boot_timeout 0
proc fail_after_exit {{fail_id "fail_after_exit"} {fail_code 2}} {
global fail_after_path
if {$fail_after_path != 0} {
if {[catch {screenshot $fail_after_path/$fail_id.png} err_msg]} {
puts stderr "warning: $err_msg"
}
# maybe later add; if {is_text_mode} { [get_screen] ?> $fail_after_path/$fail_id.scr }
if {[catch {screenshot -prefix $fail_id} err_msg]} {
puts stderr "warning: $err_msg"
}
puts stderr "error: Failure request from $fail_id"
exit $fail_code
@ -43,7 +41,7 @@ proc fail_after { timeout {time_unit "time"} {fail_id "fail_after"} {fail_code 2
set msg ""
if {$fail_after_prev_timer != 0} {
after cancel $fail_after_prev_timer
set msg "$fail_after_prev_id: Stopped attempt."
set msg "$fail_after_prev_id: Stopped attempt"
}
set fail_after_prev_id $fail_id
if {$time_unit != "time"} {
@ -69,19 +67,7 @@ proc fail_after_reboot_watchdog {} {
}
}
# Globals
set fail_after_prev_timer 0
set fail_after_prev_id 0
set fail_after_path 0
set fail_after_boot_timeout 0
# Parse screenshot path env setting
if {[info exists ::env(FAIL_AFTER_PATH)] && ([string trim $::env(FAIL_AFTER_PATH)] != "")} {
set fail_after_path [string trim $::env(FAIL_AFTER_PATH)]
}
# Enables boot watch dog timer when FAIL_AFTER_BOOT env has a value. (124 see `man timeout`)
if {[info exists ::env(FAIL_AFTER_BOOT)] && ([string trim $::env(FAIL_AFTER_BOOT)] != "")} {
set fail_after_boot_timeout [string trim $::env(FAIL_AFTER_BOOT)]
if {[info exists ::env(BOOT_WATCHDOG)] && ([string trim $::env(BOOT_WATCHDOG)] != "")} {
set fail_after_boot_timeout [string trim $::env(BOOT_WATCHDOG)]
fail_after_reboot_watchdog
}