diff options
author | Kevin Lubick <kjlubick@google.com> | 2017-06-01 15:49:41 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-01 20:11:47 +0000 |
commit | 8692b4a5acffe983c67831146abc6122ee1d4c0b (patch) | |
tree | 023de65520345b3d9e6303de161048e261fb1f05 /infra | |
parent | 06775d4510c529dfbf9801c3ac64af60e166cbf7 (diff) |
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>
Diffstat (limited to 'infra')
5 files changed, 119 insertions, 216 deletions
diff --git a/infra/bots/recipe_modules/flavor/example.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Release.json b/infra/bots/recipe_modules/flavor/example.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Release.json index dc197334c4..962231fb92 100644 --- a/infra/bots/recipe_modules/flavor/example.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Release.json +++ b/infra/bots/recipe_modules/flavor/example.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Release.json @@ -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" - ], - "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" + "ssh", + "-oConnectTimeout=15", + "-oBatchMode=yes", + "-t", + "-t", + "root@192.168.1.2", + "/cache/skia/dm", + "--some-flag" ], - "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": [ diff --git a/infra/bots/recipe_modules/flavor/example.py b/infra/bots/recipe_modules/flavor/example.py index fe773a2385..066e849946 100644 --- a/infra/bots/recipe_modules/flavor/example.py +++ b/infra/bots/recipe_modules/flavor/example.py @@ -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' diff --git a/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py b/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py index 591c78921f..ec48a7dfa9 100644 --- a/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py +++ b/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py @@ -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) + diff --git a/infra/bots/recipes/perf.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Debug.json b/infra/bots/recipes/perf.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Debug.json index e02cec2ab7..2d3682bf9e 100644 --- a/infra/bots/recipes/perf.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Debug.json +++ b/infra/bots/recipes/perf.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Debug.json @@ -290,84 +290,35 @@ }, { "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" - ], - "env": { - "BUILDTYPE": "Debug", - "CHROME_HEADLESS": "1", - "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" + "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" ], - "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": [ diff --git a/infra/bots/recipes/perf.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Release.json b/infra/bots/recipes/perf.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Release.json index cabf244702..42971f5712 100644 --- a/infra/bots/recipes/perf.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Release.json +++ b/infra/bots/recipes/perf.expected/Perf-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Release.json @@ -326,84 +326,57 @@ }, { "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" - ], - "env": { - "BUILDTYPE": "Release", - "CHROME_HEADLESS": "1", - "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" + "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" ], - "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": [ |