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 _ensure_checkout(api) | 11 _ensure_checkout(api) |
12 bisect_config = api.m.properties.get('bisect_config') | 12 bisect_config = api.m.properties.get('bisect_config') |
13 assert isinstance(bisect_config, collections.Mapping) | 13 assert isinstance(bisect_config, collections.Mapping) |
14 bisector = api.create_bisector(bisect_config) | 14 bisector = api.create_bisector(bisect_config) |
15 with api.m.step.nest('Gathering reference values'): | 15 with api.m.step.nest('Gathering reference values'): |
16 _gather_reference_range(api, bisector) | 16 _gather_reference_range(api, bisector) |
17 if (not bisector.failed and bisector.check_improvement_direction() and | 17 if (not bisector.failed and bisector.check_improvement_direction() and |
18 bisector.check_initial_confidence()): | 18 bisector.check_initial_confidence()): |
19 if bisector.check_reach_adjacent_revision(bisector.good_rev): | 19 if bisector.check_reach_adjacent_revision(bisector.good_rev): |
20 # Only show this step if bisect has reached adjacent revisions. | 20 # Only show this step if bisect has reached adjacent revisions. |
21 with api.m.step.nest(str('Check bisect finished on revision ' + | 21 with api.m.step.nest(str('Check bisect finished on revision ' + |
22 bisector.good_rev.revision_string)): | 22 bisector.good_rev.revision_string)): |
23 if bisector.check_bisect_finished(bisector.good_rev): | 23 if bisector.check_bisect_finished(bisector.good_rev): |
24 bisector.bisect_over = True | 24 bisector.bisect_over = True |
25 if not bisector.bisect_over: | 25 if not bisector.bisect_over: |
26 _bisect_main_loop(bisector) | 26 _bisect_main_loop(bisector) |
27 else: | 27 else: |
28 bisector.bisect_over = True | 28 bisector.bisect_over = True |
29 bisector.print_result_debug_info() | 29 bisector.print_result_debug_info() |
30 bisector.print_result() | 30 bisector.post_result(halt_on_failure=True) |
31 | 31 |
32 | 32 |
33 def _ensure_checkout(api): # pragma: no cover | 33 def _ensure_checkout(api): # pragma: no cover |
34 mastername = api.m.properties.get('mastername') | 34 mastername = api.m.properties.get('mastername') |
35 buildername = api.m.properties.get('buildername') | 35 buildername = api.m.properties.get('buildername') |
36 # TODO(akuegel): Explicitly load the configs for the builders and don't rely | 36 # TODO(akuegel): Explicitly load the configs for the builders and don't rely |
37 # on builders.py in chromium_tests recipe module. | 37 # on builders.py in chromium_tests recipe module. |
38 api.m.chromium_tests.configure_build(mastername, buildername) | 38 api.m.chromium_tests.configure_build(mastername, buildername) |
39 api.m.chromium_tests.prepare_checkout(mastername, buildername) | 39 api.m.chromium_tests.prepare_checkout(mastername, buildername) |
40 | 40 |
(...skipping 27 matching lines...) Expand all Loading... | |
68 # crbug.com/546695 | 68 # crbug.com/546695 |
69 revisions_to_check = bisector.get_revision_to_eval() | 69 revisions_to_check = bisector.get_revision_to_eval() |
70 # TODO: Add a test case to remove this pragma | 70 # TODO: Add a test case to remove this pragma |
71 if not revisions_to_check: | 71 if not revisions_to_check: |
72 bisector.bisect_over = True | 72 bisector.bisect_over = True |
73 break | 73 break |
74 | 74 |
75 completed_revisions = [] | 75 completed_revisions = [] |
76 with bisector.api.m.step.nest(str('Working on revision ' + | 76 with bisector.api.m.step.nest(str('Working on revision ' + |
77 revisions_to_check[0].revision_string)): | 77 revisions_to_check[0].revision_string)): |
78 nest_step_result = bisector.api.m.step.active_result | 78 bisector.post_result(halt_on_failure=False) |
RobertoCN
2016/01/12 20:47:29
At first I was concerned that we might not be show
chrisphan
2016/01/14 00:53:26
Right, I was making 'post bisect results' step gen
| |
79 partial_results = bisector.partial_results().splitlines() | |
80 nest_step_result.presentation.logs['Partial Results'] = partial_results | |
81 for r in revisions_to_check: | 79 for r in revisions_to_check: |
82 r.start_job() | 80 r.start_job() |
83 completed_revisions = _wait_for_revisions(bisector, revisions_to_check) | 81 completed_revisions = _wait_for_revisions(bisector, revisions_to_check) |
84 | 82 |
85 for completed_revision in completed_revisions: | 83 for completed_revision in completed_revisions: |
86 if not bisector.check_reach_adjacent_revision(completed_revision): | 84 if not bisector.check_reach_adjacent_revision(completed_revision): |
87 continue | 85 continue |
88 # Only show this step if bisect has reached adjacent revisions. | 86 # Only show this step if bisect has reached adjacent revisions. |
89 with bisector.api.m.step.nest(str('Check bisect finished on revision ' + | 87 with bisector.api.m.step.nest(str('Check bisect finished on revision ' + |
90 completed_revisions[0].revision_string)): | 88 completed_revisions[0].revision_string)): |
(...skipping 17 matching lines...) Expand all Loading... | |
108 revisions_to_check.remove(completed_revision) | 106 revisions_to_check.remove(completed_revision) |
109 else: | 107 else: |
110 bisector.api.m.step.active_result.presentation.status = ( | 108 bisector.api.m.step.active_result.presentation.status = ( |
111 bisector.api.m.step.WARNING) | 109 bisector.api.m.step.WARNING) |
112 bisector.api.m.step.active_result.presentation.logs['WARNING'] = ( | 110 bisector.api.m.step.active_result.presentation.logs['WARNING'] = ( |
113 ['Tried to remove revision not in list']) | 111 ['Tried to remove revision not in list']) |
114 if not (completed_revision.aborted or completed_revision.failed): | 112 if not (completed_revision.aborted or completed_revision.failed): |
115 completed_revisions.append(completed_revision) | 113 completed_revisions.append(completed_revision) |
116 bisector.abort_unnecessary_jobs() | 114 bisector.abort_unnecessary_jobs() |
117 return completed_revisions | 115 return completed_revisions |
OLD | NEW |