blob: 2639d3070b57883999160322358c002ed3a4a497 [file] [log] [blame]
[
{
"cmd": [
"python",
"-u",
"\nimport os\nimport subprocess\nimport sys\n\ncontainer_name = sys.argv[1]\ncheckout_root = sys.argv[2]\napk_location = sys.argv[3]\nDOCKER_IMAGE = sys.argv[4]\n\nMAX_TRIES = 5\n\nstart_cmd = ['docker', 'run', '--privileged', '--rm', '-d', # detached/daemon\n '--name', container_name,\n '--env', 'DEVICE=Samsung Galaxy S6',\n '--volume', '%s:/SRC' % checkout_root,\n '--volume', '%s:/OUT' % apk_location,\n DOCKER_IMAGE]\n\nwait_cmd = ['docker', 'exec', container_name,\n 'timeout', '45', 'adb', 'wait-for-device']\n\nfor t in range(MAX_TRIES):\n print 'Starting Emulator try %d' % t\n try:\n # Start emulator\n print subprocess.check_output(start_cmd)\n # Wait a short time using adb-wait-for-device\n print subprocess.check_output(wait_cmd)\n # if exit code 0, we are good so end loop\n print 'Emulator started'\n sys.exit(0)\n except subprocess.CalledProcessError:\n # else kill docker container\n print 'Killing and trying again'\n print subprocess.check_output(['docker', 'kill', container_name])\nprint 'Could not start emulator'\nsys.exit(1)\n",
"android_em",
"[START_DIR]",
"[START_DIR]/build",
"butomo1989/docker-android-x86-8.1@sha256:ad75c888e373d9ea7a2821fd8f64b53c9a22b5827e6fa516b396739a20b9bb88"
],
"infra_step": true,
"name": "Start Emulator",
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@import os@@@",
"@@@STEP_LOG_LINE@python.inline@import subprocess@@@",
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@container_name = sys.argv[1]@@@",
"@@@STEP_LOG_LINE@python.inline@checkout_root = sys.argv[2]@@@",
"@@@STEP_LOG_LINE@python.inline@apk_location = sys.argv[3]@@@",
"@@@STEP_LOG_LINE@python.inline@DOCKER_IMAGE = sys.argv[4]@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@MAX_TRIES = 5@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@start_cmd = ['docker', 'run', '--privileged', '--rm', '-d', # detached/daemon@@@",
"@@@STEP_LOG_LINE@python.inline@ '--name', container_name,@@@",
"@@@STEP_LOG_LINE@python.inline@ '--env', 'DEVICE=Samsung Galaxy S6',@@@",
"@@@STEP_LOG_LINE@python.inline@ '--volume', '%s:/SRC' % checkout_root,@@@",
"@@@STEP_LOG_LINE@python.inline@ '--volume', '%s:/OUT' % apk_location,@@@",
"@@@STEP_LOG_LINE@python.inline@ DOCKER_IMAGE]@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@wait_cmd = ['docker', 'exec', container_name,@@@",
"@@@STEP_LOG_LINE@python.inline@ 'timeout', '45', 'adb', 'wait-for-device']@@@",
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@for t in range(MAX_TRIES):@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Starting Emulator try %d' % t@@@",
"@@@STEP_LOG_LINE@python.inline@ try:@@@",
"@@@STEP_LOG_LINE@python.inline@ # Start emulator@@@",
"@@@STEP_LOG_LINE@python.inline@ print subprocess.check_output(start_cmd)@@@",
"@@@STEP_LOG_LINE@python.inline@ # Wait a short time using adb-wait-for-device@@@",
"@@@STEP_LOG_LINE@python.inline@ print subprocess.check_output(wait_cmd)@@@",
"@@@STEP_LOG_LINE@python.inline@ # if exit code 0, we are good so end loop@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Emulator started'@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(0)@@@",
"@@@STEP_LOG_LINE@python.inline@ except subprocess.CalledProcessError:@@@",
"@@@STEP_LOG_LINE@python.inline@ # else kill docker container@@@",
"@@@STEP_LOG_LINE@python.inline@ print 'Killing and trying again'@@@",
"@@@STEP_LOG_LINE@python.inline@ print subprocess.check_output(['docker', 'kill', container_name])@@@",
"@@@STEP_LOG_LINE@python.inline@print 'Could not start emulator'@@@",
"@@@STEP_LOG_LINE@python.inline@sys.exit(1)@@@",
"@@@STEP_LOG_END@python.inline@@@"
]
},
{
"cmd": [
"docker",
"exec",
"android_em",
"/SRC/skia/infra/skqp/run_skqp.sh"
],
"env": {
"CHROME_HEADLESS": "1",
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "Test SQKP with Android Emulator in Docker"
},
{
"cmd": [
"docker",
"kill",
"android_em"
],
"env": {
"CHROME_HEADLESS": "1",
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
},
"infra_step": true,
"name": "Stop Emulator"
},
{
"name": "$result"
}
]