| 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 22 matching lines...) Expand all Loading... |
| 33 # Email to send on try jobs (for build requests) since git try will not | 33 # Email to send on try jobs (for build requests) since git try will not |
| 34 # necessarily rely on a local checkout for that information. | 34 # necessarily rely on a local checkout for that information. |
| 35 BOT_EMAIL = 'chrome_bot@chromium.org' | 35 BOT_EMAIL = 'chrome_bot@chromium.org' |
| 36 SERVICE_ACCOUNT = 'chromium-bisect' | 36 SERVICE_ACCOUNT = 'chromium-bisect' |
| 37 | 37 |
| 38 def __init__(self, *args, **kwargs): | 38 def __init__(self, *args, **kwargs): |
| 39 super(AutoBisectApi, self).__init__(*args, **kwargs) | 39 super(AutoBisectApi, self).__init__(*args, **kwargs) |
| 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 def perform_bisect(self, **flags): | 50 def perform_bisect(self, **flags): |
| 51 return local_bisect.perform_bisect(self, **flags) | 51 return local_bisect.perform_bisect(self, **flags) |
| 52 | 52 |
| 53 def create_bisector(self, bisect_config_dict, dummy_mode=False, **flags): | 53 def create_bisector(self, bisect_config_dict, dummy_mode=False, **flags): |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 'author': commit_info['author']['name'], | 148 'author': commit_info['author']['name'], |
| 149 'email': commit_info['author']['email'], | 149 'email': commit_info['author']['email'], |
| 150 'subject': subject, | 150 'subject': subject, |
| 151 'body': body, | 151 'body': body, |
| 152 'date': commit_info['committer']['time'], | 152 'date': commit_info['committer']['time'], |
| 153 } | 153 } |
| 154 return None | 154 return None |
| 155 except self.m.step.StepFailure: # pragma: no cover | 155 except self.m.step.StepFailure: # pragma: no cover |
| 156 self.surface_result('BAD_REV') | 156 self.surface_result('BAD_REV') |
| 157 raise | 157 raise |
| 158 | |
| 159 | 158 |
| 160 def run_bisect_script(self, **kwargs): | 159 def run_bisect_script(self, **kwargs): |
| 161 """Executes src/tools/run-perf-bisect-regression.py to perform bisection.""" | 160 """Executes src/tools/run-perf-bisect-regression.py to perform bisection.""" |
| 162 self.m.python( | 161 self.m.python( |
| 163 'Preparing for Bisection', | 162 'Preparing for Bisection', |
| 164 script=self.m.path['checkout'].join( | 163 script=self.m.path['checkout'].join( |
| 165 'tools', 'prepare-bisect-perf-regression.py'), | 164 'tools', 'prepare-bisect-perf-regression.py'), |
| 166 args=['-w', self.m.path['slave_build']]) | 165 args=['-w', self.m.path['slave_build']]) |
| 167 args = [] | 166 args = [] |
| 168 | 167 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 else: | 315 else: |
| 317 for apk in deploy_apks: | 316 for apk in deploy_apks: |
| 318 self.m.chromium_android.adb_install_apk(apk) | 317 self.m.chromium_android.adb_install_apk(apk) |
| 319 | 318 |
| 320 def full_deploy_on_device(self, deploy_script, args=None): # pragma: no cover | 319 def full_deploy_on_device(self, deploy_script, args=None): # pragma: no cover |
| 321 """Install android-chrome apk on device.""" | 320 """Install android-chrome apk on device.""" |
| 322 full_deploy_flags = [ | 321 full_deploy_flags = [ |
| 323 '-v', | 322 '-v', |
| 324 '--blacklist-file', self.m.chromium_android.blacklist_file, | 323 '--blacklist-file', self.m.chromium_android.blacklist_file, |
| 325 '--perfbot', | 324 '--perfbot', |
| 326 '--release', | 325 '--release', |
| 327 ] | 326 ] |
| 328 if args: | 327 if args: |
| 329 full_deploy_flags += args | 328 full_deploy_flags += args |
| 330 self.m.python( | 329 self.m.python( |
| 331 'Deploy on Device', | 330 'Deploy on Device', |
| 332 deploy_script, | 331 deploy_script, |
| 333 full_deploy_flags, | 332 full_deploy_flags, |
| 334 infra_step=True, | 333 infra_step=True, |
| 335 env=self.m.chromium.get_env()) | 334 env=self.m.chromium.get_env()) |
| 336 | 335 |
| 337 def start_try_job(self, api, update_step=None, bot_db=None, **kwargs): | 336 def start_try_job(self, api, update_step=None, bot_db=None, **kwargs): |
| 338 """Starts a recipe bisect job, perf test run, or legacy bisect run. | 337 """Starts a recipe bisect job, perf test run, or legacy bisect run. |
| 339 | 338 |
| 340 This function is an entry point for: | 339 This function is an entry point for: |
| 341 1. A legacy bisect job run (in this case, there will be a patch | 340 1. A legacy bisect job run (in this case, there will be a patch |
| 342 with a bisect config file). | 341 with a bisect config file). |
| 343 2. A recipe bisect job run (in this case, there will be a property | 342 2. A recipe bisect job run (in this case, there will be a property |
| 344 called bisect_config which contains the config parameters). | 343 called bisect_config which contains the config parameters). |
| 345 3. A single test run for a recipe bisect job (there will be a | 344 3. A single test run for a recipe bisect job (there will be a |
| 346 bisect_config property but it won't contain good/bad revisions). | 345 bisect_config property but it won't contain good/bad revisions). |
| (...skipping 17 matching lines...) Expand all Loading... |
| 364 affected_files = self.m.tryserver.get_files_affected_by_patch() | 363 affected_files = self.m.tryserver.get_files_affected_by_patch() |
| 365 # Skip device setup for internal bisect as it is taken care in | 364 # Skip device setup for internal bisect as it is taken care in |
| 366 # internal recipes. | 365 # internal recipes. |
| 367 if api.chromium.c.TARGET_PLATFORM == 'android' and not self.internal_bisect: | 366 if api.chromium.c.TARGET_PLATFORM == 'android' and not self.internal_bisect: |
| 368 api.chromium_android.common_tests_setup_steps( | 367 api.chromium_android.common_tests_setup_steps( |
| 369 perf_setup=True, remove_system_webview=True) | 368 perf_setup=True, remove_system_webview=True) |
| 370 api.chromium.runhooks() | 369 api.chromium.runhooks() |
| 371 try: | 370 try: |
| 372 # Run legacy bisect script if the patch contains bisect.cfg. | 371 # Run legacy bisect script if the patch contains bisect.cfg. |
| 373 if BISECT_CONFIG_FILE in affected_files: | 372 if BISECT_CONFIG_FILE in affected_files: |
| 373 api.step('***LEGACY BISECT (deprecated)***', []) |
| 374 self.run_bisect_script(**kwargs) | 374 self.run_bisect_script(**kwargs) |
| 375 elif api.properties.get('bisect_config'): | 375 elif api.properties.get('bisect_config'): |
| 376 # We can distinguish between a config for a full bisect vs a single | 376 # We can distinguish between a config for a full bisect vs a single |
| 377 # test by checking for the presence of the good_revision key. | 377 # test by checking for the presence of the good_revision key. |
| 378 if api.properties.get('bisect_config').get('good_revision'): | 378 if api.properties.get('bisect_config').get('good_revision'): |
| 379 api.step('***BISECT***', []) |
| 379 local_bisect.perform_bisect(self, **flags) # pragma: no cover | 380 local_bisect.perform_bisect(self, **flags) # pragma: no cover |
| 380 else: | 381 else: |
| 382 api.step('***SINGLE TEST (deprecated)***', []) |
| 381 self.start_test_run_for_bisect(update_step, self.bot_db, | 383 self.start_test_run_for_bisect(update_step, self.bot_db, |
| 382 api.properties) | 384 api.properties) |
| 383 else: | 385 else: |
| 386 api.step('***PERF TRYJOB***', []) |
| 384 self.m.perf_try.start_perf_try_job( | 387 self.m.perf_try.start_perf_try_job( |
| 385 affected_files, update_step, self.bot_db) | 388 affected_files, update_step, self.bot_db) |
| 386 finally: | 389 finally: |
| 387 if api.chromium.c.TARGET_PLATFORM == 'android': | 390 if api.chromium.c.TARGET_PLATFORM == 'android': |
| 388 if self.internal_bisect: # pragma: no cover | 391 if self.internal_bisect: # pragma: no cover |
| 389 api.chromium_android.init_and_sync( | 392 api.chromium_android.init_and_sync( |
| 390 gclient_config=api.chromium_android.c.internal_dir_name, | 393 gclient_config=api.chromium_android.c.internal_dir_name, |
| 391 use_bot_update=True) | 394 use_bot_update=True) |
| 392 else: | 395 else: |
| 393 api.bot_update.ensure_checkout() | 396 api.bot_update.ensure_checkout() |
| 394 api.chromium_android.common_tests_final_steps() | 397 api.chromium_android.common_tests_final_steps() |
| OLD | NEW |