]> Cypherpunks repositories - gostls13.git/commitdiff
androidtest.bash: wait for device to be ready before using it
authorElias Naur <mail@eliasnaur.com>
Fri, 22 Feb 2019 17:35:58 +0000 (18:35 +0100)
committerElias Naur <mail@eliasnaur.com>
Fri, 22 Feb 2019 19:30:43 +0000 (19:30 +0000)
Updates #23824

Change-Id: I265e3f40192a0a4bf54f608d9408ba0cfef2b69c
Reviewed-on: https://go-review.googlesource.com/c/163457
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/androidtest.bash

index e43b89c0dcadc5957fd46589e330736f3383b466..a3784bc454bbeb156146fb9ec51a8ac2a07afe23 100755 (executable)
@@ -69,6 +69,12 @@ cp -a "${GOROOT}/test" "${FAKE_GOROOT}/"
 cp -a "${GOROOT}/lib" "${FAKE_GOROOT}/"
 cp -a "${pkgdir}" "${FAKE_GOROOT}/pkg/"
 
+# In case we're booting a device or emulator alongside androidtest.bash
+# wait for it to be ready. adb wait-for-device is not enough, we have
+# wait for sys.boot_completed.
+echo '# Waiting for android device to be ready'
+adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;'
+
 echo '# Syncing test files to android device'
 adb $GOANDROID_ADB_FLAGS shell mkdir -p /data/local/tmp/goroot
 time adb $GOANDROID_ADB_FLAGS sync data &> /dev/null