| OLD | NEW |
| 1 # | 1 # |
| 2 # Copyright 2015 Google Inc. | 2 # Copyright 2015 Google Inc. |
| 3 # | 3 # |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 # | 6 # |
| 7 | 7 |
| 8 #!/usr/bin/env python | 8 #!/usr/bin/env python |
| 9 | 9 |
| 10 usage = ''' | 10 usage = ''' |
| 11 Write buildbot spec to outfile based on the bot name: | 11 Write buildbot spec to outfile based on the bot name: |
| 12 $ python buildbot_spec.py outfile Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug | 12 $ python buildbot_spec.py outfile Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug |
| 13 Or run self-tests: | 13 Or run self-tests: |
| 14 $ python buildbot_spec.py test | 14 $ python buildbot_spec.py test |
| 15 ''' | 15 ''' |
| 16 | 16 |
| 17 import inspect | 17 import inspect |
| 18 import json | 18 import json |
| 19 import os | 19 import os |
| 20 import sys | 20 import sys |
| 21 | 21 |
| 22 import builder_name_schema | 22 import builder_name_schema |
| 23 import dm_flags | 23 import dm_flags |
| 24 import nanobench_flags | 24 import nanobench_flags |
| 25 | 25 |
| 26 | 26 |
| 27 CONFIG_DEBUG = 'Debug' |
| 28 CONFIG_RELEASE = 'Release' |
| 29 |
| 30 |
| 27 def lineno(): | 31 def lineno(): |
| 28 caller = inspect.stack()[1] # Up one level to our caller. | 32 caller = inspect.stack()[1] # Up one level to our caller. |
| 29 return inspect.getframeinfo(caller[0]).lineno | 33 return inspect.getframeinfo(caller[0]).lineno |
| 30 | 34 |
| 31 # Since we don't actually start coverage until we're in the self-test, | 35 # Since we don't actually start coverage until we're in the self-test, |
| 32 # some function def lines aren't reported as covered. Add them to this | 36 # some function def lines aren't reported as covered. Add them to this |
| 33 # list so that we can ignore them. | 37 # list so that we can ignore them. |
| 34 cov_skip = [] | 38 cov_skip = [] |
| 35 | 39 |
| 36 cov_start = lineno()+1 # We care about coverage starting just past this def. | 40 cov_start = lineno()+1 # We care about coverage starting just past this def. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 # skia_use_android_framework_defines. | 147 # skia_use_android_framework_defines. |
| 144 if builder_dict.get('extra_config') == 'Android_FrameworkDefs': | 148 if builder_dict.get('extra_config') == 'Android_FrameworkDefs': |
| 145 gyp_defs['skia_use_android_framework_defines'] = '1' | 149 gyp_defs['skia_use_android_framework_defines'] = '1' |
| 146 | 150 |
| 147 return gyp_defs | 151 return gyp_defs |
| 148 | 152 |
| 149 | 153 |
| 150 cov_skip.extend([lineno(), lineno() + 1]) | 154 cov_skip.extend([lineno(), lineno() + 1]) |
| 151 def get_extra_env_vars(builder_dict): | 155 def get_extra_env_vars(builder_dict): |
| 152 env = {} | 156 env = {} |
| 153 if builder_dict.get('compiler') == 'Clang': | 157 if builder_dict.get('configuration') == 'Coverage': |
| 158 # We have to use Clang 3.6 because earlier versions do not support the |
| 159 # compile flags we use and 3.7 and 3.8 hit asserts during compilation. |
| 160 env['CC'] = '/usr/bin/clang-3.6' |
| 161 env['CXX'] = '/usr/bin/clang++-3.6' |
| 162 elif builder_dict.get('compiler') == 'Clang': |
| 154 env['CC'] = '/usr/bin/clang' | 163 env['CC'] = '/usr/bin/clang' |
| 155 env['CXX'] = '/usr/bin/clang++' | 164 env['CXX'] = '/usr/bin/clang++' |
| 156 return env | 165 return env |
| 157 | 166 |
| 158 | 167 |
| 159 cov_skip.extend([lineno(), lineno() + 1]) | 168 cov_skip.extend([lineno(), lineno() + 1]) |
| 160 def build_targets_from_builder_dict(builder_dict): | 169 def build_targets_from_builder_dict(builder_dict): |
| 161 """Return a list of targets to build, depending on the builder type.""" | 170 """Return a list of targets to build, depending on the builder type.""" |
| 162 if builder_dict['role'] in ('Test', 'Perf') and builder_dict['os'] == 'iOS': | 171 if builder_dict['role'] in ('Test', 'Perf') and builder_dict['os'] == 'iOS': |
| 163 return ['iOSShell'] | 172 return ['iOSShell'] |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 rv = { | 234 rv = { |
| 226 'build_targets': build_targets_from_builder_dict(builder_dict), | 235 'build_targets': build_targets_from_builder_dict(builder_dict), |
| 227 'builder_cfg': builder_dict, | 236 'builder_cfg': builder_dict, |
| 228 'dm_flags': dm_flags.get_args(builder_name), | 237 'dm_flags': dm_flags.get_args(builder_name), |
| 229 'env': env, | 238 'env': env, |
| 230 'nanobench_flags': nanobench_flags.get_args(builder_name), | 239 'nanobench_flags': nanobench_flags.get_args(builder_name), |
| 231 } | 240 } |
| 232 device = device_cfg(builder_dict) | 241 device = device_cfg(builder_dict) |
| 233 if device: | 242 if device: |
| 234 rv['device_cfg'] = device | 243 rv['device_cfg'] = device |
| 244 |
| 245 role = builder_dict['role'] |
| 246 if role == builder_name_schema.BUILDER_ROLE_HOUSEKEEPER: |
| 247 configuration = CONFIG_RELEASE |
| 248 else: |
| 249 configuration = builder_dict.get( |
| 250 'configuration', CONFIG_DEBUG) |
| 251 arch = (builder_dict.get('arch') or builder_dict.get('target_arch')) |
| 252 if ('Win' in builder_dict.get('os', '') and arch == 'x86_64'): |
| 253 configuration += '_x64' |
| 254 rv['configuration'] = configuration |
| 255 rv['do_test_steps'] = role == builder_name_schema.BUILDER_ROLE_TEST |
| 256 rv['do_perf_steps'] = (role == builder_name_schema.BUILDER_ROLE_PERF or |
| 257 (role == builder_name_schema.BUILDER_ROLE_TEST and |
| 258 configuration == CONFIG_DEBUG) or |
| 259 'Valgrind' in builder_name) |
| 260 |
| 261 # Do we upload perf results? |
| 262 upload_perf_results = False |
| 263 if role == builder_name_schema.BUILDER_ROLE_PERF: |
| 264 upload_perf_results = True |
| 265 rv['upload_perf_results'] = upload_perf_results |
| 266 |
| 267 # Do we upload correctness results? |
| 268 skip_upload_bots = [ |
| 269 'ASAN', |
| 270 'Coverage', |
| 271 'TSAN', |
| 272 'UBSAN', |
| 273 'Valgrind', |
| 274 ] |
| 275 upload_dm_results = True |
| 276 for s in skip_upload_bots: |
| 277 if s in builder_name: |
| 278 upload_dm_results = False |
| 279 break |
| 280 rv['upload_dm_results'] = upload_dm_results |
| 281 |
| 235 return rv | 282 return rv |
| 236 | 283 |
| 237 | 284 |
| 238 cov_end = lineno() # Don't care about code coverage past here. | 285 cov_end = lineno() # Don't care about code coverage past here. |
| 239 | 286 |
| 240 | 287 |
| 241 def self_test(): | 288 def self_test(): |
| 242 import coverage # This way the bots don't need coverage.py to be installed. | 289 import coverage # This way the bots don't need coverage.py to be installed. |
| 243 args = {} | 290 args = {} |
| 244 cases = [ | 291 cases = [ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 if len(sys.argv) == 2 and sys.argv[1] == 'test': | 334 if len(sys.argv) == 2 and sys.argv[1] == 'test': |
| 288 self_test() | 335 self_test() |
| 289 sys.exit(0) | 336 sys.exit(0) |
| 290 | 337 |
| 291 if len(sys.argv) != 3: | 338 if len(sys.argv) != 3: |
| 292 print usage | 339 print usage |
| 293 sys.exit(1) | 340 sys.exit(1) |
| 294 | 341 |
| 295 with open(sys.argv[1], 'w') as out: | 342 with open(sys.argv[1], 'w') as out: |
| 296 json.dump(get_builder_spec(sys.argv[2]), out) | 343 json.dump(get_builder_spec(sys.argv[2]), out) |
| OLD | NEW |