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

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

Issue 1281923003: [Android] Add --blacklist-file as a command-line option. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix telemetry_unittests Created 5 years, 4 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') | tools/telemetry/telemetry/benchmark_runner.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 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 8
9 This script will help verify that app data is preserved during an update. 9 This script will help verify that app data is preserved during an update.
10 To use this script first run it with the create_app_data option. 10 To use this script first run it with the create_app_data option.
(...skipping 13 matching lines...) Expand all
24 and ask the user to verify that all of the app data was preserved. 24 and ask the user to verify that all of the app data was preserved.
25 """ 25 """
26 26
27 import argparse 27 import argparse
28 import logging 28 import logging
29 import os 29 import os
30 import sys 30 import sys
31 import time 31 import time
32 32
33 from pylib import constants 33 from pylib import constants
34 from pylib.device import device_blacklist
34 from pylib.device import device_errors 35 from pylib.device import device_errors
35 from pylib.device import device_utils 36 from pylib.device import device_utils
36 from pylib.utils import apk_helper 37 from pylib.utils import apk_helper
37 from pylib.utils import run_tests_helper 38 from pylib.utils import run_tests_helper
38 39
39 def CreateAppData(device, old_apk, app_data, package_name): 40 def CreateAppData(device, old_apk, app_data, package_name):
40 device.Install(old_apk) 41 device.Install(old_apk)
41 raw_input('Set the application state. Once ready, press enter and ' 42 raw_input('Set the application state. Once ready, press enter and '
42 'select "Backup my data" on the device.') 43 'select "Backup my data" on the device.')
43 device.adb.Backup(app_data, packages=[package_name]) 44 device.adb.Backup(app_data, packages=[package_name])
(...skipping 13 matching lines...) Expand all
57 logging.info('Verifying that %s can be overinstalled.', new_apk) 58 logging.info('Verifying that %s can be overinstalled.', new_apk)
58 device.adb.Install(new_apk, reinstall=True) 59 device.adb.Install(new_apk, reinstall=True)
59 logging.critical('Successfully updated to the new apk. Please verify that ' 60 logging.critical('Successfully updated to the new apk. Please verify that '
60 'the application data is preserved.') 61 'the application data is preserved.')
61 62
62 def main(): 63 def main():
63 parser = argparse.ArgumentParser( 64 parser = argparse.ArgumentParser(
64 description="Script to do semi-automated upgrade testing.") 65 description="Script to do semi-automated upgrade testing.")
65 parser.add_argument('-v', '--verbose', action='count', 66 parser.add_argument('-v', '--verbose', action='count',
66 help='Print verbose log information.') 67 help='Print verbose log information.')
68 parser.add_argument('--blacklist-file', help='Device blacklist JSON file.')
67 command_parsers = parser.add_subparsers(dest='command') 69 command_parsers = parser.add_subparsers(dest='command')
68 70
69 subparser = command_parsers.add_parser('create_app_data') 71 subparser = command_parsers.add_parser('create_app_data')
70 subparser.add_argument('--old-apk', required=True, 72 subparser.add_argument('--old-apk', required=True,
71 help='Path to apk to update from.') 73 help='Path to apk to update from.')
72 subparser.add_argument('--app-data', required=True, 74 subparser.add_argument('--app-data', required=True,
73 help='Path to where the app data backup should be ' 75 help='Path to where the app data backup should be '
74 'saved to.') 76 'saved to.')
75 subparser.add_argument('--package-name', 77 subparser.add_argument('--package-name',
76 help='Chrome apk package name.') 78 help='Chrome apk package name.')
77 79
78 subparser = command_parsers.add_parser('test_update') 80 subparser = command_parsers.add_parser('test_update')
79 subparser.add_argument('--old-apk', required=True, 81 subparser.add_argument('--old-apk', required=True,
80 help='Path to apk to update from.') 82 help='Path to apk to update from.')
81 subparser.add_argument('--new-apk', required=True, 83 subparser.add_argument('--new-apk', required=True,
82 help='Path to apk to update to.') 84 help='Path to apk to update to.')
83 subparser.add_argument('--app-data', required=True, 85 subparser.add_argument('--app-data', required=True,
84 help='Path to where the app data backup is saved.') 86 help='Path to where the app data backup is saved.')
85 subparser.add_argument('--package-name', 87 subparser.add_argument('--package-name',
86 help='Chrome apk package name.') 88 help='Chrome apk package name.')
87 89
88 args = parser.parse_args() 90 args = parser.parse_args()
89 run_tests_helper.SetLogLevel(args.verbose) 91 run_tests_helper.SetLogLevel(args.verbose)
90 92
91 devices = device_utils.DeviceUtils.HealthyDevices() 93 if args.blacklist_file:
94 blacklist = device_blacklist.Blacklist(args.blacklist_file)
95 else:
96 blacklist = None
97
98 devices = device_utils.DeviceUtils.HealthyDevices(blacklist)
92 if not devices: 99 if not devices:
93 raise device_errors.NoDevicesError() 100 raise device_errors.NoDevicesError()
94 device = devices[0] 101 device = devices[0]
95 logging.info('Using device %s for testing.' % str(device)) 102 logging.info('Using device %s for testing.' % str(device))
96 103
97 package_name = (args.package_name if args.package_name 104 package_name = (args.package_name if args.package_name
98 else apk_helper.GetPackageName(args.old_apk)) 105 else apk_helper.GetPackageName(args.old_apk))
99 if args.command == 'create_app_data': 106 if args.command == 'create_app_data':
100 CreateAppData(device, args.old_apk, args.app_data, package_name) 107 CreateAppData(device, args.old_apk, args.app_data, package_name)
101 elif args.command == 'test_update': 108 elif args.command == 'test_update':
102 TestUpdate( 109 TestUpdate(
103 device, args.old_apk, args.new_apk, args.app_data, package_name) 110 device, args.old_apk, args.new_apk, args.app_data, package_name)
104 else: 111 else:
105 raise Exception('Unknown test command: %s' % args.command) 112 raise Exception('Unknown test command: %s' % args.command)
106 113
107 if __name__ == '__main__': 114 if __name__ == '__main__':
108 sys.exit(main()) 115 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/tombstones.py ('k') | tools/telemetry/telemetry/benchmark_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698