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

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

Issue 1630953002: [Android] Add configurable timeout to adb_install_apk.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | no next file » | 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 parser.add_argument('-d', '--device', dest='devices', action='append', 56 parser.add_argument('-d', '--device', dest='devices', action='append',
57 help='Target device for apk to install on. Enter multiple' 57 help='Target device for apk to install on. Enter multiple'
58 ' times for multiple devices.') 58 ' times for multiple devices.')
59 parser.add_argument('--adb-path', 59 parser.add_argument('--adb-path',
60 help='Absolute path to the adb binary to use.') 60 help='Absolute path to the adb binary to use.')
61 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') 61 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.')
62 parser.add_argument('-v', '--verbose', action='count', 62 parser.add_argument('-v', '--verbose', action='count',
63 help='Enable verbose logging.') 63 help='Enable verbose logging.')
64 parser.add_argument('--downgrade', action='store_true', 64 parser.add_argument('--downgrade', action='store_true',
65 help='If set, allows downgrading of apk.') 65 help='If set, allows downgrading of apk.')
66 parser.add_argument('--timeout', type=int,
67 default=device_utils.DeviceUtils.INSTALL_DEFAULT_TIMEOUT,
68 help='Seconds to wait for APK installation. '
69 '(default: %(default)s)')
66 70
67 args = parser.parse_args() 71 args = parser.parse_args()
68 72
69 run_tests_helper.SetLogLevel(args.verbose) 73 run_tests_helper.SetLogLevel(args.verbose)
70 constants.SetBuildType(args.build_type) 74 constants.SetBuildType(args.build_type)
71 75
72 devil_custom_deps = None 76 devil_custom_deps = None
73 if args.adb_path: 77 if args.adb_path:
74 devil_custom_deps = { 78 devil_custom_deps = {
75 'adb': { 79 'adb': {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 elif not devices: 118 elif not devices:
115 raise device_errors.NoDevicesError() 119 raise device_errors.NoDevicesError()
116 120
117 def blacklisting_install(device): 121 def blacklisting_install(device):
118 try: 122 try:
119 if args.splits: 123 if args.splits:
120 device.InstallSplitApk(apk, splits, reinstall=args.keep_data, 124 device.InstallSplitApk(apk, splits, reinstall=args.keep_data,
121 allow_downgrade=args.downgrade) 125 allow_downgrade=args.downgrade)
122 else: 126 else:
123 device.Install(apk, reinstall=args.keep_data, 127 device.Install(apk, reinstall=args.keep_data,
124 allow_downgrade=args.downgrade) 128 allow_downgrade=args.downgrade,
129 timeout=args.timeout)
125 except device_errors.CommandFailedError: 130 except device_errors.CommandFailedError:
126 logging.exception('Failed to install %s', args.apk_name) 131 logging.exception('Failed to install %s', args.apk_name)
127 if blacklist: 132 if blacklist:
128 blacklist.Extend([str(device)], reason='install_failure') 133 blacklist.Extend([str(device)], reason='install_failure')
129 logging.warning('Blacklisting %s', str(device)) 134 logging.warning('Blacklisting %s', str(device))
130 except device_errors.CommandTimeoutError: 135 except device_errors.CommandTimeoutError:
131 logging.exception('Timed out while installing %s', args.apk_name) 136 logging.exception('Timed out while installing %s', args.apk_name)
132 if blacklist: 137 if blacklist:
133 blacklist.Extend([str(device)], reason='install_timeout') 138 blacklist.Extend([str(device)], reason='install_timeout')
134 logging.warning('Blacklisting %s', str(device)) 139 logging.warning('Blacklisting %s', str(device))
135 140
136 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) 141 device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install)
137 142
138 143
139 if __name__ == '__main__': 144 if __name__ == '__main__':
140 sys.exit(main()) 145 sys.exit(main())
141 146
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698