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

Side by Side Diff: build/android/buildbot/bb_device_status_check.py

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « build/all.gyp ('k') | build/android/findbugs_filter/findbugs_known_bugs.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """A class to keep track of devices across builds and report state.""" 7 """A class to keep track of devices across builds and report state."""
8 import json 8 import json
9 import logging 9 import logging
10 import optparse 10 import optparse
(...skipping 28 matching lines...) Expand all
39 39
40 Args: 40 Args:
41 serial: The serial of the attached device to construct info about. 41 serial: The serial of the attached device to construct info about.
42 42
43 Returns: 43 Returns:
44 Tuple of device type, build id, report as a string, error messages, and 44 Tuple of device type, build id, report as a string, error messages, and
45 boolean indicating whether or not device can be used for testing. 45 boolean indicating whether or not device can be used for testing.
46 """ 46 """
47 47
48 device_adb = device_utils.DeviceUtils(serial) 48 device_adb = device_utils.DeviceUtils(serial)
49 device_type = device_adb.GetProp('ro.build.product') 49 device_type = device_adb.build_product
50 device_build = device_adb.GetProp('ro.build.id') 50 device_build = device_adb.build_id
51 device_build_type = device_adb.GetProp('ro.build.type') 51 device_build_type = device_adb.build_type
52 device_product_name = device_adb.GetProp('ro.product.name') 52 device_product_name = device_adb.product_name
53 53
54 try: 54 try:
55 battery_info = device_adb.old_interface.GetBatteryInfo() 55 battery_info = device_adb.old_interface.GetBatteryInfo()
56 except Exception as e: 56 except Exception as e:
57 battery_info = {} 57 battery_info = {}
58 logging.error('Unable to obtain battery info for %s, %s', serial, e) 58 logging.error('Unable to obtain battery info for %s, %s', serial, e)
59 59
60 def _GetData(re_expression, line, lambda_function=lambda x: x): 60 def _GetData(re_expression, line, lambda_function=lambda x: x):
61 if not line: 61 if not line:
62 return 'Unknown' 62 return 'Unknown'
63 found = re.findall(re_expression, line) 63 found = re.findall(re_expression, line)
64 if found and len(found): 64 if found and len(found):
65 return lambda_function(found[0]) 65 return lambda_function(found[0])
66 return 'Unknown' 66 return 'Unknown'
67 67
68 battery_level = int(battery_info.get('level', 100)) 68 battery_level = int(battery_info.get('level', 100))
69 imei_slice = _GetData(r'Device ID = (\d+)', 69 imei_slice = _GetData(r'Device ID = (\d+)',
70 device_adb.old_interface.GetSubscriberInfo(), 70 device_adb.old_interface.GetSubscriberInfo(),
71 lambda x: x[-6:]) 71 lambda x: x[-6:])
72 report = ['Device %s (%s)' % (serial, device_type), 72 report = ['Device %s (%s)' % (serial, device_type),
73 ' Build: %s (%s)' % 73 ' Build: %s (%s)' %
74 (device_build, device_adb.GetProp('ro.build.fingerprint')), 74 (device_build, device_adb.build_fingerprint),
75 ' Current Battery Service state: ', 75 ' Current Battery Service state: ',
76 '\n'.join([' %s: %s' % (k, v) 76 '\n'.join([' %s: %s' % (k, v)
77 for k, v in battery_info.iteritems()]), 77 for k, v in battery_info.iteritems()]),
78 ' IMEI slice: %s' % imei_slice, 78 ' IMEI slice: %s' % imei_slice,
79 ' Wifi IP: %s' % device_adb.GetProp('dhcp.wlan0.ipaddress'), 79 ' Wifi IP: %s' % device_adb.GetProp('dhcp.wlan0.ipaddress'),
80 ''] 80 '']
81 81
82 errors = [] 82 errors = []
83 dev_good = True 83 dev_good = True
84 if battery_level < 15: 84 if battery_level < 15:
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 379
380 if num_failed_devs == len(devices): 380 if num_failed_devs == len(devices):
381 return 2 381 return 2
382 382
383 if not devices: 383 if not devices:
384 return 1 384 return 1
385 385
386 386
387 if __name__ == '__main__': 387 if __name__ == '__main__':
388 sys.exit(main()) 388 sys.exit(main())
OLDNEW
« no previous file with comments | « build/all.gyp ('k') | build/android/findbugs_filter/findbugs_known_bugs.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698