diff --git a/scripts/ci/run_layered_tests.sh b/scripts/ci/run_layered_tests.sh index 3a54ee3e..a6e12646 100755 --- a/scripts/ci/run_layered_tests.sh +++ b/scripts/ci/run_layered_tests.sh @@ -3,6 +3,19 @@ set -euo pipefail LAYER="${1:-all}" +# Desktop integration tests launch the real GTK app, which needs a display +# server. On a headless Linux CI runner there is none, so the app never +# establishes a debug connection ("The log reader stopped unexpectedly, or +# never started"). Wrap such commands in a virtual framebuffer when one is +# available; on macOS/local runs (no xvfb-run) the command runs unchanged. +with_display() { + if [[ "$(uname -s)" == "Linux" ]] && command -v xvfb-run >/dev/null 2>&1; then + xvfb-run -a --server-args="-screen 0 1920x1080x24" "$@" + else + "$@" + fi +} + run_flutter_base() { flutter pub get flutter analyze @@ -33,7 +46,7 @@ run_flutter_golden_if_present() { run_flutter_integration_if_present() { if [[ -d integration_test ]] && find integration_test -name '*_test.dart' | grep -q .; then - flutter test integration_test + with_display flutter test integration_test else echo "[skip] no integration tests found under integration_test" fi @@ -41,7 +54,7 @@ run_flutter_integration_if_present() { run_patrol_if_present() { if command -v patrol >/dev/null 2>&1 && [[ -d patrol_test ]] && find patrol_test -name '*_test.dart' | grep -q .; then - patrol test patrol_test + with_display patrol test patrol_test else echo "[skip] patrol not installed or patrol_test is empty" fi diff --git a/scripts/ci/setup_platform_deps.sh b/scripts/ci/setup_platform_deps.sh index be9c052c..91ecbec9 100755 --- a/scripts/ci/setup_platform_deps.sh +++ b/scripts/ci/setup_platform_deps.sh @@ -16,10 +16,12 @@ case "$platform" in pkg-config \ libx11-dev \ libgl1-mesa-dev \ + libgl1-mesa-dri \ libayatana-appindicator3-dev \ dpkg-dev \ rpm \ - imagemagick + imagemagick \ + xvfb ;; android) sudo apt-get update