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

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

Issue 1101603002: [Android] Rework device filtering and add DeviceUtils.HealthyDevices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: perezju comments Created 5 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 | « build/android/tombstones.py ('k') | 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 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 """Runs semi-automated update testing on a non-rooted device.""" 7 """Runs semi-automated update testing on a non-rooted device."""
8 import logging 8 import logging
9 import optparse 9 import optparse
10 import os 10 import os
11 import shutil 11 import shutil
12 import sys 12 import sys
13 import time 13 import time
14 14
15 from pylib.device import adb_wrapper
16 from pylib.device import device_filter
17 from pylib.device import device_utils 15 from pylib.device import device_utils
18 16
19 def _SaveAppData(device, package_name, from_apk=None, data_dir=None): 17 def _SaveAppData(device, package_name, from_apk=None, data_dir=None):
20 def _BackupAppData(data_dir=None): 18 def _BackupAppData(data_dir=None):
21 device.adb.Backup(package_name) 19 device.adb.Backup(package_name)
22 backup_file = os.path.join(os.getcwd(), 'backup.ab') 20 backup_file = os.path.join(os.getcwd(), 'backup.ab')
23 assert os.path.exists(backup_file), 'Backup failed.' 21 assert os.path.exists(backup_file), 'Backup failed.'
24 if data_dir: 22 if data_dir:
25 if not os.path.isdir(data_dir): 23 if not os.path.isdir(data_dir):
26 os.makedirs(data_dir) 24 os.makedirs(data_dir)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 parser.add_option('--to-apk', help='APK to update to.') 100 parser.add_option('--to-apk', help='APK to update to.')
103 parser.add_option('--app-data', 101 parser.add_option('--app-data',
104 help=('Path to the application data to be restored or the ' 102 help=('Path to the application data to be restored or the '
105 'directory where the data should be saved.')) 103 'directory where the data should be saved.'))
106 (options, args) = parser.parse_args() 104 (options, args) = parser.parse_args()
107 105
108 if args: 106 if args:
109 parser.print_help(sys.stderr) 107 parser.print_help(sys.stderr)
110 parser.error('Unknown arguments: %s.' % args) 108 parser.error('Unknown arguments: %s.' % args)
111 109
112 devices = adb_wrapper.AdbWrapper.Devices( 110 devices = device_utils.DeviceUtils.HealthyDevices()
113 filters=device_filter.DefaultFilters())
114 if len(devices) != 1: 111 if len(devices) != 1:
115 parser.error('Exactly 1 device must be attached.') 112 parser.error('Exactly 1 device must be attached.')
116 device = device_utils.DeviceUtils(devices[0]) 113 device = devices[0]
117 114
118 if options.from_apk: 115 if options.from_apk:
119 assert os.path.isfile(options.from_apk) 116 assert os.path.isfile(options.from_apk)
120 117
121 if options.save: 118 if options.save:
122 if not options.package_name: 119 if not options.package_name:
123 parser.print_help(sys.stderr) 120 parser.print_help(sys.stderr)
124 parser.error('Missing --package-name.') 121 parser.error('Missing --package-name.')
125 _SaveAppData(device, options.package_name, from_apk=options.from_apk, 122 _SaveAppData(device, options.package_name, from_apk=options.from_apk,
126 data_dir=options.app_data) 123 data_dir=options.app_data)
127 else: 124 else:
128 if not options.to_apk or not options.app_data: 125 if not options.to_apk or not options.app_data:
129 parser.print_help(sys.stderr) 126 parser.print_help(sys.stderr)
130 parser.error('Missing --to-apk or --app-data.') 127 parser.error('Missing --to-apk or --app-data.')
131 assert os.path.isfile(options.to_apk) 128 assert os.path.isfile(options.to_apk)
132 assert os.path.isfile(options.app_data) 129 assert os.path.isfile(options.app_data)
133 _VerifyAppUpdate(device, options.to_apk, options.app_data, 130 _VerifyAppUpdate(device, options.to_apk, options.app_data,
134 from_apk=options.from_apk) 131 from_apk=options.from_apk)
135 132
136 133
137 if __name__ == '__main__': 134 if __name__ == '__main__':
138 main() 135 main()
OLDNEW
« no previous file with comments | « build/android/tombstones.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698