feat: complete stairs exit interaction and verification
This commit is contained in:
+36
-21
@@ -14,8 +14,10 @@ fi
|
||||
|
||||
mkdir -p artifacts
|
||||
log_path="artifacts/visual-check.log"
|
||||
capture_path="artifacts/visual-check.png"
|
||||
rm -f "$capture_path"
|
||||
initial_capture_path="artifacts/visual-check.png"
|
||||
exit_capture_path="artifacts/visual-check-exit.png"
|
||||
rm -f "$initial_capture_path" "$exit_capture_path"
|
||||
: > "$log_path"
|
||||
|
||||
runner=()
|
||||
if [[ -z "${DISPLAY:-}" ]]; then
|
||||
@@ -27,23 +29,26 @@ if [[ -z "${DISPLAY:-}" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
set +e
|
||||
timeout --foreground 20s "${runner[@]}" "$GODOT_BIN" --path . -- --capture >"$log_path" 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
if (( status != 0 )); then
|
||||
echo "visual check failed: Godot exited with status $status; see $log_path" >&2
|
||||
exit "$status"
|
||||
fi
|
||||
if grep -Eq 'SCRIPT ERROR|Parse Error|^ERROR:' "$log_path"; then
|
||||
echo "visual check failed: Godot reported errors; see $log_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "$capture_path" ]]; then
|
||||
echo "visual check failed: missing capture $capture_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! python3 - "$capture_path" <<'PY'
|
||||
run_capture() {
|
||||
local label="$1"
|
||||
local capture_argument="$2"
|
||||
set +e
|
||||
timeout --foreground 20s "${runner[@]}" "$GODOT_BIN" --path . -- --"$capture_argument" >>"$log_path" 2>&1
|
||||
local status=$?
|
||||
set -e
|
||||
if (( status != 0 )); then
|
||||
echo "visual check failed: $label capture Godot exited with status $status; see $log_path" >&2
|
||||
exit "$status"
|
||||
fi
|
||||
}
|
||||
|
||||
validate_capture() {
|
||||
local capture_path="$1"
|
||||
if [[ ! -s "$capture_path" ]]; then
|
||||
echo "visual check failed: missing capture $capture_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! python3 - "$capture_path" <<'PY'
|
||||
import struct
|
||||
import sys
|
||||
|
||||
@@ -60,7 +65,17 @@ if (width, height) != (1280, 720):
|
||||
raise SystemExit(f"expected 1280x720 PNG, got {width}x{height}")
|
||||
print(f"visual capture: {path} ({width}x{height})")
|
||||
PY
|
||||
then
|
||||
echo "visual check failed: capture is not a nonempty valid PNG" >&2
|
||||
then
|
||||
echo "visual check failed: capture is not a nonempty valid PNG" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
run_capture "initial" "capture"
|
||||
run_capture "exit" "capture-exit"
|
||||
if grep -Eq 'SCRIPT ERROR|Parse Error|^ERROR:' "$log_path"; then
|
||||
echo "visual check failed: Godot reported errors; see $log_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
validate_capture "$initial_capture_path"
|
||||
validate_capture "$exit_capture_path"
|
||||
|
||||
Reference in New Issue
Block a user