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 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): # pragma: no cover | 10 def perform_bisect(api, **flags): # pragma: no cover |
| 11 bisect_config = api.m.properties.get('bisect_config') | 11 try: |
| 12 assert isinstance(bisect_config, collections.Mapping) | 12 bisect_config = api.m.properties.get('bisect_config') |
| 13 bisector = api.create_bisector(bisect_config, **flags) | 13 assert isinstance(bisect_config, collections.Mapping) |
| 14 with api.m.step.nest('Gathering reference values'): | 14 bisector = api.create_bisector(bisect_config, **flags) |
| 15 _gather_reference_range(api, bisector) | 15 with api.m.step.nest('Gathering reference values'): |
| 16 if (not bisector.failed and bisector.check_improvement_direction() and | 16 _gather_reference_range(api, bisector) |
| 17 bisector.check_initial_confidence()): | 17 if (not bisector.failed and bisector.check_improvement_direction() and |
| 18 if bisector.check_reach_adjacent_revision(bisector.good_rev): | 18 bisector.check_initial_confidence()): |
| 19 # Only show this step if bisect has reached adjacent revisions. | 19 if bisector.check_reach_adjacent_revision(bisector.good_rev): |
| 20 with api.m.step.nest(str('Check bisect finished on revision ' + | 20 # Only show this step if bisect has reached adjacent revisions. |
| 21 bisector.good_rev.revision_string())): | 21 with api.m.step.nest(str('Check bisect finished on revision ' + |
| 22 if bisector.check_bisect_finished(bisector.good_rev): | 22 bisector.good_rev.revision_string())): |
| 23 bisector.bisect_over = True | 23 if bisector.check_bisect_finished(bisector.good_rev): |
| 24 if not bisector.bisect_over: | 24 bisector.bisect_over = True |
| 25 _bisect_main_loop(bisector) | 25 if not bisector.bisect_over: |
| 26 else: | 26 _bisect_main_loop(bisector) |
| 27 bisector.bisect_over = True | 27 else: |
| 28 bisector.print_result_debug_info() | 28 bisector.bisect_over = True |
| 29 bisector.post_result(halt_on_failure=True) | 29 bisector.print_result_debug_info() |
| 30 bisector.post_result(halt_on_failure=True) | |
| 31 except api.m.step.StepFailure: | |
|
RobertoCN
2016/06/07 22:00:39
Eventually we'd want to make this more specific th
Ziqi Xiong
2016/06/22 17:38:21
Done.
| |
| 32 if api.m.chromium.c.TARGET_PLATFORM == 'android': | |
| 33 api.m.chromium_android.device_status_check() | |
| 34 available_devices = api.m.chromium_android.devices() | |
| 35 if available_devices: | |
| 36 serial_number = available_devices[0] | |
|
RobertoCN
2016/06/07 22:00:39
Since we do not know for a fact that the StepFailu
Ziqi Xiong
2016/06/22 17:38:21
Done.
| |
| 37 api.m.chromium_android.test_device = serial_number | |
| 38 perform_bisect(api,**flags) | |
| 39 else: | |
| 40 raise | |
| 41 else: | |
| 42 raise | |
| 30 | 43 |
| 31 | 44 |
| 32 def _gather_reference_range(api, bisector): # pragma: no cover | 45 def _gather_reference_range(api, bisector): # pragma: no cover |
| 33 bisector.good_rev.start_job() | 46 bisector.good_rev.start_job() |
| 34 bisector.bad_rev.start_job() | 47 bisector.bad_rev.start_job() |
| 35 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) | 48 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) |
| 36 if bisector.good_rev.failed: | 49 if bisector.good_rev.failed: |
| 37 bisector.surface_result('REF_RANGE_FAIL') | 50 bisector.surface_result('REF_RANGE_FAIL') |
| 38 api.m.halt('Testing the "good" revision failed') | 51 api.m.halt('Testing the "good" revision failed') |
| 39 bisector.failed = True | 52 bisector.failed = True |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 64 revision_to_check.start_job() | 77 revision_to_check.start_job() |
| 65 bisector.wait_for(revision_to_check) | 78 bisector.wait_for(revision_to_check) |
| 66 | 79 |
| 67 if bisector.check_reach_adjacent_revision(revision_to_check): | 80 if bisector.check_reach_adjacent_revision(revision_to_check): |
| 68 # Only show this step if bisect has reached adjacent revisions. | 81 # Only show this step if bisect has reached adjacent revisions. |
| 69 with bisector.api.m.step.nest( | 82 with bisector.api.m.step.nest( |
| 70 str('Check bisect finished on revision ' + | 83 str('Check bisect finished on revision ' + |
| 71 revision_to_check.revision_string())): | 84 revision_to_check.revision_string())): |
| 72 if bisector.check_bisect_finished(revision_to_check): | 85 if bisector.check_bisect_finished(revision_to_check): |
| 73 bisector.bisect_over = True | 86 bisector.bisect_over = True |
| OLD | NEW |