Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: scripts/slave/recipe_modules/chromium_tests/api.py

Issue 1575393002: Enhance chromium_tests.configure_build for generalized trybot mirroring (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 collections 6 import collections
7 import contextlib 7 import contextlib
8 import copy 8 import copy
9 import itertools 9 import itertools
10 import json 10 import json
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return trybots.TRYBOTS 66 return trybots.TRYBOTS
67 67
68 def add_builders(self, builders): 68 def add_builders(self, builders):
69 """Adds builders to our builder map""" 69 """Adds builders to our builder map"""
70 self._builders.update(builders) 70 self._builders.update(builders)
71 71
72 def _get_bot_config(self, mastername, buildername): 72 def _get_bot_config(self, mastername, buildername):
73 master_dict = self.builders.get(mastername, {}) 73 master_dict = self.builders.get(mastername, {})
74 return freeze(master_dict.get('builders', {}).get(buildername)) 74 return freeze(master_dict.get('builders', {}).get(buildername))
75 75
76 def configure_build(self, mastername, buildername, override_bot_type=None): 76 def _configure_build(self, bot_config, override_bot_type=None):
77 master_dict = self.builders.get(mastername, {})
78 bot_config = master_dict.get('builders', {}).get(buildername)
79
80 # Get the buildspec version. It can be supplied as a build property or as 77 # Get the buildspec version. It can be supplied as a build property or as
81 # a recipe config value. 78 # a recipe config value.
82 buildspec_version = (self.m.properties.get('buildspec_version') or 79 buildspec_version = (self.m.properties.get('buildspec_version') or
83 bot_config.get('buildspec_version')) 80 bot_config.get('buildspec_version'))
84 81
85 self.m.chromium.set_config( 82 self.m.chromium.set_config(
86 bot_config.get('chromium_config'), 83 bot_config.get('chromium_config'),
87 **bot_config.get('chromium_config_kwargs', {})) 84 **bot_config.get('chromium_config_kwargs', {}))
88 85
89 # Set GYP_DEFINES explicitly because chromium config constructor does 86 # Set GYP_DEFINES explicitly because chromium config constructor does
90 # not support that. 87 # not support that.
91 self.m.chromium.c.gyp_env.GYP_DEFINES.update( 88 self.m.chromium.c.gyp_env.GYP_DEFINES.update(
92 bot_config.get('GYP_DEFINES', {})) 89 bot_config.get('GYP_DEFINES', {}))
93 if bot_config.get('use_isolate'): 90 if bot_config.get('use_isolate'):
94 self.m.isolate.set_isolate_environment(self.m.chromium.c) 91 self.m.isolate.set_isolate_environment(self.m.chromium.c)
95 92
96 self.m.gclient.set_config( 93 self.m.gclient.set_config(
97 bot_config.get('gclient_config'), 94 bot_config.get('gclient_config'),
98 PATCH_PROJECT=self.m.properties.get('patch_project'), 95 PATCH_PROJECT=self.m.properties.get('patch_project'),
99 BUILDSPEC_VERSION=buildspec_version, 96 BUILDSPEC_VERSION=buildspec_version,
100 **bot_config.get('gclient_config_kwargs', {})) 97 **bot_config.get('gclient_config_kwargs', {}))
101 98
102 if 'android_config' in bot_config: 99 if bot_config.get('android_config'):
103 self.m.chromium_android.configure_from_properties( 100 self.m.chromium_android.configure_from_properties(
104 bot_config['android_config'], 101 bot_config.get('android_config'),
105 **bot_config.get('chromium_config_kwargs', {})) 102 **bot_config.get('chromium_config_kwargs', {}))
106 103
107 if 'amp_config' in bot_config: 104 if bot_config.get('amp_config'):
108 self.m.amp.set_config(bot_config['amp_config']) 105 self.m.amp.set_config(bot_config.get('amp_config'))
109 106
110 for c in bot_config.get('chromium_apply_config', []): 107 for c in bot_config.get('chromium_apply_config', []):
111 self.m.chromium.apply_config(c) 108 self.m.chromium.apply_config(c)
112 109
113 for c in bot_config.get('gclient_apply_config', []): 110 for c in bot_config.get('gclient_apply_config', []):
114 self.m.gclient.apply_config(c) 111 self.m.gclient.apply_config(c)
115 112
116 # WARNING: src-side runtest.py is only tested with chromium CQ builders. 113 # WARNING: src-side runtest.py is only tested with chromium CQ builders.
117 # Usage not covered by chromium CQ is not supported and can break 114 # Usage not covered by chromium CQ is not supported and can break
118 # without notice. 115 # without notice.
119 if master_dict.get('settings', {}).get('src_side_runtest_py'): 116 if bot_config.get_master_setting('src_side_runtest_py'):
120 self.m.chromium.c.runtest_py.src_side = True 117 self.m.chromium.c.runtest_py.src_side = True
121 118
122 if bot_config.get('goma_canary'): 119 if bot_config.get('goma_canary'):
123 self.m.goma.update_goma_canary(buildername) 120 self.m.goma.update_goma_canary()
124 121
125 bot_type = override_bot_type or bot_config.get('bot_type', 'builder_tester') 122 bot_type = override_bot_type or bot_config.get('bot_type', 'builder_tester')
126 123
127 if bot_config.get('set_component_rev'): 124 if bot_config.get('set_component_rev'):
128 # If this is a component build and the main revision is e.g. blink, 125 # If this is a component build and the main revision is e.g. blink,
129 # webrtc, or v8, the custom deps revision of this component must be 126 # webrtc, or v8, the custom deps revision of this component must be
130 # dynamically set to either: 127 # dynamically set to either:
131 # (1) the revision of the builder if this is a tester, 128 # (1) the revision of the builder if this is a tester,
132 # (2) 'revision' from the waterfall, or 129 # (2) 'revision' from the waterfall, or
133 # (3) 'HEAD' for forced builds with unspecified 'revision'. 130 # (3) 'HEAD' for forced builds with unspecified 'revision'.
134 # TODO(machenbach): Use parent_got_cr_revision on testers with component 131 # TODO(machenbach): Use parent_got_cr_revision on testers with component
135 # builds to match also the chromium revision from the builder. 132 # builds to match also the chromium revision from the builder.
136 component_rev = self.m.properties.get('revision') or 'HEAD' 133 component_rev = self.m.properties.get('revision') or 'HEAD'
137 if bot_type == 'tester': 134 if bot_type == 'tester':
138 component_rev = self.m.properties.get( 135 component_rev = self.m.properties.get(
139 'parent_got_revision', component_rev) 136 'parent_got_revision', component_rev)
140 dep = bot_config.get('set_component_rev') 137 dep = bot_config.get('set_component_rev')
141 self.m.gclient.c.revisions[dep['name']] = dep['rev_str'] % component_rev 138 self.m.gclient.c.revisions[dep['name']] = dep['rev_str'] % component_rev
142 139
140 def configure_build(self, mastername, buildername, override_bot_type=None):
141 self._configure_build(
142 bdb_module.BotConfig(
143 self.builders,
Sergiy Byelozyorov 2016/01/12 15:03:56 Where is this populated? Is it always guaranteed t
Paweł Hajdan Jr. 2016/01/12 15:05:38 We rely on existing assumptions - the original cod
Sergiy Byelozyorov 2016/01/12 15:10:28 Thanks for pointing this out. I didn't notice it a
144 [{'mastername': mastername, 'buildername': buildername}]
145 ), override_bot_type)
146
143 def ensure_checkout(self, mastername, buildername, 147 def ensure_checkout(self, mastername, buildername,
144 root_solution_revision=None): 148 root_solution_revision=None):
145 bot_config = self._get_bot_config(mastername, buildername) 149 bot_config = self._get_bot_config(mastername, buildername)
146 150
147 if self.m.platform.is_win: 151 if self.m.platform.is_win:
148 self.m.chromium.taskkill() 152 self.m.chromium.taskkill()
149 153
150 # Bot Update re-uses the gclient configs. 154 # Bot Update re-uses the gclient configs.
151 update_step = self.m.bot_update.ensure_checkout( 155 update_step = self.m.bot_update.ensure_checkout(
152 patch_root=bot_config.get('patch_root'), 156 patch_root=bot_config.get('patch_root'),
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 result_text = 'MB is enabled for this builder at this revision.' 897 result_text = 'MB is enabled for this builder at this revision.'
894 log_name = 'Builder MB-ready' 898 log_name = 'Builder MB-ready'
895 self.m.step.active_result.presentation.logs[log_name] = [result_text] 899 self.m.step.active_result.presentation.logs[log_name] = [result_text]
896 return False 900 return False
897 except (self.m.step.StepFailure, KeyError): 901 except (self.m.step.StepFailure, KeyError):
898 result_text = 'MB is not enabled for this builder at this revision.' 902 result_text = 'MB is not enabled for this builder at this revision.'
899 log_name = 'Builder NOT MB-ready' 903 log_name = 'Builder NOT MB-ready'
900 self.m.step.active_result.presentation.logs[log_name] = [result_text] 904 self.m.step.active_result.presentation.logs[log_name] = [result_text]
901 self.m.step.active_result.presentation.status = self.m.step.WARNING 905 self.m.step.active_result.presentation.status = self.m.step.WARNING
902 return True 906 return True
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698