aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/recipe_modules
diff options
context:
space:
mode:
authorGravatar borenet <borenet@chromium.org>2016-08-08 04:34:00 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-08 04:34:01 -0700
commitdfa55f2db436535cfa22abeb542270ef54b77675 (patch)
treefb1e5cb084f5859260f6ad36ad546273e0e7604f /infra/bots/recipe_modules
parent03591a762c0e3f541141d570625c2dab16deacba (diff)
[recipes] Smush the rest of builder_spec into appropriate places, other cleanup
Diffstat (limited to 'infra/bots/recipe_modules')
-rw-r--r--infra/bots/recipe_modules/flavor/__init__.py1
-rw-r--r--infra/bots/recipe_modules/flavor/android_flavor.py37
-rw-r--r--infra/bots/recipe_modules/flavor/ios_flavor.py3
-rw-r--r--infra/bots/recipe_modules/vars/api.py170
4 files changed, 70 insertions, 141 deletions
diff --git a/infra/bots/recipe_modules/flavor/__init__.py b/infra/bots/recipe_modules/flavor/__init__.py
index 383e75bcee..b532b41f34 100644
--- a/infra/bots/recipe_modules/flavor/__init__.py
+++ b/infra/bots/recipe_modules/flavor/__init__.py
@@ -5,6 +5,7 @@
DEPS = [
'build/adb',
'build/file',
+ 'builder_name_schema',
'recipe_engine/path',
'recipe_engine/platform',
'recipe_engine/properties',
diff --git a/infra/bots/recipe_modules/flavor/android_flavor.py b/infra/bots/recipe_modules/flavor/android_flavor.py
index 474ec81b69..85ccef3fb8 100644
--- a/infra/bots/recipe_modules/flavor/android_flavor.py
+++ b/infra/bots/recipe_modules/flavor/android_flavor.py
@@ -13,6 +13,38 @@ import default_flavor
"""Android flavor utils, used for building for and running tests on Android."""
+def get_device(api):
+ builder_cfg = api.builder_name_schema.DictForBuilderName(
+ api.vars.builder_name)
+ if 'Android' in builder_cfg.get('extra_config', ''):
+ # Compile bots.
+ if 'NoNeon' in builder_cfg['extra_config']:
+ return 'arm_v7'
+ return {
+ 'Arm64': 'arm64',
+ 'x86': 'x86',
+ 'x86_64': 'x86_64',
+ 'Mips': 'mips',
+ 'Mips64': 'mips64',
+ 'MipsDSP2': 'mips_dsp2',
+ }.get(builder_cfg['target_arch'], 'arm_v7_neon')
+ else:
+ # Test/Perf bots.
+ return {
+ 'AndroidOne': 'arm_v7_neon',
+ 'GalaxyS3': 'arm_v7_neon',
+ 'GalaxyS4': 'arm_v7_neon',
+ 'NVIDIA_Shield': 'arm64',
+ 'Nexus10': 'arm_v7_neon',
+ 'Nexus5': 'arm_v7_neon',
+ 'Nexus6': 'arm_v7_neon',
+ 'Nexus7': 'arm_v7_neon',
+ 'Nexus7v2': 'arm_v7_neon',
+ 'Nexus9': 'arm64',
+ 'NexusPlayer': 'x86',
+ }[builder_cfg['model']]
+
+
class _ADBWrapper(object):
"""Wrapper for the ADB recipe module.
@@ -64,7 +96,7 @@ class _ADBWrapper(object):
class AndroidFlavorUtils(default_flavor.DefaultFlavorUtils):
def __init__(self, m):
super(AndroidFlavorUtils, self).__init__(m)
- self.device = self.m.vars.builder_spec['device_cfg']
+ self.device = get_device(m)
self.android_bin = self.m.vars.skia_dir.join(
'platform_tools', 'android', 'bin')
self._android_sdk_root = self.m.vars.slave_dir.join(
@@ -273,7 +305,8 @@ class AndroidFlavorUtils(default_flavor.DefaultFlavorUtils):
def cleanup_steps(self):
"""Run any device-specific cleanup steps."""
- if self.m.vars.do_test_steps or self.m.vars.do_perf_steps:
+ if self.m.vars.role in (self.m.builder_name_schema.BUILDER_ROLE_TEST,
+ self.m.builder_name_schema.BUILDER_ROLE_PERF):
self._adb(name='final battery stats',
serial=self.serial,
cmd=['shell', 'dumpsys', 'batteryproperties'],
diff --git a/infra/bots/recipe_modules/flavor/ios_flavor.py b/infra/bots/recipe_modules/flavor/ios_flavor.py
index 806926a4b4..7708d5dccd 100644
--- a/infra/bots/recipe_modules/flavor/ios_flavor.py
+++ b/infra/bots/recipe_modules/flavor/ios_flavor.py
@@ -130,7 +130,8 @@ class iOSFlavorUtils(default_flavor.DefaultFlavorUtils):
def cleanup_steps(self):
"""Run any device-specific cleanup steps."""
- if self.m.vars.do_test_steps or self.m.vars.do_perf_steps:
+ if self.m.vars.role in (self.m.builder_name_schema.BUILDER_ROLE_TEST,
+ self.m.builder_name_schema.BUILDER_ROLE_PERF):
self.m.run(
self.m.step,
name='reboot',
diff --git a/infra/bots/recipe_modules/vars/api.py b/infra/bots/recipe_modules/vars/api.py
index 093cd87da7..7936602fc7 100644
--- a/infra/bots/recipe_modules/vars/api.py
+++ b/infra/bots/recipe_modules/vars/api.py
@@ -7,7 +7,6 @@
from recipe_engine import recipe_api
-import os
BOTO_CHROMIUM_SKIA_GM = 'chromium-skia-gm.boto'
@@ -16,113 +15,6 @@ CONFIG_DEBUG = 'Debug'
CONFIG_RELEASE = 'Release'
-def device_cfg(builder_dict):
- # Android.
- if 'Android' in builder_dict.get('extra_config', ''):
- if 'NoNeon' in builder_dict['extra_config']:
- return 'arm_v7'
- return {
- 'Arm64': 'arm64',
- 'x86': 'x86',
- 'x86_64': 'x86_64',
- 'Mips': 'mips',
- 'Mips64': 'mips64',
- 'MipsDSP2': 'mips_dsp2',
- }.get(builder_dict['target_arch'], 'arm_v7_neon')
- elif builder_dict.get('os') == 'Android':
- return {
- 'AndroidOne': 'arm_v7_neon',
- 'GalaxyS3': 'arm_v7_neon',
- 'GalaxyS4': 'arm_v7_neon',
- 'NVIDIA_Shield': 'arm64',
- 'Nexus10': 'arm_v7_neon',
- 'Nexus5': 'arm_v7_neon',
- 'Nexus6': 'arm_v7_neon',
- 'Nexus7': 'arm_v7_neon',
- 'Nexus7v2': 'arm_v7_neon',
- 'Nexus9': 'arm64',
- 'NexusPlayer': 'x86',
- }[builder_dict['model']]
-
- # iOS.
- if 'iOS' in builder_dict.get('os', ''):
- return {
- 'iPad4': 'iPad4,1',
- }[builder_dict['model']]
-
- return None
-
-
-def product_board(builder_dict):
- if 'Android' in builder_dict.get('os', ''):
- return {
- 'AndroidOne': 'sprout',
- 'GalaxyS3': 'm0', #'smdk4x12', Detected incorrectly by swarming?
- 'GalaxyS4': None, # TODO(borenet,kjlubick)
- 'NVIDIA_Shield': 'foster',
- 'Nexus10': 'manta',
- 'Nexus5': 'hammerhead',
- 'Nexus6': 'shamu',
- 'Nexus7': 'grouper',
- 'Nexus7v2': 'flo',
- 'Nexus9': 'flounder',
- 'NexusPlayer': 'fugu',
- }[builder_dict['model']]
- return None
-
-
-def get_builder_spec(api, builder_name):
- builder_dict = api.builder_name_schema.DictForBuilderName(builder_name)
- rv = {
- 'builder_cfg': builder_dict,
- }
- device = device_cfg(builder_dict)
- if device:
- rv['device_cfg'] = device
- board = product_board(builder_dict)
- if board:
- rv['product.board'] = board
-
- role = builder_dict['role']
- if role == api.builder_name_schema.BUILDER_ROLE_HOUSEKEEPER:
- configuration = CONFIG_RELEASE
- else:
- configuration = builder_dict.get('configuration', CONFIG_DEBUG)
- arch = (builder_dict.get('arch') or builder_dict.get('target_arch'))
- if ('Win' in builder_dict.get('os', '') and arch == 'x86_64'):
- configuration += '_x64'
- rv['configuration'] = configuration
- if configuration == 'Coverage':
- rv['do_compile_steps'] = False
- rv['do_test_steps'] = role == api.builder_name_schema.BUILDER_ROLE_TEST
- rv['do_perf_steps'] = role == api.builder_name_schema.BUILDER_ROLE_PERF
-
- # Do we upload perf results?
- upload_perf_results = False
- if (role == api.builder_name_schema.BUILDER_ROLE_PERF and
- CONFIG_RELEASE in configuration):
- upload_perf_results = True
- rv['upload_perf_results'] = upload_perf_results
-
- # Do we upload correctness results?
- skip_upload_bots = [
- 'ASAN',
- 'Coverage',
- 'MSAN',
- 'TSAN',
- 'UBSAN',
- 'Valgrind',
- ]
- upload_dm_results = True
- for s in skip_upload_bots:
- if s in builder_name:
- upload_dm_results = False
- break
- rv['upload_dm_results'] = upload_dm_results
-
- return rv
-
-
class SkiaVarsApi(recipe_api.RecipeApi):
def make_path(self, *path):
@@ -131,26 +23,6 @@ class SkiaVarsApi(recipe_api.RecipeApi):
self.m.path.c.base_paths[key] = tuple(path)
return self.m.path[key]
- def gsutil_env(self, boto_file):
- """Environment variables for gsutil."""
- boto_path = None
- if boto_file:
- boto_path = self.m.path.join(self.home_dir, boto_file)
- return {'AWS_CREDENTIAL_FILE': boto_path,
- 'BOTO_CONFIG': boto_path}
-
- @property
- def home_dir(self):
- """Find the home directory."""
- home_dir = os.path.expanduser('~')
- if self._test_data.enabled:
- home_dir = '[HOME]'
- return home_dir
-
- def get_builder_spec(self, builder_name):
- """Return the builder_spec for the given builder name."""
- return get_builder_spec(self.m, builder_name)
-
def setup(self):
"""Prepare the variables."""
# Setup
@@ -222,18 +94,19 @@ class SkiaVarsApi(recipe_api.RecipeApi):
# Some bots also require a checkout of PDFium.
self.need_pdfium_checkout = 'PDFium' in self.builder_name
- # Obtain the spec for this builder. Use it to set more properties.
- self.builder_spec = get_builder_spec(self.m, self.builder_name)
-
- self.builder_cfg = self.builder_spec['builder_cfg']
+ self.builder_cfg = self.m.builder_name_schema.DictForBuilderName(
+ self.builder_name)
self.role = self.builder_cfg['role']
+ if self.role == self.m.builder_name_schema.BUILDER_ROLE_HOUSEKEEPER:
+ self.configuration = CONFIG_RELEASE
+ else:
+ self.configuration = self.builder_cfg.get('configuration', CONFIG_DEBUG)
+ arch = (self.builder_cfg.get('arch') or self.builder_cfg.get('target_arch'))
+ if ('Win' in self.builder_cfg.get('os', '') and arch == 'x86_64'):
+ self.configuration += '_x64'
- self.configuration = self.builder_spec['configuration']
self.default_env.update({'SKIA_OUT': self.skia_out,
'BUILDTYPE': self.configuration})
- self.do_compile_steps = self.builder_spec.get('do_compile_steps', True)
- self.do_test_steps = self.builder_spec['do_test_steps']
- self.do_perf_steps = self.builder_spec['do_perf_steps']
self.is_trybot = self.builder_cfg['is_trybot']
self.issue = None
self.patchset = None
@@ -242,9 +115,30 @@ class SkiaVarsApi(recipe_api.RecipeApi):
self.issue = self.m.properties['issue']
self.patchset = self.m.properties['patchset']
self.rietveld = self.m.properties['rietveld']
- self.upload_dm_results = self.builder_spec['upload_dm_results']
- self.upload_perf_results = self.builder_spec['upload_perf_results']
self.dm_dir = self.m.path.join(
self.swarming_out_dir, 'dm')
self.perf_data_dir = self.m.path.join(self.swarming_out_dir,
'perfdata', self.builder_name, 'data')
+
+ @property
+ def upload_dm_results(self):
+ # TODO(borenet): Move this into the swarm_test recipe.
+ skip_upload_bots = [
+ 'ASAN',
+ 'Coverage',
+ 'MSAN',
+ 'TSAN',
+ 'UBSAN',
+ 'Valgrind',
+ ]
+ upload_dm_results = True
+ for s in skip_upload_bots:
+ if s in self.m.properties['buildername']:
+ upload_dm_results = False
+ break
+ return upload_dm_results
+
+ @property
+ def upload_perf_results(self):
+ # TODO(borenet): Move this into the swarm_perf recipe.
+ return ('Release' in self.m.properties['buildername'])