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

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

Issue 2104143003: Build delegation for CQ jobs (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Rebase against master Created 4 years, 5 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
« no previous file with comments | « no previous file | scripts/slave/recipes/bisection/android_bisect.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 """API for the perf try job recipe module. 5 """API for the perf try job recipe module.
6 6
7 This API is meant to enable the perf try job recipe on any chromium-supported 7 This API is meant to enable the perf try job recipe on any chromium-supported
8 platform for any test that can be run via buildbot, perf or otherwise. 8 platform for any test that can be run via buildbot, perf or otherwise.
9 """ 9 """
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 def run_cq_job(self, update_step, bot_db, files_in_patch): 105 def run_cq_job(self, update_step, bot_db, files_in_patch):
106 """Runs benchmarks affected by a CL on CQ.""" 106 """Runs benchmarks affected by a CL on CQ."""
107 buildername = self.m.properties['buildername'] 107 buildername = self.m.properties['buildername']
108 affected_benchmarks = self._get_affected_benchmarks(files_in_patch) 108 affected_benchmarks = self._get_affected_benchmarks(files_in_patch)
109 if not affected_benchmarks: 109 if not affected_benchmarks:
110 step_result = self.m.step('Results', []) 110 step_result = self.m.step('Results', [])
111 step_result.presentation.step_text = ( 111 step_result.presentation.step_text = (
112 'There are no modifications to Telemetry benchmarks,' 112 'There are no modifications to Telemetry benchmarks,'
113 ' aborting the try job.') 113 ' aborting the try job.')
114 return 114 return
115 self._compile('With Patch', self.m.properties['mastername'], 115 revision_hash = self.m.properties.get('parent_got_revision')
116 self.m.properties['buildername'], update_step, bot_db) 116 update_step = self._checkout_revision(update_step, bot_db, revision_hash)
117 if update_step.presentation.properties:
118 revision_hash = update_step.presentation.properties['got_revision']
119 revision = build_state.BuildState(self, revision_hash, True)
120 revision.request_build()
121 revision.wait_for()
122 revision.download_build(update_step, bot_db)
117 123
118 if self.m.chromium.c.TARGET_PLATFORM == 'android': 124 if self.m.chromium.c.TARGET_PLATFORM == 'android':
119 self.m.chromium_android.adb_install_apk('ChromePublic.apk') 125 self.m.chromium_android.adb_install_apk('ChromePublic.apk')
120 126
121 tests = self.m.chromium.list_perf_tests(_get_browser(buildername), 1) 127 tests = self.m.chromium.list_perf_tests(_get_browser(buildername), 1)
122 128
123 tests = dict((k, v) for k, v in tests.json.output['steps'].iteritems() 129 tests = dict((k, v) for k, v in tests.json.output['steps'].iteritems()
124 if _is_benchmark_match(k, affected_benchmarks)) 130 if _is_benchmark_match(k, affected_benchmarks))
125 131
126 if not tests: 132 if not tests:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 self.m.chromium.taskkill() 168 self.m.chromium.taskkill()
163 self.m.gclient.c.revisions['src'] = str(revision) 169 self.m.gclient.c.revisions['src'] = str(revision)
164 update_step = self.m.bot_update.ensure_checkout( 170 update_step = self.m.bot_update.ensure_checkout(
165 suffix=str(revision), force=True, patch=False, 171 suffix=str(revision), force=True, patch=False,
166 update_presentation=False) 172 update_presentation=False)
167 assert update_step.json.output['did_run'] 173 assert update_step.json.output['did_run']
168 self.m.chromium.runhooks(name='runhooks on %s' % str(revision)) 174 self.m.chromium.runhooks(name='runhooks on %s' % str(revision))
169 175
170 return update_step 176 return update_step
171 177
172 def _compile(self, name, mastername, buildername, update_step, bot_db):
173 """Runs compile and related steps for given builder."""
174 # TODO(phajdan.jr): Change this method to take bot_config as parameter.
175 bot_config = self.m.chromium_tests.create_bot_config_object(
176 mastername, buildername)
177 compile_targets = self.m.chromium_tests.get_compile_targets(
178 bot_config, bot_db, tests=[])
179 if self.m.chromium.c.TARGET_PLATFORM == 'android':
180 self.m.chromium_android.clean_local_files()
181 compile_targets = None
182 else:
183 # Removes any chrome temporary files or build.dead directories.
184 self.m.chromium.cleanup_temp()
185
186 if 'With Patch' in name:
187 # We've had some cases where a stale build directory was used on perf
188 # try job leading to unwanted cache and temp data. The best way to
189 # ensure the old build directory is removed before doing any
190 # compilation.
191 self.m.file.rmtree(
192 'build directory',
193 self.m.chromium.c.build_dir.join(self.m.chromium.c.build_config_fs))
194 self.m.chromium_tests.transient_check(
195 update_step,
196 lambda transform_name: self.m.chromium_tests.run_mb_and_compile(
197 compile_targets, None, name_suffix=transform_name('')))
198 else: # pragma: no cover
199 self.m.chromium_tests.run_mb_and_compile(
200 compile_targets, None, name_suffix=' %s' % name)
201
202 def _run_test(self, cfg, **kwargs): 178 def _run_test(self, cfg, **kwargs):
203 """Runs test from config and return results.""" 179 """Runs test from config and return results."""
204 values, overall_output, retcodes = self.m.bisect_tester.run_test( 180 values, overall_output, retcodes = self.m.bisect_tester.run_test(
205 cfg, **kwargs) 181 cfg, **kwargs)
206 all_values = self.m.bisect_tester.digest_run_results(values, retcodes, cfg) 182 all_values = self.m.bisect_tester.digest_run_results(values, retcodes, cfg)
207 overall_success = True 183 overall_success = True
208 if (not kwargs.get('allow_flakes', True) and 184 if (not kwargs.get('allow_flakes', True) and
209 cfg.get('test_type', 'perf') != 'return_code'): 185 cfg.get('test_type', 'perf') != 'return_code'):
210 overall_success = all(v == 0 for v in retcodes) 186 overall_success = all(v == 0 for v in retcodes)
211 return { 187 return {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 502
527 def _prepend_src_to_path_in_command(test_cfg): 503 def _prepend_src_to_path_in_command(test_cfg):
528 command_to_run = [] 504 command_to_run = []
529 for v in test_cfg.get('command').split(): 505 for v in test_cfg.get('command').split():
530 if v in ['./tools/perf/run_benchmark', 506 if v in ['./tools/perf/run_benchmark',
531 'tools/perf/run_benchmark', 507 'tools/perf/run_benchmark',
532 'tools\\perf\\run_benchmark']: 508 'tools\\perf\\run_benchmark']:
533 v = 'src/tools/perf/run_benchmark' 509 v = 'src/tools/perf/run_benchmark'
534 command_to_run.append(v) 510 command_to_run.append(v)
535 test_cfg.update({'command': ' '.join(command_to_run)}) 511 test_cfg.update({'command': ' '.join(command_to_run)})
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipes/bisection/android_bisect.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698