Chromium Code Reviews| Index: scripts/slave/recipes/mojo.py |
| diff --git a/scripts/slave/recipes/mojo.py b/scripts/slave/recipes/mojo.py |
| index 203ef78edd463485ab360226ea23071e54e0cb45..ecc954297f662d167c4955e0f556388627e4419e 100644 |
| --- a/scripts/slave/recipes/mojo.py |
| +++ b/scripts/slave/recipes/mojo.py |
| @@ -3,6 +3,7 @@ |
| # found in the LICENSE file. |
| DEPS = [ |
| + '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.
|
| 'depot_tools/bot_update', |
| 'depot_tools/gclient', |
| 'recipe_engine/json', |
| @@ -67,21 +68,61 @@ def _BuildSteps(api, buildername, is_debug, is_official): |
| def _DeviceCheckStep(api): |
| - devices_path = api.m.path['build'].join('site_config', '.known_devices') |
| + |
| + known_devices_path = api.m.path['build'].join('site_config', '.known_devices') |
| + # Device Recovery |
| args = [ |
| - '--json-output', api.json.output(), |
| - '--restart-usb', |
| - '--known-devices-file', devices_path, |
| + '--known-devices-file', known_devices_path, |
| + '-v' |
| ] |
| + 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
|
| + 'device_recovery', |
| + [api.m.path['checkout'].join('third_party', 'catapult', 'devil', |
| + 'devil', 'android', 'tools', |
| + 'device_recovery.py')] + args, |
| + infra_step=True,) |
| + # Device provisioning |
| + api.python( |
| + 'provision_device', |
| + api.path['checkout'].join('build', 'android', 'provision_devices.py'), |
| + infra_step=True) |
| + # Device status check |
| try: |
| + buildbot_file = '/home/chrome-bot/.adb_device_info' |
| + args = [ |
| + '--json-output', api.m.json.output(), |
| + '--known-devices-file', known_devices_path, |
| + '--buildbot-path', buildbot_file, |
| + '-v', '--overwrite-known-devices-files', |
| + ] |
| + |
| result = api.python( |
| - 'device_status_check', |
| - api.path['checkout'].join('build', 'android', 'buildbot', |
| - 'bb_device_status_check.py'), |
| + 'device_status', |
| + api.path['checkout'].join('third_party', 'catapult', 'devil', 'devil', |
| + 'android', 'buildbot', 'device_status.py'), |
| args=args, |
| infra_step=True) |
| - devices = [d['serial'] for d in result.json.output] |
| + |
| + devices = [] |
| + offline_device_index = 1 |
| + for d in result.json.output: |
| + try: |
| + if not d['usb_status']: |
| + key = '%s: missing' % d['serial'] |
| + elif d['adb_status'] != 'device': |
| + key = '%s: adb status %s' % (d['serial'], d['adb_status']) |
| + elif d['blacklisted']: |
| + key = '%s: blacklisted' % d['serial'] |
| + else: |
| + key = '%s %s %s' % (d['type'], d['build'], d['serial']) |
| + devices.append(d['serial']) |
| + except KeyError: |
| + key = 'unknown device %d' % offline_device_index |
| + offline_device_index += 1 |
| + result.presentation.logs[key] = api.m.json.dumps( |
| + d, indent=2).splitlines() |
| result.presentation.step_text = 'Online devices: %s' % len(devices) |
| + return result |
| except api.step.InfraFailure as f: |
| params = { |
| 'summary': ('Device Offline on %s %s' % |
| @@ -97,12 +138,6 @@ def _DeviceCheckStep(api): |
| }) |
| raise |
| - api.python( |
| - 'provision_device', |
| - api.path['checkout'].join('build', 'android', 'provision_devices.py'), |
| - infra_step=True) |
| - |
| - |
| def _GetTestConfig(api): |
| buildername = api.properties.get('buildername') |
| @@ -222,32 +257,56 @@ def GenTests(api): |
| for test_name, buildername in tests: |
| test = api.test(test_name) + api.properties.generic(buildername=buildername) |
| if 'Android' in buildername and 'Tests' in buildername: |
| - test += api.step_data("device_status_check", api.json.output([{ |
| - "battery": { |
| - "status": "5", |
| - "scale": "100", |
| - "temperature": "249", |
| - "level": "100", |
| - "AC powered": "false", |
| - "health": "2", |
| - "voltage": "4286", |
| - "Wireless powered": "false", |
| - "USB powered": "true", |
| - "technology": "Li-ion", |
| - "present": "true" |
| - }, |
| - "wifi_ip": "", |
| - "imei_slice": "Unknown", |
| - "build": "LRX21O", |
| - "build_detail": |
| - "google/razor/flo:5.0/LRX21O/1570415:userdebug/dev-keys", |
| - "serial": "07a00ca4", |
| - "type": "flo" |
| - }])) |
| + test += api.step_data("device_status", api.json.output([ |
| + { |
| + "battery": { |
| + "status": "5", |
| + "scale": "100", |
| + "temperature": "249", |
| + "level": "100", |
| + "AC powered": "false", |
| + "health": "2", |
| + "voltage": "4286", |
| + "Wireless powered": "false", |
| + "USB powered": "true", |
| + "technology": "Li-ion", |
| + "present": "true" |
| + }, |
| + "wifi_ip": "", |
| + "imei_slice": "Unknown", |
| + "build": "LRX21O", |
| + "build_detail": |
| + "google/razor/flo:5.0/LRX21O/1570415:userdebug/dev-keys", |
| + "serial": "07a00ca4", |
| + "type": "flo", |
| + "adb_status": "device", |
| + "blacklisted": False, |
| + "usb_status": True, |
| + }, |
| + { |
| + "adb_status": "offline", |
| + "blacklisted": True, |
| + "serial": "03e0363a003c6ad4", |
| + "usb_status": False, |
| + }, |
| + { |
| + "adb_status": "unauthorized", |
| + "blacklisted": True, |
| + "serial": "03e0363a003c6ad5", |
| + "usb_status": True, |
| + }, |
| + { |
| + "adb_status": "device", |
| + "blacklisted": True, |
| + "serial": "03e0363a003c6ad6", |
| + "usb_status": True, |
| + }, |
| + {} |
| + ])) |
| yield test |
| yield(api.test('mojo_linux_try') + |
| api.properties.tryserver(buildername="Mojo Linux Try")) |
| yield(api.test('mojo_android_builder_tests_dbg_fail_device_check') + |
| api.properties.tryserver(buildername="Mojo Android Builder Tests (dbg)") + |
| - api.step_data("device_status_check", retcode=1)) |
| + api.step_data("device_status", retcode=1)) |