From 207c67d1da16ffb0adc734bf1e0c278a4b122840 Mon Sep 17 00:00:00 2001 From: bherbruck Date: Sun, 18 Oct 2026 18:10:49 -0400 Subject: [PATCH] Flatpak smoke test: wait for the viewport before the Wayland probe (#2736) The control port opens before the first frame, so a single ui.inspect sometimes returned no viewport and the check failed within seconds. The probe now polls ui.inspect until the viewport exists, for up to 60 s, and fails with the last reply if it never does. Co-authored-by: Claude Sonnet 5.5 --- packaging/linux/flatpak-smoke.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packaging/linux/flatpak-smoke.py b/packaging/linux/flatpak-smoke.py index 7b360f73e..303a37fec 100644 --- a/packaging/linux/flatpak-smoke.py +++ b/packaging/linux/flatpak-smoke.py @@ -47,7 +47,18 @@ for ((attempt=0; attempt<300; attempt++)); do sleep .1 done test "$ready" = 1 -for request in "{\"id\":1,\"method\":\"ui.inspect\",\"params\":{},\"token\":\"$SOLIDCRAFT_CONTROL_TOKEN\"}" '{"id":2,"method":"engine.execute","params":{"command":"solid.box","params":{"length":30,"width":20,"height":10}}}' '{"id":3,"method":"document.inspect","params":{"measure":true}}'; do +# The control port opens before the first frame, so ui.inspect has no viewport yet; poll until it does. +inspect="{\"id\":1,\"method\":\"ui.inspect\",\"params\":{},\"token\":\"$SOLIDCRAFT_CONTROL_TOKEN\"}" +deadline=$((SECONDS + 60)) +until printf '%s\n' "$inspect" >&3 && IFS= read -r -t 30 reply <&3 && [[ "$reply" =~ \"viewport\":\ *\[ ]]; do + if ! kill -0 "$app" 2>/dev/null || ((SECONDS >= deadline)); then + echo "viewport never appeared: ${reply:-no reply}" >&2 + exit 1 + fi + sleep .25 +done +printf '%s\n' "$reply" +for request in '{"id":2,"method":"engine.execute","params":{"command":"solid.box","params":{"length":30,"width":20,"height":10}}}' '{"id":3,"method":"document.inspect","params":{"measure":true}}'; do printf '%s\n' "$request" >&3 IFS= read -r -t 30 reply <&3 printf '%s\n' "$reply"