Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: scripts/slave/recipe_modules/auto_bisect/local_bisect.py

Issue 2119483003: Reland "Allow multiple devices on bisects hosts " (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Remove irrelavant if statement, rename connected_devices variable Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/bisect_tester/api.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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):
11 bisect_config = api.m.properties.get('bisect_config') 11 if api.m.chromium.c.TARGET_PLATFORM != 'android':
12 assert isinstance(bisect_config, collections.Mapping) 12 _perform_single_bisect(api, **flags)
13 bisector = api.create_bisector(bisect_config, **flags)
14 with api.m.step.nest('Gathering reference values'):
15 _gather_reference_range(api, bisector)
16 if (not bisector.failed and bisector.check_improvement_direction() and
17 bisector.check_initial_confidence()):
18 if bisector.check_reach_adjacent_revision(bisector.good_rev):
19 # Only show this step if bisect has reached adjacent revisions.
20 with api.m.step.nest(str('Check bisect finished on revision ' +
21 bisector.good_rev.revision_string())):
22 if bisector.check_bisect_finished(bisector.good_rev):
23 bisector.bisect_over = True
24 if not bisector.bisect_over:
25 _bisect_main_loop(bisector)
26 else: 13 else:
27 bisector.bisect_over = True 14 # pick an available device if targe platform is android
28 bisector.print_result_debug_info() 15 connected_devices = _get_connected_devices(api)
29 bisector.post_result(halt_on_failure=True) 16 if not connected_devices:
17 raise api.m.step.StepFailure('No Android test devices are available')
18 for device in connected_devices:
19 api.m.bisect_tester.device_to_test = device
20 try:
21 _perform_single_bisect(api, **flags)
22 except api.m.step.StepFailure:
23 # Redo the bisect job if target platform is android and bisect failed
24 # because the test device disconnected
25 current_connected_devices = _get_connected_devices(api)
26 if api.m.bisect_tester.device_to_test not in current_connected_devices:
27 continue
28 else:
29 raise
30 30
31 def _perform_single_bisect(api, **flags):
32 bisect_config = api.m.properties.get('bisect_config')
33 assert isinstance(bisect_config, collections.Mapping)
34 bisector = api.create_bisector(bisect_config, **flags)
35 with api.m.step.nest('Gathering reference values'):
36 _gather_reference_range(api, bisector)
37 if (not bisector.failed and bisector.check_improvement_direction() and
38 bisector.check_initial_confidence()):
39 if bisector.check_reach_adjacent_revision(
40 bisector.good_rev): # pragma: no cover
41 # Only show this step if bisect has reached adjacent revisions.
42 with api.m.step.nest(str('Check bisect finished on revision ' +
43 bisector.good_rev.revision_string())):
44 if bisector.check_bisect_finished(bisector.good_rev):
45 bisector.bisect_over = True
46 if not bisector.bisect_over:
47 _bisect_main_loop(bisector)
48 else:
49 bisector.bisect_over = True
50 bisector.print_result_debug_info()
51 bisector.post_result(halt_on_failure=True)
52
53 def _get_connected_devices(api):
54 api.m.chromium_android.device_status()
55 return api.m.chromium_android.devices
31 56
32 def _gather_reference_range(api, bisector): # pragma: no cover 57 def _gather_reference_range(api, bisector): # pragma: no cover
33 bisector.good_rev.start_job() 58 bisector.good_rev.start_job()
34 bisector.bad_rev.start_job() 59 bisector.bad_rev.start_job()
35 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) 60 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev])
36 if bisector.good_rev.failed: 61 if bisector.good_rev.failed:
37 bisector.surface_result('REF_RANGE_FAIL') 62 bisector.surface_result('REF_RANGE_FAIL')
38 api.m.halt('Testing the "good" revision failed') 63 api.m.halt('Testing the "good" revision failed')
39 bisector.failed = True 64 bisector.failed = True
40 elif bisector.bad_rev.failed: 65 elif bisector.bad_rev.failed:
(...skipping 23 matching lines...) Expand all
64 revision_to_check.start_job() 89 revision_to_check.start_job()
65 bisector.wait_for(revision_to_check) 90 bisector.wait_for(revision_to_check)
66 91
67 if bisector.check_reach_adjacent_revision(revision_to_check): 92 if bisector.check_reach_adjacent_revision(revision_to_check):
68 # Only show this step if bisect has reached adjacent revisions. 93 # Only show this step if bisect has reached adjacent revisions.
69 with bisector.api.m.step.nest( 94 with bisector.api.m.step.nest(
70 str('Check bisect finished on revision ' + 95 str('Check bisect finished on revision ' +
71 revision_to_check.revision_string())): 96 revision_to_check.revision_string())):
72 if bisector.check_bisect_finished(revision_to_check): 97 if bisector.check_bisect_finished(revision_to_check):
73 bisector.bisect_over = True 98 bisector.bisect_over = True
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/bisect_tester/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698