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

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

Issue 23885004: Do not perform unnecessary install for device status dashboard step. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 logging 8 import logging
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 24 matching lines...) Expand all
35 35
36 device_adb = android_commands.AndroidCommands(serial) 36 device_adb = android_commands.AndroidCommands(serial)
37 37
38 # TODO(navabi): Replace AdbShellCmd with device_adb. 38 # TODO(navabi): Replace AdbShellCmd with device_adb.
39 device_type = device_adb.GetBuildProduct() 39 device_type = device_adb.GetBuildProduct()
40 device_build = device_adb.GetBuildId() 40 device_build = device_adb.GetBuildId()
41 device_build_type = device_adb.GetBuildType() 41 device_build_type = device_adb.GetBuildType()
42 device_product_name = device_adb.GetProductName() 42 device_product_name = device_adb.GetProductName()
43 43
44 battery = device_adb.GetBatteryInfo() 44 battery = device_adb.GetBatteryInfo()
45 install_output = GetCmdOutput(
46 ['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT, '--apk',
47 '%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT])
48 45
49 def _GetData(re_expression, line, lambda_function=lambda x:x): 46 def _GetData(re_expression, line, lambda_function=lambda x:x):
50 if not line: 47 if not line:
51 return 'Unknown' 48 return 'Unknown'
52 found = re.findall(re_expression, line) 49 found = re.findall(re_expression, line)
53 if found and len(found): 50 if found and len(found):
54 return lambda_function(found[0]) 51 return lambda_function(found[0])
55 return 'Unknown' 52 return 'Unknown'
56 53
57 install_speed = _GetData('(\d+) KB/s', install_output) 54 if options.device_status_dashboard:
55 # Dashboard does not track install speed. Do not unnecessarily install.
56 install_speed = 'Unknown'
57 else:
58 install_output = GetCmdOutput(
59 ['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT,
60 '--apk',
61 '%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT
62 ])
63 install_speed = _GetData('(\d+) KB/s', install_output)
64
58 ac_power = _GetData('AC powered: (\w+)', battery) 65 ac_power = _GetData('AC powered: (\w+)', battery)
59 battery_level = _GetData('level: (\d+)', battery) 66 battery_level = _GetData('level: (\d+)', battery)
60 battery_temp = _GetData('temperature: (\d+)', battery, 67 battery_temp = _GetData('temperature: (\d+)', battery,
61 lambda x: float(x) / 10.0) 68 lambda x: float(x) / 10.0)
62 imei_slice = _GetData('Device ID = (\d+)', 69 imei_slice = _GetData('Device ID = (\d+)',
63 device_adb.GetSubscriberInfo(), 70 device_adb.GetSubscriberInfo(),
64 lambda x: x[-6:]) 71 lambda x: x[-6:])
65 report = ['Device %s (%s)' % (serial, device_type), 72 report = ['Device %s (%s)' % (serial, device_type),
66 ' Build: %s (%s)' % 73 ' Build: %s (%s)' %
67 (device_build, device_adb.GetBuildFingerprint()), 74 (device_build, device_adb.GetBuildFingerprint()),
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 # devices with critically low battery or install speed. Remove those devices 258 # devices with critically low battery or install speed. Remove those devices
252 # from testing, allowing build to continue with good devices. 259 # from testing, allowing build to continue with good devices.
253 return 1 260 return 1
254 261
255 if not devices: 262 if not devices:
256 return 1 263 return 1
257 264
258 265
259 if __name__ == '__main__': 266 if __name__ == '__main__':
260 sys.exit(main()) 267 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698