diff --git a/Makefile b/Makefile index 2837cfd..68b259a 100644 --- a/Makefile +++ b/Makefile @@ -416,7 +416,9 @@ test/macos-sh: build/check_makefile \ osascript -e 'tell app "Terminal" to activate' osascript -e 'tell app "Terminal" to do script "'"$$PWD"'/os.bat"' sleep 5 + (date +%n && sleep 0.2 && date +%n) || true screencapture deploy-screenshots/screencapture-os-bat.png + ./utils/gui-wrapper-mac.sh 1024x768x24 ./test/gui-sh-mac.sh ${os_filename} # See https://wiki.osdev.org/EFI#Emulation to emulate an UEFI system with qemu, to test the EFI boot from hdd / cd / fd (?). diff --git a/test/gui-sh-mac.sh b/test/gui-sh-mac.sh new file mode 100755 index 0000000..cd122f8 --- /dev/null +++ b/test/gui-sh-mac.sh @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +if test $# -ne 1 || test "$1" = '-h' -o "$1" = '--help'; then + echo "Usage: $0 operating_system_file" +fi +# Force the path to be relative or absolute, but with at least one / +# Otherwise, the command will be searched in the $PATH, instead of using the +# given file. +os_filename="$(dirname "$1")/$(basename "$1")" + +osascript -e 'tell app "Terminal" to activate' +osascript -e 'tell app "Terminal" to do script "'"$PWD"'/os.bat"' & +pid=$! +runsikulix -r test/check-gui-sh.sikuli && exitcode=$? || exitcode=$? + +screencapture "./deploy-screenshots/$(basename "$0" .sh).png" + +kill $pid + +exit $exitcode diff --git a/utils/screenshots-loop.sh b/utils/screenshots-loop.sh index 6a20b27..c13f9fe 100755 --- a/utils/screenshots-loop.sh +++ b/utils/screenshots-loop.sh @@ -2,17 +2,29 @@ set -e -if test $# -ne 1 || test "$1" = "-h" -o "$1" = "--help"; then - echo "Usage: $0 path/to/screenshots/directory" +usage() { + echo "Usage: $0 {x11|mac} path/to/screenshots/directory" +} + +if test $# -ne 2 || test "$1" = "-h" -o "$1" = "--help"; then + usage exit 1 fi -screenshots_dir="$1" +platform="$1" +screenshots_dir="$2" + +case $platform in + x11) screenshot_tool=scrot;; + mac) screenshot_tool=screencapture;; + *) usage; exit 1;; +esac + for i in `seq 100`; do if test -e "$screenshots_dir/stop-screenshots"; then break fi - scrot "$screenshots_dir/$(printf %03d.png $i)" || break + "$screenshot_tool" "$screenshots_dir/$(printf %03d.png $i)" || break sleep 0.2 done