aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py
diff options
context:
space:
mode:
authorGravatar Kevin Lubick <kjlubick@google.com>2017-03-21 09:25:34 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-21 14:52:26 +0000
commit291547d4e76ba7d3e9caace8deb7761632d8be06 (patch)
tree4fe8c628e76f6c395c13ac704593397ba4c167d4 /infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py
parenta33b43d796f03e2f4b5abd8060272f4f775d7390 (diff)
Add Chromecast Perf jobs
It starts out with some skps and resource-based perf because all skps wouldn't fit and skimages are far too large BUG=skia: Change-Id: Icb07ffa84d39a85a8bc595e74ef934df921e749a Reviewed-on: https://skia-review.googlesource.com/9901 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Eric Boren <borenet@google.com>
Diffstat (limited to 'infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py')
-rw-r--r--infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py b/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py
index 99f35b3d7d..2b5983d72b 100644
--- a/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py
+++ b/infra/bots/recipe_modules/flavor/gn_chromecast_flavor.py
@@ -13,6 +13,7 @@ import subprocess
class GNChromecastFlavorUtils(gn_android_flavor.GNAndroidFlavorUtils):
def __init__(self, m):
super(GNChromecastFlavorUtils, self).__init__(m)
+ self._ever_ran_adb = False
def compile(self, unused_target):
configuration = self.m.vars.builder_cfg.get('configuration')
@@ -57,3 +58,58 @@ class GNChromecastFlavorUtils(gn_android_flavor.GNAndroidFlavorUtils):
# We only build perf for the chromecasts.
self._run('ninja', ninja, '-C', self.out_dir, 'nanobench')
+ def _adb(self, title, *cmd, **kwargs):
+ if not self._ever_ran_adb:
+ self._connect_to_remote()
+
+ self._ever_ran_adb = True
+ # The only non-infra adb steps (dm / nanobench) happen to not use _adb().
+ if 'infra_step' not in kwargs:
+ kwargs['infra_step'] = True
+ 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)
+
+ def create_clean_device_dir(self, path):
+ # Note: Chromecast does not support -rf
+ self._adb('rm %s' % path, 'shell', 'rm', '-r', path)
+ self._adb('mkdir %s' % path, 'shell', 'mkdir', '-p', path)
+
+ def copy_directory_contents_to_device(self, host, device):
+ # Copy the tree, avoiding hidden directories and resolving symlinks.
+ # Additionally, due to space restraints, we don't push files > 3 MB
+ # which cuts down the size of the SKP asset to be around 50 MB as of
+ # version 41.
+ self.m.run(self.m.python.inline, 'push %s/* %s' % (host, device),
+ program="""
+ import os
+ import subprocess
+ import sys
+ host = sys.argv[1]
+ device = sys.argv[2]
+ for d, _, fs in os.walk(host):
+ p = os.path.relpath(d, host)
+ if p != '.' and p.startswith('.'):
+ continue
+ for f in fs:
+ print os.path.join(p,f)
+ hp = os.path.realpath(os.path.join(host, p, f))
+ if os.stat(hp).st_size > (3 * 1024 * 1024):
+ print "Skipping because it is too big"
+ else:
+ subprocess.check_call(['adb', 'push',
+ hp, os.path.join(device, p, f)])
+ """, args=[host, device], infra_step=True)