Use ssh to trigger chromecast test

Using adb seemed to ignore errors in some cases, primarily
if nanobench crashed/hung.

Bug: skia:6706
Change-Id: I5def49d5b4d20bed6c486b7e85040190be856ac8
Reviewed-on: https://skia-review.googlesource.com/18404
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
This commit is contained in:
Kevin Lubick 2017-06-01 15:49:41 -04:00 committed by Skia Commit-Bot
parent 06775d4510
commit 8692b4a5ac
5 changed files with 119 additions and 216 deletions

View File

@ -75,7 +75,7 @@
"cmd": [
"adb",
"connect",
""
"192.168.1.2:5555"
],
"env": {
"BUILDTYPE": "Release",
@ -84,7 +84,7 @@
"SKIA_OUT": "[START_DIR]/out"
},
"infra_step": true,
"name": "adb connect "
"name": "adb connect 192.168.1.2:5555"
},
{
"cmd": [
@ -698,72 +698,22 @@
},
{
"cmd": [
"python",
"-u",
"\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n",
"set -x; /cache/skia/dm --some-flag; echo $? >/cache/skia/rc",
"[START_DIR]/tmp/dm.sh"
"ssh",
"-oConnectTimeout=15",
"-oBatchMode=yes",
"-t",
"-t",
"root@192.168.1.2",
"/cache/skia/dm",
"--some-flag"
],
"infra_step": true,
"name": "write dm.sh"
},
{
"cmd": [
"adb",
"push",
"[START_DIR]/tmp/dm.sh",
"/cache/skia/"
],
"cwd": "[START_DIR]/skia",
"env": {
"BUILDTYPE": "Release",
"CHROME_HEADLESS": "1",
"PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[START_DIR]/out"
},
"infra_step": true,
"name": "push dm.sh"
},
{
"cmd": [
"adb",
"logcat",
"-c"
],
"cwd": "[START_DIR]/skia",
"env": {
"BUILDTYPE": "Release",
"CHROME_HEADLESS": "1",
"PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[START_DIR]/out"
},
"infra_step": true,
"name": "clear log"
},
{
"cmd": [
"python",
"-u",
"\nimport subprocess\nimport sys\nbin_dir = sys.argv[1]\nsh = sys.argv[2]\nsubprocess.check_call(['adb', 'shell', 'sh', bin_dir + sh])\ntry:\n sys.exit(int(subprocess.check_output(['adb', 'shell', 'cat',\n bin_dir + 'rc'])))\nexcept ValueError:\n print \"Couldn't read the return code. Probably killed for OOM.\"\n sys.exit(1)\n",
"/cache/skia/",
"dm.sh"
],
"name": "dm",
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@import subprocess@@@",
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@bin_dir = sys.argv[1]@@@",
"@@@STEP_LOG_LINE@python.inline@sh = sys.argv[2]@@@",
"@@@STEP_LOG_LINE@python.inline@subprocess.check_call(['adb', 'shell', 'sh', bin_dir + sh])@@@",
"@@@STEP_LOG_LINE@python.inline@try:@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(int(subprocess.check_output(['adb', 'shell', 'cat',@@@",
"@@@STEP_LOG_LINE@python.inline@ bin_dir + 'rc'])))@@@",
"@@@STEP_LOG_LINE@python.inline@except ValueError:@@@",
"@@@STEP_LOG_LINE@python.inline@ print \"Couldn't read the return code. Probably killed for OOM.\"@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@",
"@@@STEP_LOG_END@python.inline@@@"
]
"name": "dm"
},
{
"cmd": [

View File

@ -98,6 +98,10 @@ def GenTests(api):
test += api.step_data(
'read chromeos ip',
stdout=api.raw_io.output('{"user_ip":"foo@127.0.0.1"}'))
if 'Chromecast' in buildername:
test += api.step_data(
'read chromecast ip',
stdout=api.raw_io.output('192.168.1.2:5555'))
yield test
builder = 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release'

View File

@ -14,6 +14,26 @@ class GNChromecastFlavorUtils(gn_android_flavor.GNAndroidFlavorUtils):
def __init__(self, m):
super(GNChromecastFlavorUtils, self).__init__(m)
self._ever_ran_adb = False
self._user_ip = ''
@property
def user_ip_host(self):
if not self._user_ip:
self._user_ip = self.m.run(self.m.python.inline, 'read chromecast ip',
program="""
import os
CHROMECAST_IP_FILE = os.path.expanduser('~/chromecast.txt')
with open(CHROMECAST_IP_FILE, 'r') as f:
print f.read()
""",
stdout=self.m.raw_io.output(),
infra_step=True).stdout
return self._user_ip
@property
def user_ip(self):
return self.user_ip_host.split(':')[0]
def compile(self, unused_target):
configuration = self.m.vars.builder_cfg.get('configuration')
@ -84,19 +104,8 @@ class GNChromecastFlavorUtils(gn_android_flavor.GNAndroidFlavorUtils):
return self._run(title, 'adb', *cmd, **kwargs)
def _connect_to_remote(self):
ip_address = self.m.run(self.m.python.inline, 'read chromecast ip',
program="""
import os
CHROMECAST_IP_FILE = os.path.expanduser('~/chromecast.txt')
with open(CHROMECAST_IP_FILE, 'r') as f:
print f.read()
""",
stdout=self.m.raw_io.output(),
infra_step=True).stdout
self.m.run(self.m.step, 'adb connect %s' % ip_address, cmd=['adb',
'connect', ip_address], infra_step=True)
self.m.run(self.m.step, 'adb connect %s' % self.user_ip_host, cmd=['adb',
'connect', self.user_ip_host], infra_step=True)
def create_clean_device_dir(self, path):
# Note: Chromecast does not support -rf
@ -128,3 +137,19 @@ class GNChromecastFlavorUtils(gn_android_flavor.GNAndroidFlavorUtils):
subprocess.check_call(['adb', 'push',
hp, os.path.join(device, p, f)])
""", args=[host, device], infra_step=True)
def _ssh(self, title, *cmd, **kwargs):
ssh_cmd = ['ssh', '-oConnectTimeout=15', '-oBatchMode=yes',
'-t', '-t', 'root@%s' % self.user_ip] + list(cmd)
return self.m.run(self.m.step, title, cmd=ssh_cmd,
infra_step=False, **kwargs)
def step(self, name, cmd, **kwargs):
app = self.m.vars.skia_out.join(self.m.vars.configuration, cmd[0])
self._adb('push %s' % cmd[0],
'push', app, self.m.vars.android_bin_dir)
cmd[0] = '%s%s' % (self.m.vars.android_bin_dir, cmd[0])
self._ssh(str(name), *cmd)

View File

@ -290,11 +290,27 @@
},
{
"cmd": [
"python",
"-u",
"\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n",
"set -x; /cache/skia/nanobench --config gles -i /cache/skia/resources --images /cache/skia/resources/color_wheel.jpg --svgs /cache/skia/svgs --pre_log --match ~matrixconvolution ~blur_image_filter ~blur_0.01 ~GM_animated-image-blurs; echo $? >/cache/skia/rc",
"[START_DIR]/tmp/nanobench.sh"
"ssh",
"-oConnectTimeout=15",
"-oBatchMode=yes",
"-t",
"-t",
"root@192.168.1.2",
"/cache/skia/nanobench",
"--config",
"gles",
"-i",
"/cache/skia/resources",
"--images",
"/cache/skia/resources/color_wheel.jpg",
"--svgs",
"/cache/skia/svgs",
"--pre_log",
"--match",
"~matrixconvolution",
"~blur_image_filter",
"~blur_0.01",
"~GM_animated-image-blurs"
],
"env": {
"BUILDTYPE": "Debug",
@ -302,72 +318,7 @@
"PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[START_DIR]/out"
},
"infra_step": true,
"name": "write nanobench.sh"
},
{
"cmd": [
"adb",
"push",
"[START_DIR]/tmp/nanobench.sh",
"/cache/skia/"
],
"cwd": "[START_DIR]/skia",
"env": {
"BUILDTYPE": "Debug",
"CHROME_HEADLESS": "1",
"PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[START_DIR]/out"
},
"infra_step": true,
"name": "push nanobench.sh"
},
{
"cmd": [
"adb",
"logcat",
"-c"
],
"cwd": "[START_DIR]/skia",
"env": {
"BUILDTYPE": "Debug",
"CHROME_HEADLESS": "1",
"PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[START_DIR]/out"
},
"infra_step": true,
"name": "clear log"
},
{
"cmd": [
"python",
"-u",
"\nimport subprocess\nimport sys\nbin_dir = sys.argv[1]\nsh = sys.argv[2]\nsubprocess.check_call(['adb', 'shell', 'sh', bin_dir + sh])\ntry:\n sys.exit(int(subprocess.check_output(['adb', 'shell', 'cat',\n bin_dir + 'rc'])))\nexcept ValueError:\n print \"Couldn't read the return code. Probably killed for OOM.\"\n sys.exit(1)\n",
"/cache/skia/",
"nanobench.sh"
],
"env": {
"BUILDTYPE": "Debug",
"CHROME_HEADLESS": "1",
"PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[START_DIR]/out"
},
"name": "nanobench",
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@import subprocess@@@",
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@bin_dir = sys.argv[1]@@@",
"@@@STEP_LOG_LINE@python.inline@sh = sys.argv[2]@@@",
"@@@STEP_LOG_LINE@python.inline@subprocess.check_call(['adb', 'shell', 'sh', bin_dir + sh])@@@",
"@@@STEP_LOG_LINE@python.inline@try:@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(int(subprocess.check_output(['adb', 'shell', 'cat',@@@",
"@@@STEP_LOG_LINE@python.inline@ bin_dir + 'rc'])))@@@",
"@@@STEP_LOG_LINE@python.inline@except ValueError:@@@",
"@@@STEP_LOG_LINE@python.inline@ print \"Couldn't read the return code. Probably killed for OOM.\"@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@",
"@@@STEP_LOG_END@python.inline@@@"
]
"name": "nanobench"
},
{
"cmd": [

View File

@ -326,11 +326,49 @@
},
{
"cmd": [
"python",
"-u",
"\nimport shutil\nimport sys\nshutil.copy(sys.argv[1], sys.argv[2])\n",
"set -x; /cache/skia/nanobench --config gles -i /cache/skia/resources --images /cache/skia/resources/color_wheel.jpg --svgs /cache/skia/svgs --pre_log --match ~matrixconvolution ~blur_image_filter ~blur_0.01 ~GM_animated-image-blurs --outResultsFile /cache/skia/perf/nanobench_abc123_1337000001.json --properties gitHash abc123 swarming_bot_id skia-bot-123 swarming_task_id 123456 --key arch arm compiler GCC cpu_or_gpu CPU cpu_or_gpu_value Cortex_A7 model Chorizo os Chromecast; echo $? >/cache/skia/rc",
"[START_DIR]/tmp/nanobench.sh"
"ssh",
"-oConnectTimeout=15",
"-oBatchMode=yes",
"-t",
"-t",
"root@192.168.1.2",
"/cache/skia/nanobench",
"--config",
"gles",
"-i",
"/cache/skia/resources",
"--images",
"/cache/skia/resources/color_wheel.jpg",
"--svgs",
"/cache/skia/svgs",
"--pre_log",
"--match",
"~matrixconvolution",
"~blur_image_filter",
"~blur_0.01",
"~GM_animated-image-blurs",
"--outResultsFile",
"/cache/skia/perf/nanobench_abc123_1337000001.json",
"--properties",
"gitHash",
"abc123",
"swarming_bot_id",
"skia-bot-123",
"swarming_task_id",
"123456",
"--key",
"arch",
"arm",
"compiler",
"GCC",
"cpu_or_gpu",
"CPU",
"cpu_or_gpu_value",
"Cortex_A7",
"model",
"Chorizo",
"os",
"Chromecast"
],
"env": {
"BUILDTYPE": "Release",
@ -338,72 +376,7 @@
"PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[START_DIR]/out"
},
"infra_step": true,
"name": "write nanobench.sh"
},
{
"cmd": [
"adb",
"push",
"[START_DIR]/tmp/nanobench.sh",
"/cache/skia/"
],
"cwd": "[START_DIR]/skia",
"env": {
"BUILDTYPE": "Release",
"CHROME_HEADLESS": "1",
"PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[START_DIR]/out"
},
"infra_step": true,
"name": "push nanobench.sh"
},
{
"cmd": [
"adb",
"logcat",
"-c"
],
"cwd": "[START_DIR]/skia",
"env": {
"BUILDTYPE": "Release",
"CHROME_HEADLESS": "1",
"PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[START_DIR]/out"
},
"infra_step": true,
"name": "clear log"
},
{
"cmd": [
"python",
"-u",
"\nimport subprocess\nimport sys\nbin_dir = sys.argv[1]\nsh = sys.argv[2]\nsubprocess.check_call(['adb', 'shell', 'sh', bin_dir + sh])\ntry:\n sys.exit(int(subprocess.check_output(['adb', 'shell', 'cat',\n bin_dir + 'rc'])))\nexcept ValueError:\n print \"Couldn't read the return code. Probably killed for OOM.\"\n sys.exit(1)\n",
"/cache/skia/",
"nanobench.sh"
],
"env": {
"BUILDTYPE": "Release",
"CHROME_HEADLESS": "1",
"PATH": "<PATH>:RECIPE_PACKAGE_REPO[depot_tools]",
"SKIA_OUT": "[START_DIR]/out"
},
"name": "nanobench",
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@import subprocess@@@",
"@@@STEP_LOG_LINE@python.inline@import sys@@@",
"@@@STEP_LOG_LINE@python.inline@bin_dir = sys.argv[1]@@@",
"@@@STEP_LOG_LINE@python.inline@sh = sys.argv[2]@@@",
"@@@STEP_LOG_LINE@python.inline@subprocess.check_call(['adb', 'shell', 'sh', bin_dir + sh])@@@",
"@@@STEP_LOG_LINE@python.inline@try:@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(int(subprocess.check_output(['adb', 'shell', 'cat',@@@",
"@@@STEP_LOG_LINE@python.inline@ bin_dir + 'rc'])))@@@",
"@@@STEP_LOG_LINE@python.inline@except ValueError:@@@",
"@@@STEP_LOG_LINE@python.inline@ print \"Couldn't read the return code. Probably killed for OOM.\"@@@",
"@@@STEP_LOG_LINE@python.inline@ sys.exit(1)@@@",
"@@@STEP_LOG_END@python.inline@@@"
]
"name": "nanobench"
},
{
"cmd": [