android-test: headless emulator default for GUI smokes

Default EMULATOR_HEADLESS=1 (-no-window, QT offscreen) while guest GLES
still runs via SwiftShader. Auto-start AVD when no adb device; WINDOWED=1
for a host window on laptops.
This commit is contained in:
Hernâni Marques 2026-07-17 21:29:52 +02:00
parent a935f69582
commit 91b79ab807
No known key found for this signature in database
GPG key ID: CB5738652768F7E9
8 changed files with 320 additions and 59 deletions

View file

@ -20,15 +20,9 @@
#
set -euo pipefail
ROOT=$(cd "$(dirname "$0")" && pwd)
# shellcheck source=lib_android_env.sh
. "$ROOT/lib_android_env.sh"
# Platform flags (see GUI-AUTOMATION-NOTES.md). Linux default: Android only.
os=$(uname -s)
case "${AUTO_PLATFORM:-auto}" in
auto) case "$os" in Linux) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;; Darwin) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;; *) : "${AUTO_ANDROID:=0}"; : "${AUTO_GUI:=0}" ;; esac ;;
linux) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;;
macos) : "${AUTO_ANDROID:=1}"; : "${AUTO_GUI:=1}" ;;
*) : "${AUTO_ANDROID:=0}"; : "${AUTO_GUI:=0}" ;;
esac
if [ "${AUTO_ANDROID}" != "1" ]; then
echo "skipped: AUTO_ANDROID=${AUTO_ANDROID} (platform flags — see GUI-AUTOMATION-NOTES.md)"
exit 0
@ -46,28 +40,23 @@ OUT_DIR="${OUT_DIR:-$ROOT/out}"
mkdir -p "$APK_DIR" "$OUT_DIR"
if ! command -v adb >/dev/null 2>&1; then
if [ -x "$HOME/Android/Sdk/platform-tools/adb" ]; then
export PATH="$HOME/Android/Sdk/platform-tools:$PATH"
else
echo "adb missing — install android-tools-adb or user SDK platform-tools" >&2
exit 2
fi
echo "adb missing — install android-tools-adb or user SDK platform-tools" >&2
exit 2
fi
if [ -z "$SERIAL" ]; then
SERIAL=$(adb devices | awk '/\tdevice$/{print $1; exit}')
fi
if [ -z "$SERIAL" ]; then
cat >&2 <<'EOF'
No adb device. Options (no root for user-local emulator if /dev/kvm is usable):
# Default: headless AVD (no host window). WINDOWED=1 / EMULATOR_HEADLESS=0 for UI.
if ! android_ensure_device; then
cat >&2 <<EOF
No adb device. Options:
1) Plug phone with USB debugging
2) Start AVD: $HOME/Android/Sdk/emulator/emulator -avd TalerWallet34 -no-window
3) Then re-run this script
2) Headless AVD (default): $ROOT/start-android-emulator.sh --wait
3) Windowed AVD: WINDOWED=1 $ROOT/start-android-emulator.sh --wait
4) AUTO_START_EMULATOR=0 disables auto-start from this smoke
EOF
exit 3
fi
ADB=(adb -s "$SERIAL")
echo "device: $SERIAL"
echo "device: $SERIAL emulator_headless=${EMULATOR_HEADLESS} gpu=${EMULATOR_GPU}"
# Resolve stack endpoints
case "$STACK" in