OLD | NEW |
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 |
11 import smtplib | 11 import smtplib |
12 import sys | 12 import sys |
13 import re | 13 import re |
14 import urllib | 14 import urllib |
15 | 15 |
16 import bb_annotations | 16 import bb_annotations |
17 | 17 |
| 18 sys.path.append(os.path.join(os.path.dirname(__file__), |
| 19 os.pardir, os.pardir, 'util', 'lib', |
| 20 'common')) |
| 21 import perf_tests_results_helper # pylint: disable=F0401 |
| 22 |
18 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 23 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
19 from pylib import android_commands | 24 from pylib import android_commands |
20 from pylib import constants | 25 from pylib import constants |
21 from pylib import perf_tests_helper | |
22 from pylib.cmd_helper import GetCmdOutput | 26 from pylib.cmd_helper import GetCmdOutput |
23 | 27 |
24 | 28 |
25 def DeviceInfo(serial, options): | 29 def DeviceInfo(serial, options): |
26 """Gathers info on a device via various adb calls. | 30 """Gathers info on a device via various adb calls. |
27 | 31 |
28 Args: | 32 Args: |
29 serial: The serial of the attached device to construct info about. | 33 serial: The serial of the attached device to construct info about. |
30 | 34 |
31 Returns: | 35 Returns: |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 err_msg += ['%s errors:' % serial] | 241 err_msg += ['%s errors:' % serial] |
238 err_msg += [' %s' % error for error in dev_errors] | 242 err_msg += [' %s' % error for error in dev_errors] |
239 | 243 |
240 if err_msg: | 244 if err_msg: |
241 bb_annotations.PrintWarning() | 245 bb_annotations.PrintWarning() |
242 msg = '\n'.join(err_msg) | 246 msg = '\n'.join(err_msg) |
243 print msg | 247 print msg |
244 SendDeviceStatusAlert(msg) | 248 SendDeviceStatusAlert(msg) |
245 | 249 |
246 if options.device_status_dashboard: | 250 if options.device_status_dashboard: |
247 perf_tests_helper.PrintPerfResult('BotDevices', 'OnlineDevices', | 251 perf_tests_results_helper.PrintPerfResult('BotDevices', 'OnlineDevices', |
248 [len(devices)], 'devices') | 252 [len(devices)], 'devices') |
249 perf_tests_helper.PrintPerfResult('BotDevices', 'OfflineDevices', | 253 perf_tests_results_helper.PrintPerfResult('BotDevices', 'OfflineDevices', |
250 [len(offline_devices)], 'devices', | 254 [len(offline_devices)], 'devices', |
251 'unimportant') | 255 'unimportant') |
252 for serial, battery in zip(devices, batteries): | 256 for serial, battery in zip(devices, batteries): |
253 perf_tests_helper.PrintPerfResult('DeviceBattery', serial, [battery], '%', | 257 perf_tests_results_helper.PrintPerfResult('DeviceBattery', serial, |
254 'unimportant') | 258 [battery], '%', |
| 259 'unimportant') |
255 | 260 |
256 if False in fail_step_lst: | 261 if False in fail_step_lst: |
257 # TODO(navabi): Build fails on device status check step if there exists any | 262 # TODO(navabi): Build fails on device status check step if there exists any |
258 # devices with critically low battery or install speed. Remove those devices | 263 # devices with critically low battery or install speed. Remove those devices |
259 # from testing, allowing build to continue with good devices. | 264 # from testing, allowing build to continue with good devices. |
260 return 1 | 265 return 1 |
261 | 266 |
262 if not devices: | 267 if not devices: |
263 return 1 | 268 return 1 |
264 | 269 |
265 | 270 |
266 if __name__ == '__main__': | 271 if __name__ == '__main__': |
267 sys.exit(main()) | 272 sys.exit(main()) |
OLD | NEW |