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

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: Replace recursion with for loop in local_bisect as jbudorick suggested 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 if api.m.chromium.c.TARGET_PLATFORM == 'android':
RobertoCN 2016/07/15 19:59:47 Is this check necessary again? look at the if in l
Ziqi Xiong 2016/07/15 20:19:07 Done.
29 bisector.post_result(halt_on_failure=True) 16 connected_devices = _get_connected_devices(api)
17 if not connected_devices:
18 raise api.m.step.StepFailure('No Android test devices are available')
19 for device in connected_devices:
20 api.m.bisect_tester.device_to_test = device
21 try:
22 _perform_single_bisect(api, **flags)
23 except api.m.step.StepFailure:
24 # Redo the bisect job if target platform is android and bisect failed
25 # because the test device disconnected
26 connected_devices = _get_connected_devices(api)
jbudorick 2016/07/15 19:20:16 This should no longer be here, right?
Ziqi Xiong 2016/07/15 19:23:58 I think it should. The bisect should be redone whe
jbudorick 2016/07/15 19:31:23 Oh, I see what you mean.
RobertoCN 2016/07/15 19:59:47 Is there a way to check that one particular device
jbudorick 2016/07/15 20:01:37 I tried this out locally (on sample code) and I do
Ziqi Xiong 2016/07/15 20:19:07 Done.
27 if api.m.bisect_tester.device_to_test not in connected_devices:
28 continue
29 else:
30 raise
30 31
32 def _perform_single_bisect(api, **flags):
33 bisect_config = api.m.properties.get('bisect_config')
34 assert isinstance(bisect_config, collections.Mapping)
35 bisector = api.create_bisector(bisect_config, **flags)
36 with api.m.step.nest('Gathering reference values'):
37 _gather_reference_range(api, bisector)
38 if (not bisector.failed and bisector.check_improvement_direction() and
39 bisector.check_initial_confidence()):
40 if bisector.check_reach_adjacent_revision(
41 bisector.good_rev): # pragma: no cover
42 # Only show this step if bisect has reached adjacent revisions.
43 with api.m.step.nest(str('Check bisect finished on revision ' +
44 bisector.good_rev.revision_string())):
45 if bisector.check_bisect_finished(bisector.good_rev):
46 bisector.bisect_over = True
47 if not bisector.bisect_over:
48 _bisect_main_loop(bisector)
49 else:
50 bisector.bisect_over = True
51 bisector.print_result_debug_info()
52 bisector.post_result(halt_on_failure=True)
53
54 def _get_connected_devices(api):
55 api.m.chromium_android.device_status()
56 return api.m.chromium_android.devices
31 57
32 def _gather_reference_range(api, bisector): # pragma: no cover 58 def _gather_reference_range(api, bisector): # pragma: no cover
33 bisector.good_rev.start_job() 59 bisector.good_rev.start_job()
34 bisector.bad_rev.start_job() 60 bisector.bad_rev.start_job()
35 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) 61 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev])
36 if bisector.good_rev.failed: 62 if bisector.good_rev.failed:
37 bisector.surface_result('REF_RANGE_FAIL') 63 bisector.surface_result('REF_RANGE_FAIL')
38 api.m.halt('Testing the "good" revision failed') 64 api.m.halt('Testing the "good" revision failed')
39 bisector.failed = True 65 bisector.failed = True
40 elif bisector.bad_rev.failed: 66 elif bisector.bad_rev.failed:
(...skipping 23 matching lines...) Expand all
64 revision_to_check.start_job() 90 revision_to_check.start_job()
65 bisector.wait_for(revision_to_check) 91 bisector.wait_for(revision_to_check)
66 92
67 if bisector.check_reach_adjacent_revision(revision_to_check): 93 if bisector.check_reach_adjacent_revision(revision_to_check):
68 # Only show this step if bisect has reached adjacent revisions. 94 # Only show this step if bisect has reached adjacent revisions.
69 with bisector.api.m.step.nest( 95 with bisector.api.m.step.nest(
70 str('Check bisect finished on revision ' + 96 str('Check bisect finished on revision ' +
71 revision_to_check.revision_string())): 97 revision_to_check.revision_string())):
72 if bisector.check_bisect_finished(revision_to_check): 98 if bisector.check_bisect_finished(revision_to_check):
73 bisector.bisect_over = True 99 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