| 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 |
| 24 import nanobench_flags |
| 23 | 25 |
| 24 | 26 |
| 25 def lineno(): | 27 def lineno(): |
| 26 caller = inspect.stack()[1] # Up one level to our caller. | 28 caller = inspect.stack()[1] # Up one level to our caller. |
| 27 return inspect.getframeinfo(caller[0]).lineno | 29 return inspect.getframeinfo(caller[0]).lineno |
| 28 | 30 |
| 29 # Since we don't actually start coverage until we're in the self-test, | 31 # Since we don't actually start coverage until we're in the self-test, |
| 30 # some function def lines aren't reported as covered. Add them to this | 32 # some function def lines aren't reported as covered. Add them to this |
| 31 # list so that we can ignore them. | 33 # list so that we can ignore them. |
| 32 cov_skip = [] | 34 cov_skip = [] |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 def get_builder_spec(builder_name): | 218 def get_builder_spec(builder_name): |
| 217 builder_dict = builder_name_schema.DictForBuilderName(builder_name) | 219 builder_dict = builder_name_schema.DictForBuilderName(builder_name) |
| 218 env = get_extra_env_vars(builder_dict) | 220 env = get_extra_env_vars(builder_dict) |
| 219 gyp_defs = gyp_defines(builder_dict) | 221 gyp_defs = gyp_defines(builder_dict) |
| 220 gyp_defs_list = ['%s=%s' % (k, v) for k, v in gyp_defs.iteritems()] | 222 gyp_defs_list = ['%s=%s' % (k, v) for k, v in gyp_defs.iteritems()] |
| 221 gyp_defs_list.sort() | 223 gyp_defs_list.sort() |
| 222 env['GYP_DEFINES'] = ' '.join(gyp_defs_list) | 224 env['GYP_DEFINES'] = ' '.join(gyp_defs_list) |
| 223 rv = { | 225 rv = { |
| 224 'build_targets': build_targets_from_builder_dict(builder_dict), | 226 'build_targets': build_targets_from_builder_dict(builder_dict), |
| 225 'builder_cfg': builder_dict, | 227 'builder_cfg': builder_dict, |
| 228 'dm_flags': dm_flags.get_args(builder_name), |
| 226 'env': env, | 229 'env': env, |
| 230 'nanobench_flags': nanobench_flags.get_args(builder_name), |
| 227 } | 231 } |
| 228 device = device_cfg(builder_dict) | 232 device = device_cfg(builder_dict) |
| 229 if device: | 233 if device: |
| 230 rv['device_cfg'] = device | 234 rv['device_cfg'] = device |
| 231 return rv | 235 return rv |
| 232 | 236 |
| 233 | 237 |
| 234 cov_end = lineno() # Don't care about code coverage past here. | 238 cov_end = lineno() # Don't care about code coverage past here. |
| 235 | 239 |
| 236 | 240 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 if len(sys.argv) == 2 and sys.argv[1] == 'test': | 287 if len(sys.argv) == 2 and sys.argv[1] == 'test': |
| 284 self_test() | 288 self_test() |
| 285 sys.exit(0) | 289 sys.exit(0) |
| 286 | 290 |
| 287 if len(sys.argv) != 3: | 291 if len(sys.argv) != 3: |
| 288 print usage | 292 print usage |
| 289 sys.exit(1) | 293 sys.exit(1) |
| 290 | 294 |
| 291 with open(sys.argv[1], 'w') as out: | 295 with open(sys.argv[1], 'w') as out: |
| 292 json.dump(get_builder_spec(sys.argv[2]), out) | 296 json.dump(get_builder_spec(sys.argv[2]), out) |
| OLD | NEW |