Files
sync_replay_project/tool/smoke_linux.sh
T
foxyzandClaude Opus 5.5 e16cf50f2c
ci / core (push) Successful in 28s
ci / server (push) Successful in 51s
ci / updater-windows (push) Successful in 6m27s
Windows: every start ended itself after 3 s (1.3.0, 1.3.1)
Win32Window::Create calls Destroy() before it makes the window, which
ran FlutterWindow::OnDestroy and armed the 3 s exit timer at launch: the
window showed, then the process ended with code 0, no crash, no close
lines. The timer is only armed with an engine to tear down. Found and
fixed by Fun Maker's agent on Windows (a debugger caught the exit on the
timer's thread).

The smoke runs missed it (they closed at ~4 s anyway): the app now stays
up 10 s, and the scripts require 'closing' and 'quitting' from its own
close.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 02:04:55 +03:00

42 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# The close smoke run of tool/smoke_windows.ps1 on Linux (the same app
# mode, apps/desktop/lib/src/platform/smoke.dart): start the release
# bundle with a short clip, open it, play, close; check it exited within
# LIMIT seconds and left no process. Needs a display (skips without one).
# Usage (after `flutter build linux --release`): tool/smoke_linux.sh [LIMIT]
set -euo pipefail
LIMIT="${1:-45}"
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
EXE="$ROOT/apps/desktop/build/linux/x64/release/bundle/starsync"
[[ -x "$EXE" ]] || { echo "build first: $EXE missing" >&2; exit 1; }
if [[ -z "${DISPLAY:-}${WAYLAND_DISPLAY:-}" ]]; then echo "skipped: no display"; exit 0; fi
WORK="$(mktemp -d)"; trap 'rm -rf "$WORK"' EXIT
MEDIA="$WORK/smoke.mp4"
ffmpeg -y -v error -f lavfi -i testsrc2=size=320x180:rate=24 -f lavfi -i sine=frequency=440 \
-t 5 -c:v libx264 -preset ultrafast -pix_fmt yuv420p -c:a aac "$MEDIA"
OUT="$WORK/smoke.txt"
start=$(date +%s)
STARSYNC_PROFILE=smoke STARSYNC_SMOKE="$MEDIA" STARSYNC_SMOKE_OUT="$OUT" "$EXE" >"$WORK/stdout.txt" 2>&1 &
pid=$!
exited=0
for _ in $(seq $((LIMIT * 10))); do
if ! kill -0 "$pid" 2>/dev/null; then exited=1; break; fi
sleep 0.1
done
secs=$(( $(date +%s) - start ))
steps="$(tr '\n' '|' < "$OUT" 2>/dev/null || true)"
echo "smoke steps: $steps (after $secs s)"
grep -E 'smoke:|close:|mpv: render' "$WORK/stdout.txt" | tail -20 || true
if [[ $exited == 0 ]]; then kill -9 "$pid" 2>/dev/null || true; fi
left="$(pgrep -f "$EXE" || true)"
[[ -n "$left" ]] && kill -9 $left 2>/dev/null || true
grep -qx start "$OUT" 2>/dev/null || { [[ $exited == 1 ]] && { echo "skipped: the app never came up"; exit 0; }; echo "did not come up nor exit" >&2; exit 1; }
grep -q '^skip ' "$OUT" && { echo "skipped: $(grep '^skip ' "$OUT")"; exit 0; }
grep -q '^fail ' "$OUT" && { echo "smoke failed: $(grep '^fail ' "$OUT")" >&2; exit 1; }
grep -q '^opened ' "$OUT" || { echo "the media never opened" >&2; exit 1; }
grep -qx closing "$OUT" || { echo "the app ended on its own before closing" >&2; exit 1; }
grep -qx quitting "$OUT" || { echo "the close did not reach its end (killed on the way?)" >&2; exit 1; }
[[ $exited == 1 ]] || { echo "the app did not close within $LIMIT s (P32)" >&2; exit 1; }
[[ -z "$left" ]] || { echo "a starsync process was left behind (P32)" >&2; exit 1; }
echo "smoke ok: opened and closed in $secs s, no process left"