| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 # pylint: disable=W0201 | 6 # pylint: disable=W0201 |
| 7 | 7 |
| 8 | 8 |
| 9 from recipe_engine import recipe_api | 9 from recipe_engine import recipe_api |
| 10 import os | |
| 11 | 10 |
| 12 | 11 |
| 13 BOTO_CHROMIUM_SKIA_GM = 'chromium-skia-gm.boto' | 12 BOTO_CHROMIUM_SKIA_GM = 'chromium-skia-gm.boto' |
| 14 | 13 |
| 15 CONFIG_DEBUG = 'Debug' | 14 CONFIG_DEBUG = 'Debug' |
| 16 CONFIG_RELEASE = 'Release' | 15 CONFIG_RELEASE = 'Release' |
| 17 | 16 |
| 18 | 17 |
| 19 def device_cfg(builder_dict): | |
| 20 # Android. | |
| 21 if 'Android' in builder_dict.get('extra_config', ''): | |
| 22 if 'NoNeon' in builder_dict['extra_config']: | |
| 23 return 'arm_v7' | |
| 24 return { | |
| 25 'Arm64': 'arm64', | |
| 26 'x86': 'x86', | |
| 27 'x86_64': 'x86_64', | |
| 28 'Mips': 'mips', | |
| 29 'Mips64': 'mips64', | |
| 30 'MipsDSP2': 'mips_dsp2', | |
| 31 }.get(builder_dict['target_arch'], 'arm_v7_neon') | |
| 32 elif builder_dict.get('os') == 'Android': | |
| 33 return { | |
| 34 'AndroidOne': 'arm_v7_neon', | |
| 35 'GalaxyS3': 'arm_v7_neon', | |
| 36 'GalaxyS4': 'arm_v7_neon', | |
| 37 'NVIDIA_Shield': 'arm64', | |
| 38 'Nexus10': 'arm_v7_neon', | |
| 39 'Nexus5': 'arm_v7_neon', | |
| 40 'Nexus6': 'arm_v7_neon', | |
| 41 'Nexus7': 'arm_v7_neon', | |
| 42 'Nexus7v2': 'arm_v7_neon', | |
| 43 'Nexus9': 'arm64', | |
| 44 'NexusPlayer': 'x86', | |
| 45 }[builder_dict['model']] | |
| 46 | |
| 47 # iOS. | |
| 48 if 'iOS' in builder_dict.get('os', ''): | |
| 49 return { | |
| 50 'iPad4': 'iPad4,1', | |
| 51 }[builder_dict['model']] | |
| 52 | |
| 53 return None | |
| 54 | |
| 55 | |
| 56 def product_board(builder_dict): | |
| 57 if 'Android' in builder_dict.get('os', ''): | |
| 58 return { | |
| 59 'AndroidOne': 'sprout', | |
| 60 'GalaxyS3': 'm0', #'smdk4x12', Detected incorrectly by swarming? | |
| 61 'GalaxyS4': None, # TODO(borenet,kjlubick) | |
| 62 'NVIDIA_Shield': 'foster', | |
| 63 'Nexus10': 'manta', | |
| 64 'Nexus5': 'hammerhead', | |
| 65 'Nexus6': 'shamu', | |
| 66 'Nexus7': 'grouper', | |
| 67 'Nexus7v2': 'flo', | |
| 68 'Nexus9': 'flounder', | |
| 69 'NexusPlayer': 'fugu', | |
| 70 }[builder_dict['model']] | |
| 71 return None | |
| 72 | |
| 73 | |
| 74 def get_builder_spec(api, builder_name): | |
| 75 builder_dict = api.builder_name_schema.DictForBuilderName(builder_name) | |
| 76 rv = { | |
| 77 'builder_cfg': builder_dict, | |
| 78 } | |
| 79 device = device_cfg(builder_dict) | |
| 80 if device: | |
| 81 rv['device_cfg'] = device | |
| 82 board = product_board(builder_dict) | |
| 83 if board: | |
| 84 rv['product.board'] = board | |
| 85 | |
| 86 role = builder_dict['role'] | |
| 87 if role == api.builder_name_schema.BUILDER_ROLE_HOUSEKEEPER: | |
| 88 configuration = CONFIG_RELEASE | |
| 89 else: | |
| 90 configuration = builder_dict.get('configuration', CONFIG_DEBUG) | |
| 91 arch = (builder_dict.get('arch') or builder_dict.get('target_arch')) | |
| 92 if ('Win' in builder_dict.get('os', '') and arch == 'x86_64'): | |
| 93 configuration += '_x64' | |
| 94 rv['configuration'] = configuration | |
| 95 if configuration == 'Coverage': | |
| 96 rv['do_compile_steps'] = False | |
| 97 rv['do_test_steps'] = role == api.builder_name_schema.BUILDER_ROLE_TEST | |
| 98 rv['do_perf_steps'] = role == api.builder_name_schema.BUILDER_ROLE_PERF | |
| 99 | |
| 100 # Do we upload perf results? | |
| 101 upload_perf_results = False | |
| 102 if (role == api.builder_name_schema.BUILDER_ROLE_PERF and | |
| 103 CONFIG_RELEASE in configuration): | |
| 104 upload_perf_results = True | |
| 105 rv['upload_perf_results'] = upload_perf_results | |
| 106 | |
| 107 # Do we upload correctness results? | |
| 108 skip_upload_bots = [ | |
| 109 'ASAN', | |
| 110 'Coverage', | |
| 111 'MSAN', | |
| 112 'TSAN', | |
| 113 'UBSAN', | |
| 114 'Valgrind', | |
| 115 ] | |
| 116 upload_dm_results = True | |
| 117 for s in skip_upload_bots: | |
| 118 if s in builder_name: | |
| 119 upload_dm_results = False | |
| 120 break | |
| 121 rv['upload_dm_results'] = upload_dm_results | |
| 122 | |
| 123 return rv | |
| 124 | |
| 125 | |
| 126 class SkiaVarsApi(recipe_api.RecipeApi): | 18 class SkiaVarsApi(recipe_api.RecipeApi): |
| 127 | 19 |
| 128 def make_path(self, *path): | 20 def make_path(self, *path): |
| 129 """Return a Path object for the given path.""" | 21 """Return a Path object for the given path.""" |
| 130 key = 'custom_%s' % '_'.join(path) | 22 key = 'custom_%s' % '_'.join(path) |
| 131 self.m.path.c.base_paths[key] = tuple(path) | 23 self.m.path.c.base_paths[key] = tuple(path) |
| 132 return self.m.path[key] | 24 return self.m.path[key] |
| 133 | 25 |
| 134 def gsutil_env(self, boto_file): | |
| 135 """Environment variables for gsutil.""" | |
| 136 boto_path = None | |
| 137 if boto_file: | |
| 138 boto_path = self.m.path.join(self.home_dir, boto_file) | |
| 139 return {'AWS_CREDENTIAL_FILE': boto_path, | |
| 140 'BOTO_CONFIG': boto_path} | |
| 141 | |
| 142 @property | |
| 143 def home_dir(self): | |
| 144 """Find the home directory.""" | |
| 145 home_dir = os.path.expanduser('~') | |
| 146 if self._test_data.enabled: | |
| 147 home_dir = '[HOME]' | |
| 148 return home_dir | |
| 149 | |
| 150 def get_builder_spec(self, builder_name): | |
| 151 """Return the builder_spec for the given builder name.""" | |
| 152 return get_builder_spec(self.m, builder_name) | |
| 153 | |
| 154 def setup(self): | 26 def setup(self): |
| 155 """Prepare the variables.""" | 27 """Prepare the variables.""" |
| 156 # Setup | 28 # Setup |
| 157 self.builder_name = self.m.properties['buildername'] | 29 self.builder_name = self.m.properties['buildername'] |
| 158 self.master_name = self.m.properties['mastername'] | 30 self.master_name = self.m.properties['mastername'] |
| 159 self.slave_name = self.m.properties['slavename'] | 31 self.slave_name = self.m.properties['slavename'] |
| 160 self.build_number = self.m.properties['buildnumber'] | 32 self.build_number = self.m.properties['buildnumber'] |
| 161 | 33 |
| 162 self.slave_dir = self.m.path['slave_build'] | 34 self.slave_dir = self.m.path['slave_build'] |
| 163 self.checkout_root = self.slave_dir | 35 self.checkout_root = self.slave_dir |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 'SAN' in self.builder_name) or | 87 'SAN' in self.builder_name) or |
| 216 'RecreateSKPs' in self.builder_name): | 88 'RecreateSKPs' in self.builder_name): |
| 217 self.need_chromium_checkout = True | 89 self.need_chromium_checkout = True |
| 218 if 'RecreateSKPs' in self.builder_name: | 90 if 'RecreateSKPs' in self.builder_name: |
| 219 self.gclient_env['CPPFLAGS'] = ( | 91 self.gclient_env['CPPFLAGS'] = ( |
| 220 '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1') | 92 '-DSK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS=1') |
| 221 | 93 |
| 222 # Some bots also require a checkout of PDFium. | 94 # Some bots also require a checkout of PDFium. |
| 223 self.need_pdfium_checkout = 'PDFium' in self.builder_name | 95 self.need_pdfium_checkout = 'PDFium' in self.builder_name |
| 224 | 96 |
| 225 # Obtain the spec for this builder. Use it to set more properties. | 97 self.builder_cfg = self.m.builder_name_schema.DictForBuilderName( |
| 226 self.builder_spec = get_builder_spec(self.m, self.builder_name) | 98 self.builder_name) |
| 99 self.role = self.builder_cfg['role'] |
| 100 if self.role == self.m.builder_name_schema.BUILDER_ROLE_HOUSEKEEPER: |
| 101 self.configuration = CONFIG_RELEASE |
| 102 else: |
| 103 self.configuration = self.builder_cfg.get('configuration', CONFIG_DEBUG) |
| 104 arch = (self.builder_cfg.get('arch') or self.builder_cfg.get('target_arch')) |
| 105 if ('Win' in self.builder_cfg.get('os', '') and arch == 'x86_64'): |
| 106 self.configuration += '_x64' |
| 227 | 107 |
| 228 self.builder_cfg = self.builder_spec['builder_cfg'] | |
| 229 self.role = self.builder_cfg['role'] | |
| 230 | |
| 231 self.configuration = self.builder_spec['configuration'] | |
| 232 self.default_env.update({'SKIA_OUT': self.skia_out, | 108 self.default_env.update({'SKIA_OUT': self.skia_out, |
| 233 'BUILDTYPE': self.configuration}) | 109 'BUILDTYPE': self.configuration}) |
| 234 self.do_compile_steps = self.builder_spec.get('do_compile_steps', True) | |
| 235 self.do_test_steps = self.builder_spec['do_test_steps'] | |
| 236 self.do_perf_steps = self.builder_spec['do_perf_steps'] | |
| 237 self.is_trybot = self.builder_cfg['is_trybot'] | 110 self.is_trybot = self.builder_cfg['is_trybot'] |
| 238 self.issue = None | 111 self.issue = None |
| 239 self.patchset = None | 112 self.patchset = None |
| 240 self.rietveld = None | 113 self.rietveld = None |
| 241 if self.is_trybot: | 114 if self.is_trybot: |
| 242 self.issue = self.m.properties['issue'] | 115 self.issue = self.m.properties['issue'] |
| 243 self.patchset = self.m.properties['patchset'] | 116 self.patchset = self.m.properties['patchset'] |
| 244 self.rietveld = self.m.properties['rietveld'] | 117 self.rietveld = self.m.properties['rietveld'] |
| 245 self.upload_dm_results = self.builder_spec['upload_dm_results'] | |
| 246 self.upload_perf_results = self.builder_spec['upload_perf_results'] | |
| 247 self.dm_dir = self.m.path.join( | 118 self.dm_dir = self.m.path.join( |
| 248 self.swarming_out_dir, 'dm') | 119 self.swarming_out_dir, 'dm') |
| 249 self.perf_data_dir = self.m.path.join(self.swarming_out_dir, | 120 self.perf_data_dir = self.m.path.join(self.swarming_out_dir, |
| 250 'perfdata', self.builder_name, 'data') | 121 'perfdata', self.builder_name, 'data') |
| 122 |
| 123 @property |
| 124 def upload_dm_results(self): |
| 125 # TODO(borenet): Move this into the swarm_test recipe. |
| 126 skip_upload_bots = [ |
| 127 'ASAN', |
| 128 'Coverage', |
| 129 'MSAN', |
| 130 'TSAN', |
| 131 'UBSAN', |
| 132 'Valgrind', |
| 133 ] |
| 134 upload_dm_results = True |
| 135 for s in skip_upload_bots: |
| 136 if s in self.m.properties['buildername']: |
| 137 upload_dm_results = False |
| 138 break |
| 139 return upload_dm_results |
| 140 |
| 141 @property |
| 142 def upload_perf_results(self): |
| 143 # TODO(borenet): Move this into the swarm_perf recipe. |
| 144 return ('Release' in self.m.properties['buildername']) |
| OLD | NEW |