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

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 unnecessary tests 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 # pick an available device if targe platform is android
12 assert isinstance(bisect_config, collections.Mapping) 12 if api.m.chromium.c.TARGET_PLATFORM == 'android':
13 bisector = api.create_bisector(bisect_config, **flags) 13 connected_devices = _get_connected_devices(api)
14 with api.m.step.nest('Gathering reference values'): 14 if not _pick_available_device(api, connected_devices):
15 _gather_reference_range(api, bisector) 15 raise api.m.step.StepFailure('No Android test devices are available')
16 if (not bisector.failed and bisector.check_improvement_direction() and 16 try:
17 bisector.check_initial_confidence()): 17 bisect_config = api.m.properties.get('bisect_config')
18 if bisector.check_reach_adjacent_revision(bisector.good_rev): 18 assert isinstance(bisect_config, collections.Mapping)
19 # Only show this step if bisect has reached adjacent revisions. 19 bisector = api.create_bisector(bisect_config, **flags)
20 with api.m.step.nest(str('Check bisect finished on revision ' + 20 with api.m.step.nest('Gathering reference values'):
21 bisector.good_rev.revision_string())): 21 _gather_reference_range(api, bisector)
22 if bisector.check_bisect_finished(bisector.good_rev): 22 if (not bisector.failed and bisector.check_improvement_direction() and
23 bisector.bisect_over = True 23 bisector.check_initial_confidence()):
24 if not bisector.bisect_over: 24 if bisector.check_reach_adjacent_revision(
25 _bisect_main_loop(bisector) 25 bisector.good_rev): # pragma: no cover
26 else: 26 # Only show this step if bisect has reached adjacent revisions.
27 bisector.bisect_over = True 27 with api.m.step.nest(str('Check bisect finished on revision ' +
28 bisector.print_result_debug_info() 28 bisector.good_rev.revision_string())):
29 bisector.post_result(halt_on_failure=True) 29 if bisector.check_bisect_finished(bisector.good_rev):
30 bisector.bisect_over = True
31 if not bisector.bisect_over:
32 _bisect_main_loop(bisector)
33 else:
34 bisector.bisect_over = True
35 bisector.print_result_debug_info()
36 bisector.post_result(halt_on_failure=True)
37 except api.m.step.StepFailure:
38 # Redo the bisect job if target platform is android and bisect failed
39 # because the test device disconnected
40 if api.m.chromium.c.TARGET_PLATFORM == 'android':
41 connected_devices = _get_connected_devices(api)
42 if api.m.bisect_tester.device_to_test not in connected_devices:
43 perform_bisect(api, **flags)
jbudorick 2016/07/15 01:23:19 o_o
44 else:
45 raise
46 else: # pragma: no cover
47 raise
30 48
49 def _get_connected_devices(api):
50 api.m.chromium_android.multiple_device_test = True
51 api.m.chromium_android.device_status_check()
jbudorick 2016/07/15 01:23:19 Use device_status now.
Ziqi Xiong 2016/07/15 01:36:06 Done.
52 api.m.chromium_android.multiple_device_test = False
53 return api.m.chromium_android.devices
54
55 def _pick_available_device(api, connected_devices):
jbudorick 2016/07/15 01:23:19 This is basically reimplementing the blacklist tha
Ziqi Xiong 2016/07/15 01:36:06 Sure, I will use blacklist instead. Thanks for let
jbudorick 2016/07/15 02:51:41 Thought about this a bit more, and I think the bla
Ziqi Xiong 2016/07/15 04:38:08 That's definitely less convoluted than the current
Ziqi Xiong 2016/07/15 19:14:34 Done.
56 tested_devices = api.m.bisect_tester.devices_tested
57 available_devices = [device for device in connected_devices
58 if device not in tested_devices]
59 if available_devices:
60 picked_device = available_devices[0]
61 api.m.bisect_tester.device_to_test = picked_device
62 api.m.bisect_tester.devices_tested.append(picked_device)
63 return picked_device
64 return None
31 65
32 def _gather_reference_range(api, bisector): # pragma: no cover 66 def _gather_reference_range(api, bisector): # pragma: no cover
33 bisector.good_rev.start_job() 67 bisector.good_rev.start_job()
34 bisector.bad_rev.start_job() 68 bisector.bad_rev.start_job()
35 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) 69 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev])
36 if bisector.good_rev.failed: 70 if bisector.good_rev.failed:
37 bisector.surface_result('REF_RANGE_FAIL') 71 bisector.surface_result('REF_RANGE_FAIL')
38 api.m.halt('Testing the "good" revision failed') 72 api.m.halt('Testing the "good" revision failed')
39 bisector.failed = True 73 bisector.failed = True
40 elif bisector.bad_rev.failed: 74 elif bisector.bad_rev.failed:
(...skipping 23 matching lines...) Expand all
64 revision_to_check.start_job() 98 revision_to_check.start_job()
65 bisector.wait_for(revision_to_check) 99 bisector.wait_for(revision_to_check)
66 100
67 if bisector.check_reach_adjacent_revision(revision_to_check): 101 if bisector.check_reach_adjacent_revision(revision_to_check):
68 # Only show this step if bisect has reached adjacent revisions. 102 # Only show this step if bisect has reached adjacent revisions.
69 with bisector.api.m.step.nest( 103 with bisector.api.m.step.nest(
70 str('Check bisect finished on revision ' + 104 str('Check bisect finished on revision ' +
71 revision_to_check.revision_string())): 105 revision_to_check.revision_string())):
72 if bisector.check_bisect_finished(revision_to_check): 106 if bisector.check_bisect_finished(revision_to_check):
73 bisector.bisect_over = True 107 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