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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if options.chrome_specific_wipe: | 115 if options.chrome_specific_wipe: |
116 package = "com.google.android.gms" | 116 package = "com.google.android.gms" |
117 version_name = device.GetApplicationVersion(package) | 117 version_name = device.GetApplicationVersion(package) |
118 logging.info("Version name for %s is %s", package, version_name) | 118 logging.info("Version name for %s is %s", package, version_name) |
119 | 119 |
120 CheckExternalStorage(device) | 120 CheckExternalStorage(device) |
121 | 121 |
122 except device_errors.CommandTimeoutError: | 122 except device_errors.CommandTimeoutError: |
123 logging.exception('Timed out waiting for device %s. Adding to blacklist.', | 123 logging.exception('Timed out waiting for device %s. Adding to blacklist.', |
124 str(device)) | 124 str(device)) |
125 blacklist.Extend([str(device)]) | 125 blacklist.Extend([str(device)], reason='provision_timeout') |
126 | 126 |
127 except device_errors.CommandFailedError: | 127 except device_errors.CommandFailedError: |
128 logging.exception('Failed to provision device %s. Adding to blacklist.', | 128 logging.exception('Failed to provision device %s. Adding to blacklist.', |
129 str(device)) | 129 str(device)) |
130 blacklist.Extend([str(device)]) | 130 blacklist.Extend([str(device)], reason='provision_failure') |
131 | 131 |
132 def CheckExternalStorage(device): | 132 def CheckExternalStorage(device): |
133 """Checks that storage is writable and if not makes it writable. | 133 """Checks that storage is writable and if not makes it writable. |
134 | 134 |
135 Arguments: | 135 Arguments: |
136 device: The device to check. | 136 device: The device to check. |
137 """ | 137 """ |
138 try: | 138 try: |
139 with device_temp_file.DeviceTempFile( | 139 with device_temp_file.DeviceTempFile( |
140 device.adb, suffix='.sh', dir=device.GetExternalStoragePath()) as f: | 140 device.adb, suffix='.sh', dir=device.GetExternalStoragePath()) as f: |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 args = parser.parse_args() | 482 args = parser.parse_args() |
483 constants.SetBuildType(args.target) | 483 constants.SetBuildType(args.target) |
484 | 484 |
485 run_tests_helper.SetLogLevel(args.verbose) | 485 run_tests_helper.SetLogLevel(args.verbose) |
486 | 486 |
487 return ProvisionDevices(args) | 487 return ProvisionDevices(args) |
488 | 488 |
489 | 489 |
490 if __name__ == '__main__': | 490 if __name__ == '__main__': |
491 sys.exit(main()) | 491 sys.exit(main()) |
OLD | NEW |