| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 compile_targets = self.m.chromium_tests.get_compile_targets( | 176 compile_targets = self.m.chromium_tests.get_compile_targets( |
| 177 bot_config, bot_db, tests=[]) | 177 bot_config, bot_db, tests=[]) |
| 178 if self.m.chromium.c.TARGET_PLATFORM == 'android': | 178 if self.m.chromium.c.TARGET_PLATFORM == 'android': |
| 179 self.m.chromium_android.clean_local_files() | 179 self.m.chromium_android.clean_local_files() |
| 180 compile_targets = None | 180 compile_targets = None |
| 181 else: | 181 else: |
| 182 # Removes any chrome temporary files or build.dead directories. | 182 # Removes any chrome temporary files or build.dead directories. |
| 183 self.m.chromium.cleanup_temp() | 183 self.m.chromium.cleanup_temp() |
| 184 | 184 |
| 185 if 'With Patch' in name: | 185 if 'With Patch' in name: |
| 186 # We've had some cases where a stale build directory was used on perf try
job, |
| 187 # leading to unwanted cache and temp data. The best way to ensure |
| 188 # the old build directory is removed before doing any compilation. |
| 189 self.m.file.rmtree( |
| 190 'build directory', |
| 191 self.m.chromium.c.build_dir.join(self.m.chromium.c.build_config_fs)) |
| 192 |
| 186 self.m.chromium_tests.transient_check( | 193 self.m.chromium_tests.transient_check( |
| 187 update_step, | 194 update_step, |
| 188 lambda transform_name: self.m.chromium_tests.run_mb_and_compile( | 195 lambda transform_name: self.m.chromium_tests.run_mb_and_compile( |
| 189 compile_targets, None, name_suffix=transform_name(''))) | 196 compile_targets, None, name_suffix=transform_name(''))) |
| 190 else: | 197 else: |
| 191 self.m.chromium_tests.run_mb_and_compile( | 198 self.m.chromium_tests.run_mb_and_compile( |
| 192 compile_targets, None, name_suffix=' %s' % name) | 199 compile_targets, None, name_suffix=' %s' % name) |
| 193 | 200 |
| 194 def _run_test(self, cfg, **kwargs): | 201 def _run_test(self, cfg, **kwargs): |
| 195 """Runs test from config and return results.""" | 202 """Runs test from config and return results.""" |
| 196 values, overall_output, retcodes = self.m.bisect_tester.run_test( | 203 values, overall_output, retcodes = self.m.bisect_tester.run_test( |
| 197 cfg, **kwargs) | 204 cfg, **kwargs) |
| 198 all_values = self.m.bisect_tester.digest_run_results(values, retcodes, cfg) | 205 all_values = self.m.bisect_tester.digest_run_results(values, retcodes, cfg) |
| 199 overall_success = True | 206 overall_success = True |
| 200 if (not kwargs.get('allow_flakes', True) and | 207 if (not kwargs.get('allow_flakes', True) and |
| 201 cfg.get('test_type', 'perf') != 'return_code'): | 208 cfg.get('test_type', 'perf') != 'return_code'): |
| 202 overall_success = all(v == 0 for v in retcodes) | 209 overall_success = all(v == 0 for v in retcodes) |
| 203 if not overall_success: # pragma: no cover | |
| 204 raise self.m.step.StepFailure( | |
| 205 'Patched version failed to run performance test.') | |
| 206 return { | 210 return { |
| 207 'results': all_values, | 211 'results': all_values, |
| 208 'ret_code': overall_success, | 212 'ret_code': overall_success, |
| 209 'output': ''.join(overall_output) | 213 'output': ''.join(overall_output) |
| 210 } | 214 } |
| 211 | 215 |
| 212 def _build_and_run_tests(self, cfg, update_step, bot_db, revision, | 216 def _build_and_run_tests(self, cfg, update_step, bot_db, revision, |
| 213 **kwargs): | 217 **kwargs): |
| 214 """Compiles binaries and runs tests for a given a revision.""" | 218 """Compiles binaries and runs tests for a given a revision.""" |
| 215 update_step = self._checkout_revision(update_step, bot_db, revision) | 219 update_step = self._checkout_revision(update_step, bot_db, revision) |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 511 |
| 508 def _prepend_src_to_path_in_command(test_cfg): | 512 def _prepend_src_to_path_in_command(test_cfg): |
| 509 command_to_run = [] | 513 command_to_run = [] |
| 510 for v in test_cfg.get('command').split(): | 514 for v in test_cfg.get('command').split(): |
| 511 if v in ['./tools/perf/run_benchmark', | 515 if v in ['./tools/perf/run_benchmark', |
| 512 'tools/perf/run_benchmark', | 516 'tools/perf/run_benchmark', |
| 513 'tools\\perf\\run_benchmark']: | 517 'tools\\perf\\run_benchmark']: |
| 514 v = 'src/tools/perf/run_benchmark' | 518 v = 'src/tools/perf/run_benchmark' |
| 515 command_to_run.append(v) | 519 command_to_run.append(v) |
| 516 test_cfg.update({'command': ' '.join(command_to_run)}) | 520 test_cfg.update({'command': ' '.join(command_to_run)}) |
| OLD | NEW |