| 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 import base64 | 5 import base64 |
| 6 import collections | 6 import collections |
| 7 import json | 7 import json |
| 8 | 8 |
| 9 | 9 |
| 10 def perform_bisect(api, **flags): | 10 def perform_bisect(api, **flags): |
| 11 # Try catch all the exceptions thrown in bisection so that recipe can | 11 # Try catch all the exceptions thrown in bisection so that recipe can |
| 12 # post the failed job result to dashboard | 12 # post the failed job result to dashboard |
| 13 try: | 13 try: |
| 14 bisect_attempts = [] | 14 bisect_attempts = [] |
| 15 if api.m.chromium.c.TARGET_PLATFORM != 'android': | 15 if api.m.chromium.c.TARGET_PLATFORM != 'android': |
| 16 _perform_single_bisect(api, bisect_attempts, **flags) | 16 _perform_single_bisect(api, bisect_attempts, **flags) |
| 17 else: | 17 else: |
| 18 # pick an available device if targe platform is android | 18 # pick an available device if targe platform is android |
| 19 connected_devices = _get_connected_devices(api) | 19 connected_devices = _get_connected_devices(api) |
| 20 if not connected_devices: | 20 if not connected_devices: |
| 21 raise api.m.step.StepFailure( | 21 raise api.m.step.StepFailure( |
| 22 'No Android test devices are available') | 22 'No Android test devices are available') |
| 23 for device in connected_devices: | 23 for device in connected_devices: |
| 24 api.m.bisect_tester.device_to_test = device | 24 api.m.bisect_tester.device_to_test = device |
| 25 try: | 25 try: |
| 26 _perform_single_bisect(api, bisect_attempts, **flags) | 26 _perform_single_bisect(api, bisect_attempts, **flags) |
| 27 break |
| 27 except api.m.step.StepFailure: | 28 except api.m.step.StepFailure: |
| 28 # Redo the bisect job if target platform is android and bisect | 29 # Redo the bisect job if target platform is android and bisect |
| 29 # failed because the test device disconnected | 30 # failed because the test device disconnected |
| 30 current_connected_devices = _get_connected_devices(api) | 31 current_connected_devices = _get_connected_devices(api) |
| 31 if (api.m.bisect_tester.device_to_test not in | 32 if (api.m.bisect_tester.device_to_test not in |
| 32 current_connected_devices): | 33 current_connected_devices): |
| 33 continue | 34 continue |
| 34 else: | 35 else: |
| 35 raise | 36 raise |
| 36 except: # pylint: disable=bare-except | 37 except: # pylint: disable=bare-except |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 revision_to_check.start_job() | 103 revision_to_check.start_job() |
| 103 bisector.wait_for(revision_to_check) | 104 bisector.wait_for(revision_to_check) |
| 104 | 105 |
| 105 if bisector.check_reach_adjacent_revision(revision_to_check): | 106 if bisector.check_reach_adjacent_revision(revision_to_check): |
| 106 # Only show this step if bisect has reached adjacent revisions. | 107 # Only show this step if bisect has reached adjacent revisions. |
| 107 with bisector.api.m.step.nest( | 108 with bisector.api.m.step.nest( |
| 108 str('Check bisect finished on revision ' + | 109 str('Check bisect finished on revision ' + |
| 109 revision_to_check.revision_string())): | 110 revision_to_check.revision_string())): |
| 110 if bisector.check_bisect_finished(revision_to_check): | 111 if bisector.check_bisect_finished(revision_to_check): |
| 111 bisector.bisect_over = True | 112 bisector.bisect_over = True |
| OLD | NEW |