Prevent waiting for NexusPlayers indefinitely

Also, I noticed that sometimes the NexusPlayers would come back up such
that adb would recognize them, but not such that the sys.boot_completed
was set to 1.  This was usually fixed by rebooting the devices again.

This code will reboot them up to three times in total before giving
up and killing the device.

BUG=skia:
TBR=borenet,rmistry
NOTREECHECKS=true
NOTRY=true

Change-Id: Ic2217855ad643ab256a598a3f55a67ba84ebcb25
Reviewed-on: https://skia-review.googlesource.com/8285
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
Kevin Lubick 2017-02-09 16:13:10 -05:00 committed by Skia Commit-Bot
parent 3d1a6bc5f3
commit 549638c852
7 changed files with 150 additions and 100 deletions

View File

@ -47,25 +47,32 @@ class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils):
# Waits for an android device to be available
def _wait_for_device(self):
self.m.python.inline('wait for device', """
self.m.run(self.m.python.inline, 'wait for device', program="""
import subprocess
import sys
import time
times = 0
kicks = 0
while kicks < 2:
while times < 30:
print 'Waiting for the device to be connected and ready.'
try:
output = subprocess.check_output(['adb', 'shell',
'getprop', 'sys.boot_completed'])
if '1' in output:
print 'Connected'
sys.exit(0)
except subprocess.CalledProcessError:
# no device connected/authorized yet
pass
time.sleep(5)
times = 0
while times < 30:
print 'Waiting for the device to be connected and ready.'
try:
times += 1
output = subprocess.check_output(['adb', 'shell',
'getprop', 'sys.boot_completed'])
if '1' in output:
print 'Connected'
sys.exit(0)
except subprocess.CalledProcessError:
# no device connected/authorized yet
pass
time.sleep(5)
print 'Giving the device a "kick" by trying to reboot it.'
kicks += 1
print subprocess.check_output(['adb', 'reboot'])
print 'Timed out waiting for device'
sys.exit(1)
@ -128,7 +135,7 @@ class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils):
def cleanup_steps(self):
if self._ever_ran_adb:
self.m.python.inline('dump log', """
self.m.run(self.m.python.inline, 'dump log', program="""
import os
import subprocess
import sys
@ -188,7 +195,8 @@ class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils):
def copy_directory_contents_to_device(self, host, device):
# Copy the tree, avoiding hidden directories and resolving symlinks.
self.m.python.inline('push %s/* %s' % (host, device), """
self.m.run(self.m.python.inline, 'push %s/* %s' % (host, device),
program="""
import os
import subprocess
import sys

View File

@ -11,7 +11,7 @@
"cmd": [
"python",
"-u",
"\nimport subprocess\nimport sys\nimport time\n\ntimes = 0\n\nwhile times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
"\nimport subprocess\nimport sys\nimport time\n\nkicks = 0\nwhile kicks < 2:\n\n times = 0\n\n while times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n times += 1\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n print 'Giving the device a \"kick\" by trying to reboot it.'\n kicks += 1\n print subprocess.check_output(['adb', 'reboot'])\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
],
"name": "wait for device",
"~followup_annotations": [
@ -20,20 +20,27 @@
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@import time@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@kicks = 0@@@",
"@@@STEP_LOG_LINE@python.inline@while kicks < 2:@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@ while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ times += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Giving the device a \"kick\" by trying to reboot it.'@@@",
"@@@STEP_LOG_LINE@python.inline@ kicks += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ print subprocess.check_output(['adb', 'reboot'])@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@print 'Timed out waiting for device'@@@",
"@@@STEP_LOG_LINE@python.inline@sys.exit(1)@@@",

View File

@ -11,7 +11,7 @@
"cmd": [
"python",
"-u",
"\nimport subprocess\nimport sys\nimport time\n\ntimes = 0\n\nwhile times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
"\nimport subprocess\nimport sys\nimport time\n\nkicks = 0\nwhile kicks < 2:\n\n times = 0\n\n while times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n times += 1\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n print 'Giving the device a \"kick\" by trying to reboot it.'\n kicks += 1\n print subprocess.check_output(['adb', 'reboot'])\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
],
"name": "wait for device",
"~followup_annotations": [
@ -20,20 +20,27 @@
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@import time@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@kicks = 0@@@",
"@@@STEP_LOG_LINE@python.inline@while kicks < 2:@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@ while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ times += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Giving the device a \"kick\" by trying to reboot it.'@@@",
"@@@STEP_LOG_LINE@python.inline@ kicks += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ print subprocess.check_output(['adb', 'reboot'])@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@print 'Timed out waiting for device'@@@",
"@@@STEP_LOG_LINE@python.inline@sys.exit(1)@@@",

View File

@ -11,7 +11,7 @@
"cmd": [
"python",
"-u",
"\nimport subprocess\nimport sys\nimport time\n\ntimes = 0\n\nwhile times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
"\nimport subprocess\nimport sys\nimport time\n\nkicks = 0\nwhile kicks < 2:\n\n times = 0\n\n while times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n times += 1\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n print 'Giving the device a \"kick\" by trying to reboot it.'\n kicks += 1\n print subprocess.check_output(['adb', 'reboot'])\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
],
"name": "wait for device",
"~followup_annotations": [
@ -20,20 +20,27 @@
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@import time@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@kicks = 0@@@",
"@@@STEP_LOG_LINE@python.inline@while kicks < 2:@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@ while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ times += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Giving the device a \"kick\" by trying to reboot it.'@@@",
"@@@STEP_LOG_LINE@python.inline@ kicks += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ print subprocess.check_output(['adb', 'reboot'])@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@print 'Timed out waiting for device'@@@",
"@@@STEP_LOG_LINE@python.inline@sys.exit(1)@@@",

View File

@ -11,7 +11,7 @@
"cmd": [
"python",
"-u",
"\nimport subprocess\nimport sys\nimport time\n\ntimes = 0\n\nwhile times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
"\nimport subprocess\nimport sys\nimport time\n\nkicks = 0\nwhile kicks < 2:\n\n times = 0\n\n while times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n times += 1\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n print 'Giving the device a \"kick\" by trying to reboot it.'\n kicks += 1\n print subprocess.check_output(['adb', 'reboot'])\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
],
"name": "wait for device",
"~followup_annotations": [
@ -20,20 +20,27 @@
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@import time@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@kicks = 0@@@",
"@@@STEP_LOG_LINE@python.inline@while kicks < 2:@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@ while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ times += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Giving the device a \"kick\" by trying to reboot it.'@@@",
"@@@STEP_LOG_LINE@python.inline@ kicks += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ print subprocess.check_output(['adb', 'reboot'])@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@print 'Timed out waiting for device'@@@",
"@@@STEP_LOG_LINE@python.inline@sys.exit(1)@@@",

View File

@ -11,7 +11,7 @@
"cmd": [
"python",
"-u",
"\nimport subprocess\nimport sys\nimport time\n\ntimes = 0\n\nwhile times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
"\nimport subprocess\nimport sys\nimport time\n\nkicks = 0\nwhile kicks < 2:\n\n times = 0\n\n while times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n times += 1\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n print 'Giving the device a \"kick\" by trying to reboot it.'\n kicks += 1\n print subprocess.check_output(['adb', 'reboot'])\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
],
"name": "wait for device",
"~followup_annotations": [
@ -20,20 +20,27 @@
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@import time@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@kicks = 0@@@",
"@@@STEP_LOG_LINE@python.inline@while kicks < 2:@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@ while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ times += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Giving the device a \"kick\" by trying to reboot it.'@@@",
"@@@STEP_LOG_LINE@python.inline@ kicks += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ print subprocess.check_output(['adb', 'reboot'])@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@print 'Timed out waiting for device'@@@",
"@@@STEP_LOG_LINE@python.inline@sys.exit(1)@@@",

View File

@ -11,7 +11,7 @@
"cmd": [
"python",
"-u",
"\nimport subprocess\nimport sys\nimport time\n\ntimes = 0\n\nwhile times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
"\nimport subprocess\nimport sys\nimport time\n\nkicks = 0\nwhile kicks < 2:\n\n times = 0\n\n while times < 30:\n print 'Waiting for the device to be connected and ready.'\n try:\n times += 1\n output = subprocess.check_output(['adb', 'shell',\n 'getprop', 'sys.boot_completed'])\n if '1' in output:\n print 'Connected'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # no device connected/authorized yet\n pass\n time.sleep(5)\n print 'Giving the device a \"kick\" by trying to reboot it.'\n kicks += 1\n print subprocess.check_output(['adb', 'reboot'])\n\nprint 'Timed out waiting for device'\nsys.exit(1)\n"
],
"name": "wait for device",
"~followup_annotations": [
@ -20,20 +20,27 @@
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@import time@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@kicks = 0@@@",
"@@@STEP_LOG_LINE@python.inline@while kicks < 2:@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ times = 0@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@ while times < 30:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Waiting for the device to be connected and ready.'@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ times += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ output = subprocess.check_output(['adb', 'shell',@@@",
"@@@STEP_LOG_LINE@python.inline@ 'getprop', 'sys.boot_completed'])@@@",
"@@@STEP_LOG_LINE@python.inline@ if '1' in output:@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Connected'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # no device connected/authorized yet@@@",
"@@@STEP_LOG_LINE@python.inline@ pass@@@",
"@@@STEP_LOG_LINE@python.inline@ time.sleep(5)@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Giving the device a \"kick\" by trying to reboot it.'@@@",
"@@@STEP_LOG_LINE@python.inline@ kicks += 1@@@",
"@@@STEP_LOG_LINE@python.inline@ print subprocess.check_output(['adb', 'reboot'])@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@print 'Timed out waiting for device'@@@",
"@@@STEP_LOG_LINE@python.inline@sys.exit(1)@@@",