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

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

Powered by Google App Engine
This is Rietveld 408576698