| 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 import ast | 5 import ast |
| 6 import copy | 6 import copy |
| 7 | 7 |
| 8 from recipe_engine.types import freeze | 8 from recipe_engine.types import freeze |
| 9 | 9 |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 return { buildername: bot_config['test_spec'] } | 63 return { buildername: bot_config['test_spec'] } |
| 64 | 64 |
| 65 test_spec_file = bot_config.get('testing', {}).get( | 65 test_spec_file = bot_config.get('testing', {}).get( |
| 66 'test_spec_file', '%s.json' % mastername) | 66 'test_spec_file', '%s.json' % mastername) |
| 67 | 67 |
| 68 # TODO(phajdan.jr): Bots should have no generators instead. | 68 # TODO(phajdan.jr): Bots should have no generators instead. |
| 69 if bot_config.get('disable_tests'): | 69 if bot_config.get('disable_tests'): |
| 70 return {} | 70 return {} |
| 71 return chromium_tests_api.read_test_spec(chromium_tests_api.m, test_spec_fil
e) | 71 return chromium_tests_api.read_test_spec(chromium_tests_api.m, test_spec_fil
e) |
| 72 | 72 |
| 73 def initialize_bot_db(self, chromium_tests_api, bot_db): | 73 def initialize_bot_db(self, chromium_tests_api, bot_db, bot_update_step): |
| 74 # TODO(phajdan.jr): Make this work for more than 1 bot. | 74 # TODO(phajdan.jr): Make this work for more than 1 bot. |
| 75 assert len(self._bot_ids) == 1 | 75 assert len(self._bot_ids) == 1 |
| 76 | 76 |
| 77 bot_config = self._get_bot_config(self._bot_ids[0]) | 77 bot_config = self._get_bot_config(self._bot_ids[0]) |
| 78 mastername = self._bot_ids[0]['mastername'] | 78 mastername = self._bot_ids[0]['mastername'] |
| 79 buildername = self._bot_ids[0]['buildername'] | 79 buildername = self._bot_ids[0]['buildername'] |
| 80 | 80 |
| 81 test_spec = self._get_test_spec(chromium_tests_api) | 81 test_spec = self._get_test_spec(chromium_tests_api) |
| 82 | 82 |
| 83 # TODO(phajdan.jr): Bots should have no generators instead. | 83 # TODO(phajdan.jr): Bots should have no generators instead. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 96 builder_dict = builders[loop_buildername] = ( | 96 builder_dict = builders[loop_buildername] = ( |
| 97 dict(builders[loop_buildername])) | 97 dict(builders[loop_buildername])) |
| 98 builders[loop_buildername]['tests'] = ( | 98 builders[loop_buildername]['tests'] = ( |
| 99 chromium_tests_api.generate_tests_from_test_spec( | 99 chromium_tests_api.generate_tests_from_test_spec( |
| 100 chromium_tests_api.m, test_spec, builder_dict, | 100 chromium_tests_api.m, test_spec, builder_dict, |
| 101 loop_buildername, mastername, | 101 loop_buildername, mastername, |
| 102 # TODO(phajdan.jr): Get enable_swarming value from builder_dict. | 102 # TODO(phajdan.jr): Get enable_swarming value from builder_dict. |
| 103 # Above should remove the need to get bot_config and buildername | 103 # Above should remove the need to get bot_config and buildername |
| 104 # in this method. | 104 # in this method. |
| 105 bot_config.get('enable_swarming', False), | 105 bot_config.get('enable_swarming', False), |
| 106 scripts_compile_targets, builder_dict.get('test_generators', []) | 106 scripts_compile_targets, builder_dict.get('test_generators', []), |
| 107 bot_update_step |
| 107 )) | 108 )) |
| 108 | 109 |
| 109 bot_db._add_master_dict_and_test_spec( | 110 bot_db._add_master_dict_and_test_spec( |
| 110 mastername, freeze(master_dict), freeze(test_spec)) | 111 mastername, freeze(master_dict), freeze(test_spec)) |
| 111 | 112 |
| 112 def should_force_legacy_compiling(self, chromium_tests_api): | 113 def should_force_legacy_compiling(self, chromium_tests_api): |
| 113 """Determines if a given chromium revision needs to be built with gyp. | 114 """Determines if a given chromium revision needs to be built with gyp. |
| 114 | 115 |
| 115 This is done by checking the contents of tools/mb/mb_config.pyl at the rev. | 116 This is done by checking the contents of tools/mb/mb_config.pyl at the rev. |
| 116 | 117 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 """A generator of all the (buildername, bot_config) tuples whose | 222 """A generator of all the (buildername, bot_config) tuples whose |
| 222 parent_buildername is the passed one on the given master. | 223 parent_buildername is the passed one on the given master. |
| 223 """ | 224 """ |
| 224 for buildername, bot_config in self._db[mastername]['master_dict'].get( | 225 for buildername, bot_config in self._db[mastername]['master_dict'].get( |
| 225 'builders', {}).iteritems(): | 226 'builders', {}).iteritems(): |
| 226 if bot_config.get('parent_buildername') == parent_buildername: | 227 if bot_config.get('parent_buildername') == parent_buildername: |
| 227 yield buildername, bot_config | 228 yield buildername, bot_config |
| 228 | 229 |
| 229 def get_test_spec(self, mastername, buildername): | 230 def get_test_spec(self, mastername, buildername): |
| 230 return self._db[mastername]['test_spec'].get(buildername, {}) | 231 return self._db[mastername]['test_spec'].get(buildername, {}) |
| OLD | NEW |