Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/scripts/run-ui-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@

set -euo pipefail

# The emulator runner waits until the emulator's output closes. Processes that outlive the emulator
# (its crashpad_handler, the Gradle daemon, the adb server) can keep it open and hold the job until
# its timeout after the tests already finished. Stop them here, with bounded waits, so the test
# result decides the step. Only on GitHub Actions: the kills are host-wide, and a local run may share
# the host with other emulators.
EMULATOR_EXIT_TIMEOUT_SECONDS=30

stop_emulator() {
./gradlew --stop > /dev/null 2>&1 || true
adb emu kill > /dev/null 2>&1 || true
local exited=false
for _ in $(seq "$EMULATOR_EXIT_TIMEOUT_SECONDS"); do
if ! pgrep -f qemu-system > /dev/null; then
exited=true
break
fi
sleep 1
done
if [[ "$exited" != true ]]; then
echo "::warning::Emulator did not exit ${EMULATOR_EXIT_TIMEOUT_SECONDS}s after emu kill; killing it."
pkill -9 -f qemu-system || true
Comment thread
ovitrif marked this conversation as resolved.
Resolved
fi
pkill -9 -f crashpad_handler || true
adb kill-server > /dev/null 2>&1 || true
}
if [[ "${GITHUB_ACTIONS:-}" == "true" ]]; then
trap stop_emulator EXIT
fi

adb wait-for-device
echo "Waiting for boot to complete..."
adb shell 'while [ -z "$(getprop sys.boot_completed)" ]; do sleep 1; done'
Expand Down
Loading