forked from OneBusAway/onebusaway-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wait_for_emulator
executable file
·29 lines (24 loc) · 971 Bytes
/
wait_for_emulator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Waits for emulator to completely boot to lock screen
# Used to run tests on Travis CI (#137)
# Originally written by Ralf Kistner <[email protected]>, but placed in the public domain
# Recommended by Travis docs - http://docs.travis-ci.com/user/languages/android/#How-to-Create-and-Start-an-Emulator
# Source (under Apache 2.0) - https://github.com/andrewhr/rxjava-android-example/blob/master/ci/wait_for_emulator
set +e
bootanim=""
failcounter=0
timeout_in_sec=360
until [[ "$bootanim" =~ "stopped" ]]; do
bootanim=`adb -e shell getprop init.svc.bootanim 2>&1 &`
if [[ "$bootanim" =~ "device not found" || "$bootanim" =~ "device offline"
|| "$bootanim" =~ "running" ]]; then
let "failcounter += 1"
echo "Waiting for emulator to start"
if [[ $failcounter -gt timeout_in_sec ]]; then
echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
exit 1
fi
fi
sleep 1
done
echo "Emulator is ready"