| 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 bisect recipe module. | 5 """API for the bisect recipe module. |
| 6 | 6 |
| 7 This API is meant to enable the bisect recipe to bisect any chromium-supported | 7 This API is meant to enable the bisect recipe to bisect 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 29 matching lines...) Expand all Loading... |
| 40 self.override_poll_interval = None | 40 self.override_poll_interval = None |
| 41 self.bot_db = None | 41 self.bot_db = None |
| 42 # Repo for triggering build jobs. | 42 # Repo for triggering build jobs. |
| 43 self.svn_repo_url = 'svn://svn.chromium.org/chrome-try/try-perf' | 43 self.svn_repo_url = 'svn://svn.chromium.org/chrome-try/try-perf' |
| 44 # The variable below are set and used for the internal bisects. | 44 # The variable below are set and used for the internal bisects. |
| 45 self.buildurl_gs_prefix = None | 45 self.buildurl_gs_prefix = None |
| 46 self.internal_bisect = False | 46 self.internal_bisect = False |
| 47 self.builder_bot = None | 47 self.builder_bot = None |
| 48 self.full_deploy_script = None | 48 self.full_deploy_script = None |
| 49 | 49 |
| 50 # Keep track of working directory (which contains the checkout). |
| 51 # None means "default value". |
| 52 self._working_dir = None |
| 53 |
| 50 def perform_bisect(self, **flags): | 54 def perform_bisect(self, **flags): |
| 51 return local_bisect.perform_bisect(self, **flags) | 55 return local_bisect.perform_bisect(self, **flags) |
| 52 | 56 |
| 53 def create_bisector(self, bisect_config_dict, dummy_mode=False, **flags): | 57 def create_bisector(self, bisect_config_dict, dummy_mode=False, **flags): |
| 54 """Passes the api and the config dictionary to the Bisector constructor. | 58 """Passes the api and the config dictionary to the Bisector constructor. |
| 55 | 59 |
| 56 For details about the keys in the bisect config dictionary go to: | 60 For details about the keys in the bisect config dictionary go to: |
| 57 http://chromium.org/developers/speed-infra/perf-try-bots-bisect-bots/config | 61 http://chromium.org/developers/speed-infra/perf-try-bots-bisect-bots/config |
| 58 | 62 |
| 59 Args: | 63 Args: |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 204 |
| 201 if skip_download: | 205 if skip_download: |
| 202 update_step = None | 206 update_step = None |
| 203 else: | 207 else: |
| 204 update_step = self._SyncRevisionToTest(test_config_params) | 208 update_step = self._SyncRevisionToTest(test_config_params) |
| 205 self.start_test_run_for_bisect(update_step, self.bot_db, | 209 self.start_test_run_for_bisect(update_step, self.bot_db, |
| 206 test_config_params, run_locally=True, | 210 test_config_params, run_locally=True, |
| 207 skip_download=skip_download) | 211 skip_download=skip_download) |
| 208 | 212 |
| 209 def ensure_checkout(self, *args, **kwargs): | 213 def ensure_checkout(self, *args, **kwargs): |
| 210 checkout_dir = self.m.chromium_tests.get_checkout_dir({}) | 214 self._working_dir = self.m.chromium_tests.get_checkout_dir({}) |
| 211 if checkout_dir: | 215 if self._working_dir: |
| 212 kwargs.setdefault('cwd', checkout_dir) | 216 kwargs.setdefault('cwd', self._working_dir) |
| 213 | 217 |
| 214 return self.m.bot_update.ensure_checkout(*args, **kwargs) | 218 return self.m.bot_update.ensure_checkout(*args, **kwargs) |
| 215 | 219 |
| 216 def _SyncRevisionToTest(self, test_config_params): # pragma: no cover | 220 def _SyncRevisionToTest(self, test_config_params): # pragma: no cover |
| 217 if not self.internal_bisect: | 221 if not self.internal_bisect: |
| 218 return self.ensure_checkout( | 222 return self.ensure_checkout( |
| 219 root_solution_revision=test_config_params['revision']) | 223 root_solution_revision=test_config_params['revision']) |
| 220 else: | 224 else: |
| 221 return self._SyncRevisionsForAndroidChrome( | 225 return self._SyncRevisionsForAndroidChrome( |
| 222 test_config_params['revision_ladder']) | 226 test_config_params['revision_ladder']) |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 """ | 364 """ |
| 361 flags = {} | 365 flags = {} |
| 362 if kwargs.get('do_not_nest_wait_for_revision'): | 366 if kwargs.get('do_not_nest_wait_for_revision'): |
| 363 flags['do_not_nest_wait_for_revision'] = kwargs.pop( | 367 flags['do_not_nest_wait_for_revision'] = kwargs.pop( |
| 364 'do_not_nest_wait_for_revision') | 368 'do_not_nest_wait_for_revision') |
| 365 if bot_db is None: # pragma: no cover | 369 if bot_db is None: # pragma: no cover |
| 366 self.bot_db = api.chromium_tests.create_bot_db_from_master_dict( | 370 self.bot_db = api.chromium_tests.create_bot_db_from_master_dict( |
| 367 '', None, None) | 371 '', None, None) |
| 368 else: | 372 else: |
| 369 self.bot_db = bot_db | 373 self.bot_db = bot_db |
| 370 affected_files = self.m.tryserver.get_files_affected_by_patch() | 374 |
| 371 # Skip device setup for internal bisect as it is taken care in | 375 context = {} |
| 372 # internal recipes. | 376 if self._working_dir: |
| 373 if api.chromium.c.TARGET_PLATFORM == 'android' and not self.internal_bisect: | 377 context['cwd'] = self._working_dir |
| 374 api.chromium_android.common_tests_setup_steps( | 378 |
| 375 perf_setup=True, remove_system_webview=True) | 379 with api.step.context(context): |
| 376 api.chromium.runhooks() | 380 affected_files = self.m.tryserver.get_files_affected_by_patch() |
| 377 try: | 381 # Skip device setup for internal bisect as it is taken care in |
| 378 # Run legacy bisect script if the patch contains bisect.cfg. | 382 # internal recipes. |
| 379 if BISECT_CONFIG_FILE in affected_files: | 383 if (api.chromium.c.TARGET_PLATFORM == 'android' and |
| 380 api.step('***LEGACY BISECT (deprecated)***', []) | 384 not self.internal_bisect): |
| 381 self.run_bisect_script(**kwargs) | 385 api.chromium_android.common_tests_setup_steps( |
| 382 elif api.properties.get('bisect_config'): | 386 perf_setup=True, remove_system_webview=True) |
| 383 # We can distinguish between a config for a full bisect vs a single | 387 api.chromium.runhooks() |
| 384 # test by checking for the presence of the good_revision key. | 388 try: |
| 385 if api.properties.get('bisect_config').get('good_revision'): | 389 # Run legacy bisect script if the patch contains bisect.cfg. |
| 386 api.step('***BISECT***', []) | 390 if BISECT_CONFIG_FILE in affected_files: |
| 387 local_bisect.perform_bisect(self, **flags) # pragma: no cover | 391 api.step('***LEGACY BISECT (deprecated)***', []) |
| 392 self.run_bisect_script(**kwargs) |
| 393 elif api.properties.get('bisect_config'): |
| 394 # We can distinguish between a config for a full bisect vs a single |
| 395 # test by checking for the presence of the good_revision key. |
| 396 if api.properties.get('bisect_config').get('good_revision'): |
| 397 api.step('***BISECT***', []) |
| 398 local_bisect.perform_bisect(self, **flags) # pragma: no cover |
| 399 else: |
| 400 api.step('***SINGLE TEST (deprecated)***', []) |
| 401 self.start_test_run_for_bisect(update_step, self.bot_db, |
| 402 api.properties) |
| 388 else: | 403 else: |
| 389 api.step('***SINGLE TEST (deprecated)***', []) | 404 api.step('***PERF TRYJOB***', []) |
| 390 self.start_test_run_for_bisect(update_step, self.bot_db, | 405 self.m.perf_try.start_perf_try_job( |
| 391 api.properties) | 406 affected_files, update_step, self.bot_db) |
| 392 else: | 407 finally: |
| 393 api.step('***PERF TRYJOB***', []) | 408 if api.chromium.c.TARGET_PLATFORM == 'android': |
| 394 self.m.perf_try.start_perf_try_job( | 409 if self.internal_bisect: # pragma: no cover |
| 395 affected_files, update_step, self.bot_db) | 410 api.chromium_android.init_and_sync( |
| 396 finally: | 411 gclient_config=api.chromium_android.c.internal_dir_name, |
| 397 if api.chromium.c.TARGET_PLATFORM == 'android': | 412 use_bot_update=True) |
| 398 if self.internal_bisect: # pragma: no cover | 413 else: |
| 399 api.chromium_android.init_and_sync( | 414 self.ensure_checkout() |
| 400 gclient_config=api.chromium_android.c.internal_dir_name, | 415 api.chromium_android.common_tests_final_steps() |
| 401 use_bot_update=True) | |
| 402 else: | |
| 403 self.ensure_checkout() | |
| 404 api.chromium_android.common_tests_final_steps() | |
| OLD | NEW |