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

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

Issue 204353011: If install of test apk fails because of storage, wipe device data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use constants.ADB_KEYS_FILE. Created 6 years, 9 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 | build/android/provision_devices.py » ('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 logging 8 import logging
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 logging.error('Unable to obtain battery info for %s, %s', serial, e) 57 logging.error('Unable to obtain battery info for %s, %s', serial, e)
58 58
59 def _GetData(re_expression, line, lambda_function=lambda x:x): 59 def _GetData(re_expression, line, lambda_function=lambda x:x):
60 if not line: 60 if not line:
61 return 'Unknown' 61 return 'Unknown'
62 found = re.findall(re_expression, line) 62 found = re.findall(re_expression, line)
63 if found and len(found): 63 if found and len(found):
64 return lambda_function(found[0]) 64 return lambda_function(found[0])
65 return 'Unknown' 65 return 'Unknown'
66 66
67 if options.device_status_dashboard:
68 # Dashboard does not track install speed. Do not unnecessarily install.
69 install_speed = 'Unknown'
70 else:
71 install_output = GetCmdOutput(
72 ['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT,
73 '--apk',
74 '%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT
75 ])
76 install_speed = _GetData('(\d+) KB/s', install_output)
77
78 ac_power = _GetData('AC powered: (\w+)', battery) 67 ac_power = _GetData('AC powered: (\w+)', battery)
79 battery_level = _GetData('level: (\d+)', battery) 68 battery_level = _GetData('level: (\d+)', battery)
80 battery_temp = _GetData('temperature: (\d+)', battery, 69 battery_temp = _GetData('temperature: (\d+)', battery,
81 lambda x: float(x) / 10.0) 70 lambda x: float(x) / 10.0)
82 imei_slice = _GetData('Device ID = (\d+)', 71 imei_slice = _GetData('Device ID = (\d+)',
83 device_adb.GetSubscriberInfo(), 72 device_adb.GetSubscriberInfo(),
84 lambda x: x[-6:]) 73 lambda x: x[-6:])
85 report = ['Device %s (%s)' % (serial, device_type), 74 report = ['Device %s (%s)' % (serial, device_type),
86 ' Build: %s (%s)' % 75 ' Build: %s (%s)' %
87 (device_build, device_adb.GetBuildFingerprint()), 76 (device_build, device_adb.GetBuildFingerprint()),
88 ' Battery: %s%%' % battery_level, 77 ' Battery: %s%%' % battery_level,
89 ' Battery temp: %s' % battery_temp, 78 ' Battery temp: %s' % battery_temp,
90 ' IMEI slice: %s' % imei_slice, 79 ' IMEI slice: %s' % imei_slice,
91 ' Wifi IP: %s' % device_adb.GetWifiIP(), 80 ' Wifi IP: %s' % device_adb.GetWifiIP(),
92 ' Install Speed: %s KB/s' % install_speed,
93 ''] 81 '']
94 82
95 errors = [] 83 errors = []
96 if battery_level < 15: 84 if battery_level < 15:
97 errors += ['Device critically low in battery. Turning off device.'] 85 errors += ['Device critically low in battery. Turning off device.']
98 if not options.no_provisioning_check: 86 if not options.no_provisioning_check:
99 setup_wizard_disabled = device_adb.GetSetupWizardStatus() == 'DISABLED' 87 setup_wizard_disabled = device_adb.GetSetupWizardStatus() == 'DISABLED'
100 if not setup_wizard_disabled and device_build_type != 'user': 88 if not setup_wizard_disabled and device_build_type != 'user':
101 errors += ['Setup wizard not disabled. Was it provisioned correctly?'] 89 errors += ['Setup wizard not disabled. Was it provisioned correctly?']
102 if device_product_name == 'mantaray' and ac_power != 'true': 90 if device_product_name == 'mantaray' and ac_power != 'true':
103 errors += ['Mantaray device not connected to AC power.'] 91 errors += ['Mantaray device not connected to AC power.']
104 # TODO(navabi): Insert warning once we have a better handle of what install
105 # speeds to expect. The following lines were causing too many alerts.
106 # if install_speed < 500:
107 # errors += ['Device install speed too low. Do not use for testing.']
108 92
109 # Causing the device status check step fail for slow install speed or low 93 # Turn off devices with low battery.
110 # battery currently is too disruptive to the bots (especially try bots).
111 # Turn off devices with low battery and the step does not fail.
112 if battery_level < 15: 94 if battery_level < 15:
113 device_adb.EnableAdbRoot() 95 device_adb.EnableAdbRoot()
114 device_adb.Shutdown() 96 device_adb.Shutdown()
115 full_report = '\n'.join(report) 97 full_report = '\n'.join(report)
116 return device_type, device_build, battery_level, full_report, errors, True 98 return device_type, device_build, battery_level, full_report, errors, True
117 99
118 100
119 def GetLastDevices(out_dir): 101 def GetLastDevices(out_dir):
120 """Returns a list of devices that have been seen on the bot. 102 """Returns a list of devices that have been seen on the bot.
121 103
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 perf_tests_results_helper.PrintPerfResult('BotDevices', 'OfflineDevices', 340 perf_tests_results_helper.PrintPerfResult('BotDevices', 'OfflineDevices',
359 [len(offline_devices)], 'devices', 341 [len(offline_devices)], 'devices',
360 'unimportant') 342 'unimportant')
361 for serial, battery in zip(devices, batteries): 343 for serial, battery in zip(devices, batteries):
362 perf_tests_results_helper.PrintPerfResult('DeviceBattery', serial, 344 perf_tests_results_helper.PrintPerfResult('DeviceBattery', serial,
363 [battery], '%', 345 [battery], '%',
364 'unimportant') 346 'unimportant')
365 347
366 if False in fail_step_lst: 348 if False in fail_step_lst:
367 # TODO(navabi): Build fails on device status check step if there exists any 349 # TODO(navabi): Build fails on device status check step if there exists any
368 # devices with critically low battery or install speed. Remove those devices 350 # devices with critically low battery. Remove those devices from testing,
369 # from testing, allowing build to continue with good devices. 351 # allowing build to continue with good devices.
370 return 1 352 return 1
371 353
372 if not devices: 354 if not devices:
373 return 1 355 return 1
374 356
375 357
376 if __name__ == '__main__': 358 if __name__ == '__main__':
377 sys.exit(main()) 359 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | build/android/provision_devices.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698