OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 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 """Provisions Android devices with settings required for bots. | 7 """Provisions Android devices with settings required for bots. |
8 | 8 |
9 Usage: | 9 Usage: |
10 ./provision_devices.py [-d <device serial number>] | 10 ./provision_devices.py [-d <device serial number>] |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 Arguments: | 52 Arguments: |
53 devices: The list of serial numbers of the device to which the | 53 devices: The list of serial numbers of the device to which the |
54 adb_reboot binary should be pushed. | 54 adb_reboot binary should be pushed. |
55 target : The build target (example, Debug or Release) which helps in | 55 target : The build target (example, Debug or Release) which helps in |
56 locating the adb_reboot binary. | 56 locating the adb_reboot binary. |
57 """ | 57 """ |
58 for device_serial in devices: | 58 for device_serial in devices: |
59 print 'Will push and launch adb_reboot on %s' % device_serial | 59 print 'Will push and launch adb_reboot on %s' % device_serial |
60 device = device_utils.DeviceUtils(device_serial) | 60 device = device_utils.DeviceUtils(device_serial) |
61 # Kill if adb_reboot is already running. | 61 # Kill if adb_reboot is already running. |
62 device.old_interface.KillAllBlocking('adb_reboot', 2) | 62 device.KillAll('adb_reboot', blocking=True, timeout=2) |
63 # Push adb_reboot | 63 # Push adb_reboot |
64 print ' Pushing adb_reboot ...' | 64 print ' Pushing adb_reboot ...' |
65 adb_reboot = os.path.join(constants.DIR_SOURCE_ROOT, | 65 adb_reboot = os.path.join(constants.DIR_SOURCE_ROOT, |
66 'out/%s/adb_reboot' % target) | 66 'out/%s/adb_reboot' % target) |
67 device.old_interface.PushIfNeeded(adb_reboot, '/data/local/tmp/') | 67 device.old_interface.PushIfNeeded(adb_reboot, '/data/local/tmp/') |
68 # Launch adb_reboot | 68 # Launch adb_reboot |
69 print ' Launching adb_reboot ...' | 69 print ' Launching adb_reboot ...' |
70 device.old_interface.GetAndroidToolStatusAndOutput( | 70 device.old_interface.GetAndroidToolStatusAndOutput( |
71 '/data/local/tmp/adb_reboot') | 71 '/data/local/tmp/adb_reboot') |
72 LaunchHostHeartbeat() | 72 LaunchHostHeartbeat() |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 if args: | 207 if args: |
208 print >> sys.stderr, 'Unused args %s' % args | 208 print >> sys.stderr, 'Unused args %s' % args |
209 return 1 | 209 return 1 |
210 | 210 |
211 ProvisionDevices(options) | 211 ProvisionDevices(options) |
212 | 212 |
213 | 213 |
214 if __name__ == '__main__': | 214 if __name__ == '__main__': |
215 sys.exit(main(sys.argv)) | 215 sys.exit(main(sys.argv)) |
OLD | NEW |