Fixed duplicate fail_after on boot which sometime didn't get canceled
All checks were successful
Run test asserts / Test-Asserts (push) Successful in -16s

This commit is contained in:
Willem Cazander 2025-07-14 09:07:14 +02:00
parent 1ea824d39e
commit 4428c413d8
2 changed files with 12 additions and 10 deletions

View file

@ -38,7 +38,7 @@ proc fail_after_exit {{fail_id "fail_after_exit"} {fail_code 2}} {
proc fail_after { timeout {time_unit "time"} {fail_id "fail_after"} {fail_code 2}} {
global fail_after_prev_timer
global fail_after_prev_id
set msg ""
set msg "mb::fail not installed"
if {$fail_after_prev_timer != 0} {
if {[catch {after cancel $fail_after_prev_timer} err_msg]} {
puts stderr "error: $err_msg"
@ -62,21 +62,23 @@ proc fail_after { timeout {time_unit "time"} {fail_id "fail_after"} {fail_code 2
return $msg
}
proc fail_after_reboot_watchdog {} {
proc fail_after_reboot_watchdog {{skip_preboot_hook 1}} {
global fail_after_boot_timeout
if {$fail_after_boot_timeout != 0} {
if {$skip_preboot_hook != 0} {
if {[catch {fail_after $fail_after_boot_timeout realtime err_boot 124} err_msg]} {
puts stderr "error: $err_msg"
fail_after_exit fail_after_reboot_install_error 1
}
if {[catch {after boot "fail_after_reboot_watchdog"} err_msg]} {
puts stderr "error: $err_msg"
fail_after_exit fail_after_reboot_cycle_error 1
}
}
if {[catch {after boot "fail_after_reboot_watchdog"} err_msg]} {
puts stderr "error: $err_msg"
fail_after_exit fail_after_reboot_cycle_error 1
}
}
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
if {$fail_after_boot_timeout != 0} {
fail_after_reboot_watchdog 0
}
}