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

Side by Side Diff: build/android/adb_install_apk.py

Issue 2811993002: [devil refactor] Prepare clients for DeviceUnreachableError (Closed)
Patch Set: Created 3 years, 8 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
« 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 (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 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 """Utility script to install APKs from the command line quickly.""" 7 """Utility script to install APKs from the command line quickly."""
8 8
9 import argparse 9 import argparse
10 import glob 10 import glob
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 def blacklisting_install(device): 107 def blacklisting_install(device):
108 try: 108 try:
109 if args.splits: 109 if args.splits:
110 device.InstallSplitApk(apk, splits, reinstall=args.keep_data, 110 device.InstallSplitApk(apk, splits, reinstall=args.keep_data,
111 allow_downgrade=args.downgrade) 111 allow_downgrade=args.downgrade)
112 else: 112 else:
113 device.Install(apk, reinstall=args.keep_data, 113 device.Install(apk, reinstall=args.keep_data,
114 allow_downgrade=args.downgrade, 114 allow_downgrade=args.downgrade,
115 timeout=args.timeout) 115 timeout=args.timeout)
116 except device_errors.CommandFailedError: 116 except (device_errors.CommandFailedError,
117 device_errors.DeviceUnreachableError):
117 logging.exception('Failed to install %s', args.apk_name) 118 logging.exception('Failed to install %s', args.apk_name)
118 if blacklist: 119 if blacklist:
119 blacklist.Extend([str(device)], reason='install_failure') 120 blacklist.Extend([str(device)], reason='install_failure')
120 logging.warning('Blacklisting %s', str(device)) 121 logging.warning('Blacklisting %s', str(device))
121 except device_errors.CommandTimeoutError: 122 except device_errors.CommandTimeoutError:
122 logging.exception('Timed out while installing %s', args.apk_name) 123 logging.exception('Timed out while installing %s', args.apk_name)
123 if blacklist: 124 if blacklist:
124 blacklist.Extend([str(device)], reason='install_timeout') 125 blacklist.Extend([str(device)], reason='install_timeout')
125 logging.warning('Blacklisting %s', str(device)) 126 logging.warning('Blacklisting %s', str(device))
126 127
127 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) 128 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install)
128 129
129 130
130 if __name__ == '__main__': 131 if __name__ == '__main__':
131 sys.exit(main()) 132 sys.exit(main())
132
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