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): # pragma: no cover | 10 def perform_bisect(api): # pragma: no cover |
11 bisect_config = api.m.properties.get('bisect_config') | 11 bisect_config = api.m.properties.get('bisect_config') |
12 assert isinstance(bisect_config, collections.Mapping) | 12 assert isinstance(bisect_config, collections.Mapping) |
13 bisector = api.create_bisector(bisect_config) | 13 bisector = api.create_bisector(bisect_config) |
14 with api.m.step.nest('Gathering reference values'): | 14 with api.m.step.nest('Gathering reference values'): |
15 _gather_reference_range(api, bisector) | 15 _gather_reference_range(api, bisector) |
16 if (not bisector.failed and bisector.check_improvement_direction() and | 16 if (not bisector.failed and bisector.check_improvement_direction() and |
17 bisector.check_initial_confidence()): | 17 bisector.check_initial_confidence()): |
18 if bisector.check_reach_adjacent_revision(bisector.good_rev): | 18 if bisector.check_reach_adjacent_revision(bisector.good_rev): |
19 # Only show this step if bisect has reached adjacent revisions. | 19 # Only show this step if bisect has reached adjacent revisions. |
20 with api.m.step.nest(str('Check bisect finished on revision ' + | 20 with api.m.step.nest(str('Check bisect finished on revision ' + |
21 bisector.good_rev.revision_string)): | 21 bisector.good_rev.revision_string)): |
22 if bisector.check_bisect_finished(bisector.good_rev): | 22 if bisector.check_bisect_finished(bisector.good_rev): |
23 bisector.bisect_over = True | 23 bisector.bisect_over = True |
24 if not bisector.bisect_over: | 24 if not bisector.bisect_over: |
25 _bisect_main_loop(bisector) | 25 _bisect_main_loop(bisector) |
26 else: | 26 else: |
27 bisector.bisect_over = True | 27 bisector.bisect_over = True |
28 bisector.print_result_debug_info() | 28 bisector.print_result_debug_info() |
29 bisector.print_result() | 29 bisector.post_result(halt_on_failure=True) |
30 | 30 |
31 | 31 |
32 def _gather_reference_range(api, bisector): # pragma: no cover | 32 def _gather_reference_range(api, bisector): # pragma: no cover |
33 bisector.good_rev.start_job() | 33 bisector.good_rev.start_job() |
34 bisector.bad_rev.start_job() | 34 bisector.bad_rev.start_job() |
35 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) | 35 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) |
36 if bisector.good_rev.failed: | 36 if bisector.good_rev.failed: |
37 bisector.surface_result('REF_RANGE_FAIL') | 37 bisector.surface_result('REF_RANGE_FAIL') |
38 api.m.halt('Testing the "good" revision failed') | 38 api.m.halt('Testing the "good" revision failed') |
39 bisector.failed = True | 39 bisector.failed = True |
(...skipping 18 matching lines...) Expand all Loading... |
58 # crbug.com/546695 | 58 # crbug.com/546695 |
59 revisions_to_check = bisector.get_revision_to_eval() | 59 revisions_to_check = bisector.get_revision_to_eval() |
60 # TODO: Add a test case to remove this pragma | 60 # TODO: Add a test case to remove this pragma |
61 if not revisions_to_check: | 61 if not revisions_to_check: |
62 bisector.bisect_over = True | 62 bisector.bisect_over = True |
63 break | 63 break |
64 | 64 |
65 completed_revisions = [] | 65 completed_revisions = [] |
66 with bisector.api.m.step.nest(str('Working on revision ' + | 66 with bisector.api.m.step.nest(str('Working on revision ' + |
67 revisions_to_check[0].revision_string)): | 67 revisions_to_check[0].revision_string)): |
68 nest_step_result = bisector.api.m.step.active_result | 68 bisector.post_result(halt_on_failure=False) |
69 partial_results = bisector.partial_results().splitlines() | |
70 nest_step_result.presentation.logs['Partial Results'] = partial_results | |
71 for r in revisions_to_check: | 69 for r in revisions_to_check: |
72 r.start_job() | 70 r.start_job() |
73 completed_revisions = _wait_for_revisions(bisector, revisions_to_check) | 71 completed_revisions = _wait_for_revisions(bisector, revisions_to_check) |
74 | 72 |
75 for completed_revision in completed_revisions: | 73 for completed_revision in completed_revisions: |
76 if not bisector.check_reach_adjacent_revision(completed_revision): | 74 if not bisector.check_reach_adjacent_revision(completed_revision): |
77 continue | 75 continue |
78 # Only show this step if bisect has reached adjacent revisions. | 76 # Only show this step if bisect has reached adjacent revisions. |
79 with bisector.api.m.step.nest( | 77 with bisector.api.m.step.nest( |
80 str('Check bisect finished on revision ' + | 78 str('Check bisect finished on revision ' + |
(...skipping 18 matching lines...) Expand all Loading... |
99 revisions_to_check.remove(completed_revision) | 97 revisions_to_check.remove(completed_revision) |
100 else: | 98 else: |
101 bisector.api.m.step.active_result.presentation.status = ( | 99 bisector.api.m.step.active_result.presentation.status = ( |
102 bisector.api.m.step.WARNING) | 100 bisector.api.m.step.WARNING) |
103 bisector.api.m.step.active_result.presentation.logs['WARNING'] = ( | 101 bisector.api.m.step.active_result.presentation.logs['WARNING'] = ( |
104 ['Tried to remove revision not in list']) | 102 ['Tried to remove revision not in list']) |
105 if not (completed_revision.aborted or completed_revision.failed): | 103 if not (completed_revision.aborted or completed_revision.failed): |
106 completed_revisions.append(completed_revision) | 104 completed_revisions.append(completed_revision) |
107 bisector.abort_unnecessary_jobs() | 105 bisector.abort_unnecessary_jobs() |
108 return completed_revisions | 106 return completed_revisions |
OLD | NEW |