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

Side by Side Diff: scripts/slave/recipes/mojo.py

Issue 2059993002: [Android] Move to new device status and recovery scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: johns comments Created 4 years, 6 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 DEPS = [ 5 DEPS = [
6 'depot_tools/bot_update', 6 'depot_tools/bot_update',
7 'depot_tools/gclient', 7 'depot_tools/gclient',
8 'recipe_engine/json', 8 'recipe_engine/json',
9 'recipe_engine/path', 9 'recipe_engine/path',
10 'recipe_engine/platform', 10 'recipe_engine/platform',
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 args=['gn', build_type] + args + gn_args, 60 args=['gn', build_type] + args + gn_args,
61 cwd=api.path['checkout'], 61 cwd=api.path['checkout'],
62 env=env) 62 env=env)
63 api.python('mojob build', 63 api.python('mojob build',
64 mojob_path, 64 mojob_path,
65 args=['build', build_type] + args, 65 args=['build', build_type] + args,
66 env=env) 66 env=env)
67 67
68 68
69 def _DeviceCheckStep(api): 69 def _DeviceCheckStep(api):
70 devices_path = api.m.path['build'].join('site_config', '.known_devices') 70
71 known_devices_path = api.m.path['build'].join('site_config', '.known_devices')
72 # Device Recovery
71 args = [ 73 args = [
72 '--json-output', api.json.output(), 74 '--known-devices-file', known_devices_path,
73 '--restart-usb', 75 '-v'
74 '--known-devices-file', devices_path,
75 ] 76 ]
77 api.m.step(
78 'device_recovery',
79 [api.m.path['checkout'].join('third_party', 'catapult', 'devil',
jbudorick 2016/06/24 14:40:47 :( Same comment about --adb-path, though.
rnephew (Reviews Here) 2016/06/24 17:35:06 Done. After this lands, I'm going to work more on
80 'devil', 'android', 'tools',
81 'device_recovery.py')] + args,
82 infra_step=True,)
83 # Device provisioning
84 api.python(
85 'provision_device',
86 api.path['checkout'].join('build', 'android', 'provision_devices.py'),
87 infra_step=True)
88 # Device status check
76 try: 89 try:
90 buildbot_file = '/home/chrome-bot/.adb_device_info'
91 args = [
92 '--json-output', api.m.json.output(),
93 '--known-devices-file', known_devices_path,
94 '--buildbot-path', buildbot_file,
95 '-v', '--overwrite-known-devices-files',
96 ]
97
77 result = api.python( 98 result = api.python(
78 'device_status_check', 99 'device_status',
79 api.path['checkout'].join('build', 'android', 'buildbot', 100 api.path['checkout'].join('third_party', 'catapult', 'devil', 'devil',
80 'bb_device_status_check.py'), 101 'android', 'buildbot', 'device_status.py'),
81 args=args, 102 args=args,
82 infra_step=True) 103 infra_step=True)
83 devices = [d['serial'] for d in result.json.output] 104
105 devices = []
106 offline_device_index = 1
107 for d in result.json.output:
108 try:
109 if not d['usb_status']:
110 key = '%s: missing' % d['serial']
111 elif d['adb_status'] != 'device':
112 key = '%s: adb status %s' % (d['serial'], d['adb_status'])
113 elif d['blacklisted']:
114 key = '%s: blacklisted' % d['serial']
115 else:
116 key = '%s %s %s' % (d['type'], d['build'], d['serial'])
117 devices.append(d['serial'])
118 except KeyError:
119 key = 'unknown device %d' % offline_device_index
120 offline_device_index += 1
121 result.presentation.logs[key] = api.m.json.dumps(
122 d, indent=2).splitlines()
84 result.presentation.step_text = 'Online devices: %s' % len(devices) 123 result.presentation.step_text = 'Online devices: %s' % len(devices)
124 return result
85 except api.step.InfraFailure as f: 125 except api.step.InfraFailure as f:
86 params = { 126 params = {
87 'summary': ('Device Offline on %s %s' % 127 'summary': ('Device Offline on %s %s' %
88 (api.properties['mastername'], api.properties['slavename'])), 128 (api.properties['mastername'], api.properties['slavename'])),
89 'comment': ('Buildbot: %s\n(Please do not change any labels)' % 129 'comment': ('Buildbot: %s\n(Please do not change any labels)' %
90 api.properties['buildername']), 130 api.properties['buildername']),
91 'labels': 'Restrict-View-Google,OS-Android,Infra-Client,Infra-Labs', 131 'labels': 'Restrict-View-Google,OS-Android,Infra-Client,Infra-Labs',
92 } 132 }
93 link = ('https://code.google.com/p/chromium/issues/entry?%s' % 133 link = ('https://code.google.com/p/chromium/issues/entry?%s' %
94 api.url.urlencode(params)) 134 api.url.urlencode(params))
95 f.result.presentation.links.update({ 135 f.result.presentation.links.update({
96 'report a bug': link 136 'report a bug': link
97 }) 137 })
98 raise 138 raise
99 139
100 api.python(
101 'provision_device',
102 api.path['checkout'].join('build', 'android', 'provision_devices.py'),
103 infra_step=True)
104
105
106 def _GetTestConfig(api): 140 def _GetTestConfig(api):
107 buildername = api.properties.get('buildername') 141 buildername = api.properties.get('buildername')
108 142
109 test_config = {} 143 test_config = {}
110 if 'Android' in buildername: 144 if 'Android' in buildername:
111 test_config['target_os'] = 'android' 145 test_config['target_os'] = 'android'
112 elif 'Linux' in buildername: 146 elif 'Linux' in buildername:
113 test_config['target_os'] = 'linux' 147 test_config['target_os'] = 'linux'
114 elif 'Win' in buildername: 148 elif 'Win' in buildername:
115 test_config['target_os'] = 'windows' 149 test_config['target_os'] = 'windows'
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 ['mojo_android_builder', 'Mojo Android Builder'], 249 ['mojo_android_builder', 'Mojo Android Builder'],
216 ['mojo_android_official', 'Mojo Android Official Builder'], 250 ['mojo_android_official', 'Mojo Android Official Builder'],
217 ['mojo_android_dbg', 'Mojo Android (dbg)'], 251 ['mojo_android_dbg', 'Mojo Android (dbg)'],
218 ['mojo_android_builder_tests_dbg', 'Mojo Android Builder Tests (dbg)'], 252 ['mojo_android_builder_tests_dbg', 'Mojo Android Builder Tests (dbg)'],
219 ['mojo_win_dbg', 'Mojo Win (dbg)'], 253 ['mojo_win_dbg', 'Mojo Win (dbg)'],
220 ['mojo_linux_perf', 'Mojo Linux Perf'] 254 ['mojo_linux_perf', 'Mojo Linux Perf']
221 ] 255 ]
222 for test_name, buildername in tests: 256 for test_name, buildername in tests:
223 test = api.test(test_name) + api.properties.generic(buildername=buildername) 257 test = api.test(test_name) + api.properties.generic(buildername=buildername)
224 if 'Android' in buildername and 'Tests' in buildername: 258 if 'Android' in buildername and 'Tests' in buildername:
225 test += api.step_data("device_status_check", api.json.output([{ 259 test += api.step_data("device_status", api.json.output([
226 "battery": { 260 {
227 "status": "5", 261 "battery": {
228 "scale": "100", 262 "status": "5",
229 "temperature": "249", 263 "scale": "100",
230 "level": "100", 264 "temperature": "249",
231 "AC powered": "false", 265 "level": "100",
232 "health": "2", 266 "AC powered": "false",
233 "voltage": "4286", 267 "health": "2",
234 "Wireless powered": "false", 268 "voltage": "4286",
235 "USB powered": "true", 269 "Wireless powered": "false",
236 "technology": "Li-ion", 270 "USB powered": "true",
237 "present": "true" 271 "technology": "Li-ion",
238 }, 272 "present": "true"
239 "wifi_ip": "", 273 },
240 "imei_slice": "Unknown", 274 "wifi_ip": "",
241 "build": "LRX21O", 275 "imei_slice": "Unknown",
242 "build_detail": 276 "build": "LRX21O",
243 "google/razor/flo:5.0/LRX21O/1570415:userdebug/dev-keys", 277 "build_detail":
244 "serial": "07a00ca4", 278 "google/razor/flo:5.0/LRX21O/1570415:userdebug/dev-keys",
245 "type": "flo" 279 "serial": "07a00ca4",
246 }])) 280 "type": "flo",
281 "adb_status": "device",
282 "blacklisted": False,
283 "usb_status": True,
284 },
285 {
286 "adb_status": "offline",
287 "blacklisted": True,
288 "serial": "03e0363a003c6ad4",
289 "usb_status": False,
290 },
291 {
292 "adb_status": "unauthorized",
293 "blacklisted": True,
294 "serial": "03e0363a003c6ad5",
295 "usb_status": True,
296 },
297 {
298 "adb_status": "device",
299 "blacklisted": True,
300 "serial": "03e0363a003c6ad6",
301 "usb_status": True,
302 },
303 {}
304 ]))
247 yield test 305 yield test
248 yield(api.test('mojo_linux_try') + 306 yield(api.test('mojo_linux_try') +
249 api.properties.tryserver(buildername="Mojo Linux Try")) 307 api.properties.tryserver(buildername="Mojo Linux Try"))
250 yield(api.test('mojo_android_builder_tests_dbg_fail_device_check') + 308 yield(api.test('mojo_android_builder_tests_dbg_fail_device_check') +
251 api.properties.tryserver(buildername="Mojo Android Builder Tests (dbg)") + 309 api.properties.tryserver(buildername="Mojo Android Builder Tests (dbg)") +
252 api.step_data("device_status_check", retcode=1)) 310 api.step_data("device_status", retcode=1))
253 311
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698