From 58781abd34772e1655b626c6d07484cdc4270459 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Thu, 12 Nov 2026 15:29:58 +0000 Subject: [PATCH] Android emulator tests: notice the emulator exiting, bound every wait, keep its log The alpha125 release run sat in "Start the emulator" for 25 minutes: the emulator had exited (no emulator among the orphans at cleanup, only adb), and `adb wait-for-device` has no limit. The step now polls the emulator process and boot_completed with time limits, prints the emulator's log and the KVM state when it fails, and the job keeps emulator.log. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/test-android.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-android.yml b/.github/workflows/test-android.yml index 4cbc6132d..37b019e38 100644 --- a/.github/workflows/test-android.yml +++ b/.github/workflows/test-android.yml @@ -153,17 +153,26 @@ jobs: echo "$sdk/emulator" >> "$GITHUB_PATH" echo "$sdk/platform-tools" >> "$GITHUB_PATH" + # Every wait has a limit, and the emulator ending is noticed: `adb wait-for-device` alone + # waited for an emulator that had already exited until the job's own limit. - name: Start the emulator shell: bash run: | + ls -l /dev/kvm + emulator -accel-check || true + adb start-server > /dev/null 2>&1 nohup emulator -avd tslang_api29_x86_64 -no-window -no-audio -no-boot-anim -no-snapshot \ - -gpu swiftshader_indirect -memory 4096 -cores 4 -accel on > emulator.log 2>&1 & - adb wait-for-device + -gpu swiftshader_indirect -memory 4096 -cores 4 -accel on < /dev/null > emulator.log 2>&1 & + pid=$! for i in $(seq 1 120); do - [ "$(adb shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')" = 1 ] && { echo "booted after about $((i * 5)) s"; exit 0; } + if ! kill -0 $pid 2>/dev/null; then + wait $pid; echo "the emulator exited (code $?) before it booted:"; cat emulator.log; exit 1 + fi + booted=$(timeout 10 adb shell getprop sys.boot_completed 2>/dev/null | tr -d '\r') + [ "$booted" = 1 ] && { echo "booted after about $((i * 5)) s"; adb devices; exit 0; } sleep 5 done - echo "the emulator did not boot in 10 minutes"; tail -50 emulator.log; exit 1 + echo "the emulator did not boot in 10 minutes:"; adb devices; tail -100 emulator.log; exit 1 - name: Run the tests on the emulator working-directory: ${{ github.workspace }}/tslang/test/android @@ -180,6 +189,8 @@ jobs: uses: actions/upload-artifact@v4 with: name: android-test-results - path: tslang/test/android/out/results.txt + path: | + tslang/test/android/out/results.txt + emulator.log retention-days: 7 if-no-files-found: ignore