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

@ -20,6 +20,5 @@ BUILD_HELP += \\n\\t* clean
clean: clean:
$(call mb_clean,$(PATH_BIN)) $(call mb_clean,$(PATH_BIN))
MB_OPENMSX_PATH_BIN ?= $(PATH_BIN)
include lib/make/msxbuild.mk include lib/make/msxbuild.mk
include $(INC_TEST) include $(INC_TEST)

View file

@ -63,7 +63,7 @@ When you want to see whats happening do a debug run;
real 2m37.379s real 2m37.379s
debug run with video recorder and merge to one video file; debug run with video recorder and merge to one video file;
time MB_OPENMSX_HEADLESS=off MB_OPENMSX_RECORDER=on make -s assert-all-video time MB_OPENMSX_HEADLESS=off MB_FLIGHT_VIDEO=on make -s assert-all-video
real 0m7.136s real 0m7.136s
build parallel; build parallel;
@ -77,17 +77,19 @@ Current set is WIP.
* mb_autoexec_append_cmd * mb_autoexec_append_cmd
* mb_autoexec_append_echo * mb_autoexec_append_echo
* mb_autoexec_append_rem * mb_autoexec_append_rem
* mb_autoexec_append_gui_mode * mb_autoexec_append_show_gui
* mb_autoexec_append_stop_fail * mb_autoexec_append_stop_fail
* mb_autoexec_append_exit * mb_autoexec_append_exit
* mb_autoexec_append_joyporta_mouse * mb_autoexec_append_joyporta_mouse
* mb_autoexec_append_record_screenshot
* mb_autoexec_append_record_video
* mb_autoexec_append_safe_test * mb_autoexec_append_safe_test
* mb_autoexec_append_safe_cmd * mb_autoexec_append_safe_cmd
* mb_autoexec_write_default * mb_autoexec_write_default
* mb_autoexec_open_gui40 * mb_autoexec_show_gui40
* mb_autoexec_open_gui40_mouse * mb_autoexec_show_gui40_mouse
* mb_autoexec_open_gui80 * mb_autoexec_show_gui80
* mb_autoexec_open_gui80_mouse * mb_autoexec_show_gui80_mouse
* mb_autoexec_safe_cmd * mb_autoexec_safe_cmd
* mb_autoexec_safe_test * mb_autoexec_safe_test
* mb_msxhub_file * mb_msxhub_file
@ -163,6 +165,7 @@ Current set is WIP.
## Errata ## Errata
* Imported folders in openMSX; `cd utils;cd ..;dir` breaks, use `cd utils:cd a:\;dir` as workaround * Imported folders in openMSX; `cd utils;cd ..;dir` breaks, use `cd utils:cd a:\;dir` as workaround
* Saving screenshots sometimes lets openMSX segfaults
* Doesn't work on windows * Doesn't work on windows
* Missing C and mixed support * Missing C and mixed support
* If no SDL than screenshot in fail_after doesn't work * If no SDL than screenshot in fail_after doesn't work

View file

@ -16,20 +16,25 @@ endef
define mb_autoexec_append_rem define mb_autoexec_append_rem
$(call mb_autoexec_append_cmd,$(1),rem $(2)) $(call mb_autoexec_append_cmd,$(1),rem $(2))
endef endef
define mb_autoexec_append_gui_mode define mb_autoexec_append_show_gui
$(call mb_autoexec_append_echo,$(1),Enabling boot GUI mode.) $(call mb_autoexec_append_cmd,$(1),omsxctl boot_mode_show_gui)
$(call mb_autoexec_append_cmd,$(1),omsxctl after time 1 boot_gui_mode)
endef endef
define mb_autoexec_append_stop_fail define mb_autoexec_append_stop_fail
$(call mb_autoexec_append_echo,$(1),Disabling automatic failure.)
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after 0) $(call mb_autoexec_append_cmd,$(1),omsxctl fail_after 0)
endef endef
define mb_autoexec_append_exit define mb_autoexec_append_exit
$(call mb_autoexec_append_cmd,$(1),omsxctl exit 0) $(if $(filter on,$(MB_FLIGHT_SCREEN)),$(call mb_autoexec_append_save_screenshot,$(1)))
$(call mb_autoexec_append_cmd,$(1),omsxctl boot_exec_exit)
endef endef
define mb_autoexec_append_joyporta_mouse define mb_autoexec_append_joyporta_mouse
$(call mb_autoexec_append_cmd,$(1),omsxctl plug joyporta mouse) $(call mb_autoexec_append_cmd,$(1),omsxctl plug joyporta mouse)
endef endef
define mb_autoexec_append_save_screenshot
$(call mb_autoexec_append_cmd,$(1),omsxctl save_flight_screenshot $(2))
endef
define mb_autoexec_append_save_video
$(call mb_autoexec_append_cmd,$(1),omsxctl save_flight_video $(2))
endef
define mb_autoexec_append_safe_test define mb_autoexec_append_safe_test
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(if $(3),$(3),$(MB_AUTOEXEC_TEST_TIMEOUT)) seconds failed_test $(if $(4),$(4),$(MB_AUTOEXEC_TEST_EXITCODE))) $(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(if $(3),$(3),$(MB_AUTOEXEC_TEST_TIMEOUT)) seconds failed_test $(if $(4),$(4),$(MB_AUTOEXEC_TEST_EXITCODE)))
$(call mb_autoexec_append_echo,$(1),Running test: $(2)) $(call mb_autoexec_append_echo,$(1),Running test: $(2))
@ -43,40 +48,41 @@ endef
define mb_autoexec_write_default define mb_autoexec_write_default
@echo === Writing autoexec.bat for $(notdir $(1)) @echo === Writing autoexec.bat for $(notdir $(1))
@echo -n "" > $(1)/autoexec.bat @echo -n "" > $(1)/autoexec.bat
$(call mb_autoexec_append_cmd,$(1),omsxctl setcolor 4 000)
$(call mb_autoexec_append_cmd,$(1),omsxctl setcolor 15 777)
$(if $(filter 40,$(2)),$(call mb_autoexec_append_cmd,$(1),mode 40),$(call mb_autoexec_append_cmd,$(1),mode 80)) $(if $(filter 40,$(2)),$(call mb_autoexec_append_cmd,$(1),mode 40),$(call mb_autoexec_append_cmd,$(1),mode 80))
$(if $(filter 40,$(2)),$(call mb_autoexec_append_echo,$(1),Enabled mode 40.),$(call mb_autoexec_append_echo,$(1),Enabled mode 80.)) $(call mb_autoexec_append_echo,$(1),==== MSXBUILD ====)
$(if $(filter 40,$(2)),$(call mb_autoexec_append_echo,$(1),Boot mode 40),$(call mb_autoexec_append_echo,$(1),Boot mode 80))
$(if $(filter on,$(MB_FLIGHT_VIDEO)),$(call mb_autoexec_append_save_video,$(1)))
$(call mb_autoexec_append_cmd,$(1),omsxctl boot_exec_color_dark)
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(MB_AUTOEXEC_STARTUP_TIMEOUT) seconds failed_exec $(MB_AUTOEXEC_STARTUP_EXITCODE)) $(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(MB_AUTOEXEC_STARTUP_TIMEOUT) seconds failed_exec $(MB_AUTOEXEC_STARTUP_EXITCODE))
$(if $(filter on,$(MB_AUTOEXEC_VERSION)),$(call mb_autoexec_append_cmd,$(1),ver)) $(if $(filter on,$(MB_AUTOEXEC_VERSION)),$(call mb_autoexec_append_cmd,$(1),ver))
$(if $(filter on,$(MB_AUTOEXEC_VERSION)),$(call mb_autoexec_append_cmd,$(1),omsxctl machine_info config_name))
$(if $(filter on,$(MB_AUTOEXEC_VERSION)),$(call mb_autoexec_append_cmd,$(1),omsxctl openmsx_info version))
$(if $(wildcard $(1)/utils),$(call mb_autoexec_append_cmd,$(1),PATH + A:\)) $(if $(wildcard $(1)/utils),$(call mb_autoexec_append_cmd,$(1),PATH + A:\))
$(if $(wildcard $(1)/utils),$(call mb_autoexec_append_cmd,$(1),PATH + A:\UTILS)) $(if $(wildcard $(1)/utils),$(call mb_autoexec_append_cmd,$(1),PATH + A:\UTILS))
$(if $(wildcard $(1)/utils),$(call mb_autoexec_append_cmd,$(1),PATH)) $(if $(wildcard $(1)/utils),$(call mb_autoexec_append_cmd,$(1),PATH))
$(call mb_autoexec_append_echo,$(1),Run msxbuild: $(notdir $(1))) $(if $(filter on,$(MB_AUTOEXEC_VERSION)),$(call mb_autoexec_append_cmd,$(1),omsxctl boot_exec_config_info))
$(call mb_autoexec_append_echo,$(1),Run folder $(1))
$(call mb_autoexec_append_echo,$(1),Run target $@)
endef endef
define _mb_autoexec_open_gui define _mb_autoexec_show_gui
$(call mb_autoexec_write_default,$(1),$(2)) $(call mb_autoexec_write_default,$(1),$(2))
$(call mb_autoexec_append_stop_fail,$(1)) $(call mb_autoexec_append_stop_fail,$(1))
$(call mb_autoexec_append_gui_mode,$(1)) $(call mb_autoexec_append_show_gui,$(1))
$(if $(filter mouse,$(4)),$(call mb_autoexec_append_joyporta_mouse,$(1))) $(if $(filter mouse,$(4)),$(call mb_autoexec_append_joyporta_mouse,$(1)))
$(call mb_autoexec_append_echo,$(1),Type shutdown to stop emulation.) $(call mb_autoexec_append_echo,$(1),Type shutdown to stop emulation)
$(if $(3),$(call mb_autoexec_append_echo,$(1),Running command: $(3))) $(if $(3),$(call mb_autoexec_append_echo,$(1),Running command: $(3)))
$(if $(3),$(call mb_autoexec_append_cmd,$(1),$(3))) $(if $(3),$(call mb_autoexec_append_cmd,$(1),$(3)))
endef endef
define mb_autoexec_open_gui40 define mb_autoexec_show_gui40
$(call _mb_autoexec_open_gui,$(1),40,$(2)) $(call _mb_autoexec_show_gui,$(1),40,$(2))
endef endef
define mb_autoexec_open_gui40_mouse define mb_autoexec_show_gui40_mouse
$(call _mb_autoexec_open_gui,$(1),40,$(2),mouse) $(call _mb_autoexec_show_gui,$(1),40,$(2),mouse)
endef endef
define mb_autoexec_open_gui80 define mb_autoexec_show_gui80
$(call _mb_autoexec_open_gui,$(1),80,$(2)) $(call _mb_autoexec_show_gui,$(1),80,$(2))
endef endef
define mb_autoexec_open_gui80_mouse define mb_autoexec_show_gui80_mouse
$(call _mb_autoexec_open_gui,$(1),80,$(2),mouse) $(call _mb_autoexec_show_gui,$(1),80,$(2),mouse)
endef endef
define mb_autoexec_safe_cmd define mb_autoexec_safe_cmd

View file

@ -1,5 +1,4 @@
MB_OPENMSX_PATH_BIN ?= bin
MB_OPENMSX_BOOT_TIMEOUT ?= 25 MB_OPENMSX_BOOT_TIMEOUT ?= 25
MB_OPENMSX_BOOT_OS ?= nextor MB_OPENMSX_BOOT_OS ?= nextor
MB_OPENMSX_MACHINE ?= Philips_NMS_8250 MB_OPENMSX_MACHINE ?= Philips_NMS_8250
@ -13,7 +12,6 @@ MB_OPENMSX_SCALE_FACTOR ?= 3
MB_OPENMSX_THROTTLE ?= off MB_OPENMSX_THROTTLE ?= off
MB_OPENMSX_HEADLESS ?= on MB_OPENMSX_HEADLESS ?= on
MB_OPENMSX_RENDERER ?= SDL MB_OPENMSX_RENDERER ?= SDL
MB_OPENMSX_RECORDER ?= off
MB_OPENMSX_CTLCACHE ?= $(MB_CACHE)/msxbuild/omsxctl MB_OPENMSX_CTLCACHE ?= $(MB_CACHE)/msxbuild/omsxctl
define mb_openmsx_setup define mb_openmsx_setup
@ -25,9 +23,11 @@ define mb_openmsx_setup
$(if $(wildcard $(1)-omsx/share),,$(call mb_mkdir,$(1)-omsx/share)) $(if $(wildcard $(1)-omsx/share),,$(call mb_mkdir,$(1)-omsx/share))
$(if $(wildcard $(1)-omsx/share/settings.xml),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/settings.xml,$(1)-omsx/share)) $(if $(wildcard $(1)-omsx/share/settings.xml),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/settings.xml,$(1)-omsx/share))
$(if $(wildcard $(1)-omsx/share/scripts),,$(call mb_mkdir,$(1)-omsx/share/scripts)) $(if $(wildcard $(1)-omsx/share/scripts),,$(call mb_mkdir,$(1)-omsx/share/scripts))
$(if $(wildcard $(1)-omsx/share/scripts/boot_env.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/boot_env.tcl,$(1)-omsx/share/scripts)) $(if $(wildcard $(1)-omsx/share/scripts/boot_exec.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/boot_exec.tcl,$(1)-omsx/share/scripts))
$(if $(wildcard $(1)-omsx/share/scripts/boot_hdd.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/boot_hdd.tcl,$(1)-omsx/share/scripts)) $(if $(wildcard $(1)-omsx/share/scripts/boot_hdd.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/boot_hdd.tcl,$(1)-omsx/share/scripts))
$(if $(wildcard $(1)-omsx/share/scripts/boot_mode.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/boot_mode.tcl,$(1)-omsx/share/scripts))
$(if $(wildcard $(1)-omsx/share/scripts/fail_after.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/fail_after.tcl,$(1)-omsx/share/scripts)) $(if $(wildcard $(1)-omsx/share/scripts/fail_after.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/fail_after.tcl,$(1)-omsx/share/scripts))
$(if $(wildcard $(1)-omsx/share/scripts/save_flight.tcl),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/scripts/save_flight.tcl,$(1)-omsx/share/scripts))
$(if $(wildcard $(1)-omsx/share/scripts/omsxctl.tcl),,$(call mb_copy,$(MB_OPENMSX_CTLCACHE)/omsxctl.tcl,$(1)-omsx/share/scripts)) $(if $(wildcard $(1)-omsx/share/scripts/omsxctl.tcl),,$(call mb_copy,$(MB_OPENMSX_CTLCACHE)/omsxctl.tcl,$(1)-omsx/share/scripts))
$(if $(wildcard $(1)-omsx/share/extensions),,$(call mb_mkdir,$(1)-omsx/share/extensions)) $(if $(wildcard $(1)-omsx/share/extensions),,$(call mb_mkdir,$(1)-omsx/share/extensions))
$(if $(wildcard $(1)-omsx/share/extensions/ide-nextor.xml),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/extensions/ide-nextor.xml,$(1)-omsx/share/extensions)) $(if $(wildcard $(1)-omsx/share/extensions/ide-nextor.xml),,$(call mb_copy,$(PATH_MSXBUILD_REAL)/lib/openmsx/share/extensions/ide-nextor.xml,$(1)-omsx/share/extensions))
@ -38,8 +38,7 @@ endef
define _mb_openmsx_run define _mb_openmsx_run
@echo === openMSX Start for $(notdir $(1)) @echo === openMSX Start for $(notdir $(1))
FAIL_AFTER_BOOT=$(MB_OPENMSX_BOOT_TIMEOUT) \ BOOT_WATCHDOG=$(MB_OPENMSX_BOOT_TIMEOUT) \
FAIL_AFTER_PATH=$(MB_OPENMSX_PATH_BIN) \
BOOT_HDD_PATH="$(1)" \ BOOT_HDD_PATH="$(1)" \
BOOT_HDD_SIZE=$(MB_OPENMSX_HDD_SIZE) \ BOOT_HDD_SIZE=$(MB_OPENMSX_HDD_SIZE) \
BOOT_HDD_IMAGE="$(1)-omsx/persistent/ide-nextor/untitled1/hd.dsk" \ BOOT_HDD_IMAGE="$(1)-omsx/persistent/ide-nextor/untitled1/hd.dsk" \
@ -48,7 +47,9 @@ define _mb_openmsx_run
HEADLESS=$(MB_OPENMSX_HEADLESS) \ HEADLESS=$(MB_OPENMSX_HEADLESS) \
RENDERER=$(MB_OPENMSX_RENDERER) \ RENDERER=$(MB_OPENMSX_RENDERER) \
THROTTLE=$(MB_OPENMSX_THROTTLE) \ THROTTLE=$(MB_OPENMSX_THROTTLE) \
RECORDER=$(if $(filter on,$(MB_OPENMSX_RECORDER)),msxbuild-) \ SAVE_FLIGHT_PREFIX=$(MB_FLIGHT_PREFIX) \
SAVE_FLIGHT_SEPERATOR=$(MB_FLIGHT_SEPERATOR) \
SAVE_FLIGHT_RECORD_FLAG=$(MB_FLIGHT_RECORD_FLAG) \
OPENMSX_HOME="$(1)-omsx" \ OPENMSX_HOME="$(1)-omsx" \
$(PATH_OPENMSX)/openmsx \ $(PATH_OPENMSX)/openmsx \
-machine $(2) \ -machine $(2) \

View file

@ -5,8 +5,15 @@
# Setup default tools paths # Setup default tools paths
PATH_SDCC ?= /usr/bin PATH_SDCC ?= /usr/bin
PATH_OPENMSX ?= /usr/bin PATH_OPENMSX ?= /usr/bin
# Fill other defaults
PATH_MSXBUILD ?= $(dir $(lastword $(MAKEFILE_LIST)))../.. PATH_MSXBUILD ?= $(dir $(lastword $(MAKEFILE_LIST)))../..
PATH_MSXBUILD_REAL := $(if $(realpath $(PATH_MSXBUILD)),$(realpath $(PATH_MSXBUILD)),$(PATH_MSXBUILD)) PATH_MSXBUILD_REAL := $(if $(realpath $(PATH_MSXBUILD)),$(realpath $(PATH_MSXBUILD)),$(PATH_MSXBUILD))
MB_FLIGHT_SCREEN ?= off
MB_FLIGHT_VIDEO ?= off
MB_FLIGHT_PREFIX ?= msxbuild
MB_FLIGHT_SEPERATOR ?= -
MB_FLIGHT_RECORD_FLAG ?= -doublesize
# OS cmds # OS cmds
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)

View file

@ -0,0 +1,33 @@
# boot_exec -- Helper command to autoexec.bat boot scripts.
#
# Adds the following command to openMSX;
#
# 'boot_exec_exit'
# Requested delayed shutdown of openMSX.
# (as workaround for segfault when screenshot is not ready yet)
#
# 'boot_exec_color_dark'
# Sets the VDP colors to dark color tones.
#
# 'boot_exec_config_info'
# Displays machine and openMSX version on one line.
#
proc boot_exec_exit {} {
after time 1 "exit 0"
return "Shutdown openMSX"
}
proc boot_exec_color_dark {} {
setcolor 4 000
setcolor 15 777
return "Boot color dark"
}
proc boot_exec_config_info {} {
set result "Run machine "
append result [machine_info config_name]
append result " on "
append result [openmsx_info version]
return $result
}

View file

@ -35,7 +35,6 @@
# The number of partitions created in the disk image, defaults to 1. # The number of partitions created in the disk image, defaults to 1.
# #
# per default create msxdos1 compatible partition size.
set boot_hdd_size 15m set boot_hdd_size 15m
set boot_hdd_image hdd.dsk set boot_hdd_image hdd.dsk
set boot_hdd_path_import 0 set boot_hdd_path_import 0
@ -44,7 +43,6 @@ set boot_hdd_export_partition 0
set boot_hdd_export_dir \\ set boot_hdd_export_dir \\
set boot_hdd_partitions 1 set boot_hdd_partitions 1
# Parse env settings
if {[info exists ::env(BOOT_HDD_SIZE)] && ([string trim $::env(BOOT_HDD_SIZE)] != "")} { if {[info exists ::env(BOOT_HDD_SIZE)] && ([string trim $::env(BOOT_HDD_SIZE)] != "")} {
set boot_hdd_size [string trim $::env(BOOT_HDD_SIZE)] set boot_hdd_size [string trim $::env(BOOT_HDD_SIZE)]
} }

View file

@ -1,10 +1,10 @@
# boot_env -- Sets various openMSX settings based from environment variables. # boot_mode -- Controls the boot mode config of openMSX from environment variables.
# #
# Typically used in automation tools which run openMSX without human interaction. # Typically used in automation tools which run openMSX without human interaction.
# #
# Adds the following command to openMSX; # Adds the following command to openMSX;
# #
# 'boot_gui_mode' # 'boot_mode_show_gui'
# Enables the renderer and throttle from the inside. # Enables the renderer and throttle from the inside.
# #
# Supported environment variables by this script; # Supported environment variables by this script;
@ -13,38 +13,34 @@
# Override video output from command line. # Override video output from command line.
# #
# RENDERER=SDL # RENDERER=SDL
# Select video renderer type for gui mode or in none headless mode. # Select video renderer type for GUI mode or in none headless mode.
# #
# SCALE_FACTOR=3 # SCALE_FACTOR=3
# Override video scale factor for SDL renderer. # Override video scale factor for the renderer.
# #
# THROTTLE=off # THROTTLE=off
# Disables msx speed emulation. # Disables MSX speed emulation.
# #
# SPEED=400 # SPEED=333
# Sets msx speed to 4x of original but only when throttle is on. # Sets CPU speed to relative from normal but only when throttle is on.
#
# RECORDER=bin/output.avi
# Enables the the video recorder.
# #
# Enabled openMSX gui from inside set boot_env_renderer_type 0
proc boot_gui_mode {} {
proc boot_mode_show_gui {} {
global renderer global renderer
global throttle global throttle
global boot_env_renderer_type global boot_env_renderer_type
if {$boot_env_renderer_type != 0} { if {$boot_env_renderer_type != 0} {
set renderer $boot_env_renderer_type after time 1 "set renderer $boot_env_renderer_type"
set throttle on set throttle on
} else { } else {
puts stderr "error: Requested boot_gui_mode but env.RENDERER is missing." puts stderr "error: Requested boot_gui_mode but env.RENDERER is missing."
exit 1 exit 1
} }
return "Requested GUI with $boot_env_renderer_type"
} }
# Globals
set boot_env_renderer_type 0
if {[info exists ::env(RENDERER)] && ([string trim $::env(RENDERER)] != "")} { if {[info exists ::env(RENDERER)] && ([string trim $::env(RENDERER)] != "")} {
set boot_env_renderer_type [string trim $::env(RENDERER)] set boot_env_renderer_type [string trim $::env(RENDERER)]
} }
@ -76,13 +72,3 @@ if {[info exists ::env(SPEED)] && ([string trim $::env(SPEED)] != "")} {
exit 1 exit 1
} }
} }
if {[info exists ::env(RECORDER)] && ([string trim $::env(RECORDER)] != "")} {
if {[catch {after time 1 "record start -prefix [string trim $::env(RECORDER)]"} err_msg]} {
puts stderr "error: env.RECORDER value $err_msg"
exit 1
}
after quit {
record stop
}
}

View file

@ -17,21 +17,19 @@
# #
# Supported environment variables by this script; # Supported environment variables by this script;
# #
# FAIL_AFTER_PATH=. # BOOT_WATCHDOG=30
# Enabled automatic screenshots saving in case of failures in the supplied path.
#
# FAIL_AFTER_BOOT=30
# Enables the boot watchdog timer which will exit openMSX after the timeout(in seconds). # 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. # 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}} { proc fail_after_exit {{fail_id "fail_after_exit"} {fail_code 2}} {
global fail_after_path if {[catch {screenshot -prefix $fail_id} err_msg]} {
if {$fail_after_path != 0} { puts stderr "warning: $err_msg"
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 }
} }
puts stderr "error: Failure request from $fail_id" puts stderr "error: Failure request from $fail_id"
exit $fail_code exit $fail_code
@ -43,7 +41,7 @@ proc fail_after { timeout {time_unit "time"} {fail_id "fail_after"} {fail_code 2
set msg "" set msg ""
if {$fail_after_prev_timer != 0} { if {$fail_after_prev_timer != 0} {
after cancel $fail_after_prev_timer 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 set fail_after_prev_id $fail_id
if {$time_unit != "time"} { if {$time_unit != "time"} {
@ -69,19 +67,7 @@ proc fail_after_reboot_watchdog {} {
} }
} }
# Globals if {[info exists ::env(BOOT_WATCHDOG)] && ([string trim $::env(BOOT_WATCHDOG)] != "")} {
set fail_after_prev_timer 0 set fail_after_boot_timeout [string trim $::env(BOOT_WATCHDOG)]
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)]
fail_after_reboot_watchdog fail_after_reboot_watchdog
} }

View file

@ -0,0 +1,63 @@
# safe_flight -- Setup the black box flight recorder for build pipelines.
#
# Adds the following command to openMSX;
#
# 'save_flight_screenshot'
# Takes an screenshot with optional prefix parameter.
#
# 'save_flight_video'
# Starts video recording with optional prefix parameter.
#
# Supported environment variables by this script;
#
# SAVE_FLIGHT_PREFIX=msxbuild
# Gives screenshots and videos an prefix; msxbuild0001.avi
#
# SAVE_FLIGHT_SEPERATOR=-
# Gives screenshots and videos an seperator; openmsx-0001.png
#
# SAVE_FLIGHT_RECORD_FLAG=-doublesize
# Flag given to the video record command.
#
set save_flight_prefix flight
set save_flight_seperator -
set save_flight_record_flag ""
proc save_flight_screenshot {{prefix_id 0}} {
global save_flight_prefix
global save_flight_seperator
if {$prefix_id != 0} {
set file_prefix "$prefix_id$save_flight_seperator"
} else {
set file_prefix "$save_flight_prefix$save_flight_seperator"
}
after time 1 "screenshot -prefix $file_prefix"
return "Flight screenshot saved"
}
proc save_flight_video {{prefix_id 0}} {
global save_flight_prefix
global save_flight_seperator
global save_flight_record_flag
if {$prefix_id != 0} {
set file_prefix "$prefix_id$save_flight_seperator"
} else {
set file_prefix "$save_flight_prefix$save_flight_seperator"
}
after quit "record stop"
after time 1 "record start $save_flight_record_flag -prefix $file_prefix"
return "Flight video started"
}
if {[info exists ::env(SAVE_FLIGHT_PREFIX)] && ([string trim $::env(SAVE_FLIGHT_PREFIX)] != "")} {
set save_flight_prefix [string trim $::env(SAVE_FLIGHT_PREFIX)]
}
if {[info exists ::env(SAVE_FLIGHT_SEPERATOR)] && ([string trim $::env(SAVE_FLIGHT_SEPERATOR)] != "")} {
set save_flight_seperator [string trim $::env(SAVE_FLIGHT_SEPERATOR)]
}
if {[info exists ::env(SAVE_FLIGHT_RECORD_FLAG)] && ([string trim $::env(SAVE_FLIGHT_RECORD_FLAG)] != "")} {
set save_flight_record_flag [string trim $::env(SAVE_FLIGHT_RECORD_FLAG)]
}

View file

@ -25,7 +25,7 @@ $(TEST_AHELLO_M80)/ahello.com: $(TEST_AHELLO_M80)/ahello.hex
.PHONY: test-ahello-m80-run .PHONY: test-ahello-m80-run
test-ahello-m80-run: $(TEST_AHELLO_M80)/ahello.com test-ahello-m80-run: $(TEST_AHELLO_M80)/ahello.com
$(call mb_autoexec_open_gui80,$(TEST_AHELLO_M80)) $(call mb_autoexec_show_gui80,$(TEST_AHELLO_M80))
$(call mb_openmsx_dosctl,$(TEST_AHELLO_M80)) $(call mb_openmsx_dosctl,$(TEST_AHELLO_M80))
.PHONY: test-ahello-m80-assert .PHONY: test-ahello-m80-assert

View file

@ -16,7 +16,7 @@ $(TEST_AHELLO_SDCC)/ahello.com: $(TEST_AHELLO_SDCC)/ahello.hex
.PHONY: test-ahello-sdcc-run .PHONY: test-ahello-sdcc-run
test-ahello-sdcc-run: $(TEST_AHELLO_SDCC)/ahello.com test-ahello-sdcc-run: $(TEST_AHELLO_SDCC)/ahello.com
$(call mb_autoexec_open_gui80,$(TEST_AHELLO_SDCC)) $(call mb_autoexec_show_gui80,$(TEST_AHELLO_SDCC))
$(call mb_openmsx_dosctl,$(TEST_AHELLO_SDCC)) $(call mb_openmsx_dosctl,$(TEST_AHELLO_SDCC))
.PHONY: test-ahello-sdcc-assert .PHONY: test-ahello-sdcc-assert

View file

@ -12,7 +12,7 @@ $(TEST_DIST_QA_DOS1)/%: bin/test/dist/% | $(TEST_DIST_QA_DOS1) $(TEST_DIST_DEPS)
.PHONY: test-dist-qa-dos1-run .PHONY: test-dist-qa-dos1-run
test-dist-qa-dos1-run: | $(TEST_DIST_QA_DOS1_DEPS) test-dist-qa-dos1-run: | $(TEST_DIST_QA_DOS1_DEPS)
$(call mb_autoexec_open_gui80,$(TEST_DIST_QA_DOS1)) $(call mb_autoexec_show_gui80,$(TEST_DIST_QA_DOS1))
$(call mb_openmsx_dosctl,$(TEST_DIST_QA_DOS1)) $(call mb_openmsx_dosctl,$(TEST_DIST_QA_DOS1))
.PHONY: test-dist-qa-dos1-assert .PHONY: test-dist-qa-dos1-assert

View file

@ -12,7 +12,7 @@ $(TEST_DIST_QA_DOS2)/%: bin/test/dist/% | $(TEST_DIST_QA_DOS2) $(TEST_DIST_DEPS)
.PHONY: test-dist-qa-dos2-run .PHONY: test-dist-qa-dos2-run
test-dist-qa-dos2-run: | $(TEST_DIST_QA_DOS2_DEPS) test-dist-qa-dos2-run: | $(TEST_DIST_QA_DOS2_DEPS)
$(call mb_autoexec_open_gui80,$(TEST_DIST_QA_DOS2)) $(call mb_autoexec_show_gui80,$(TEST_DIST_QA_DOS2))
$(call mb_openmsx_dosctl,$(TEST_DIST_QA_DOS2)) $(call mb_openmsx_dosctl,$(TEST_DIST_QA_DOS2))
.PHONY: test-dist-qa-dos2-assert .PHONY: test-dist-qa-dos2-assert

View file

@ -12,7 +12,7 @@ $(TEST_DIST_QA_MSX1)/%: bin/test/dist/% | $(TEST_DIST_QA_MSX1) $(TEST_DIST_DEPS)
.PHONY: test-dist-qa-msx1-run .PHONY: test-dist-qa-msx1-run
test-dist-qa-msx1-run: | $(TEST_DIST_QA_MSX1_DEPS) test-dist-qa-msx1-run: | $(TEST_DIST_QA_MSX1_DEPS)
$(call mb_autoexec_open_gui40,$(TEST_DIST_QA_MSX1)) $(call mb_autoexec_show_gui40,$(TEST_DIST_QA_MSX1))
$(call mb_openmsx_dosctl,$(TEST_DIST_QA_MSX1),$(TEST_DIST_QA_MSX1_MACHINE)) $(call mb_openmsx_dosctl,$(TEST_DIST_QA_MSX1),$(TEST_DIST_QA_MSX1_MACHINE))
.PHONY: test-dist-qa-msx1-assert .PHONY: test-dist-qa-msx1-assert

View file

@ -34,7 +34,7 @@ $(TEST_DIST_QA_MSXHUB)/%: bin/test/dist/% | $(TEST_DIST_QA_MSXHUB) $(TEST_DIST_D
.PHONY: test-dist-qa-msxhub-run .PHONY: test-dist-qa-msxhub-run
test-dist-qa-msxhub-run: | $(TEST_DIST_QA_MSXHUB_DEPS) test-dist-qa-msxhub-run: | $(TEST_DIST_QA_MSXHUB_DEPS)
$(call mb_autoexec_open_gui80,$(TEST_DIST_QA_MSXHUB),dir/w utils) $(call mb_autoexec_show_gui80,$(TEST_DIST_QA_MSXHUB),dir/w utils)
$(call mb_openmsx_dosctl,$(TEST_DIST_QA_MSXHUB),$(TEST_DIST_QA_MSXHUB_MACHINE)) $(call mb_openmsx_dosctl,$(TEST_DIST_QA_MSXHUB),$(TEST_DIST_QA_MSXHUB_MACHINE))
.PHONY: test-dist-qa-msxhub-assert .PHONY: test-dist-qa-msxhub-assert