Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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): | 178 if 'With Patch' in name: # pragma: no cover |
| 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 | 179 # We've had some cases where a stale build directory was used on perf |
|
RobertoCN
2016/07/14 22:12:54
This removal is incomplete. probably a rebase arti
Ziqi Xiong
2016/07/14 22:43:59
Done.
| |
| 188 # try job leading to unwanted cache and temp data. The best way to | 180 # try job leading to unwanted cache and temp data. The best way to |
| 189 # ensure the old build directory is removed before doing any | 181 # ensure the old build directory is removed before doing any |
| 190 # compilation. | 182 # compilation. |
| 191 self.m.file.rmtree( | 183 self.m.file.rmtree( |
| 192 'build directory', | 184 'build directory', |
| 193 self.m.chromium.c.build_dir.join(self.m.chromium.c.build_config_fs)) | 185 self.m.chromium.c.build_dir.join(self.m.chromium.c.build_config_fs)) |
| 194 self.m.chromium_tests.transient_check( | 186 self.m.chromium_tests.transient_check( |
| 195 update_step, | 187 update_step, |
| 196 lambda transform_name: self.m.chromium_tests.run_mb_and_compile( | 188 lambda transform_name: self.m.chromium_tests.run_mb_and_compile( |
| 197 compile_targets, None, name_suffix=transform_name(''))) | 189 compile_targets, None, name_suffix=transform_name(''))) |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 526 | 518 |
| 527 def _prepend_src_to_path_in_command(test_cfg): | 519 def _prepend_src_to_path_in_command(test_cfg): |
| 528 command_to_run = [] | 520 command_to_run = [] |
| 529 for v in test_cfg.get('command').split(): | 521 for v in test_cfg.get('command').split(): |
| 530 if v in ['./tools/perf/run_benchmark', | 522 if v in ['./tools/perf/run_benchmark', |
| 531 'tools/perf/run_benchmark', | 523 'tools/perf/run_benchmark', |
| 532 'tools\\perf\\run_benchmark']: | 524 'tools\\perf\\run_benchmark']: |
| 533 v = 'src/tools/perf/run_benchmark' | 525 v = 'src/tools/perf/run_benchmark' |
| 534 command_to_run.append(v) | 526 command_to_run.append(v) |
| 535 test_cfg.update({'command': ' '.join(command_to_run)}) | 527 test_cfg.update({'command': ' '.join(command_to_run)}) |
| OLD | NEW |