Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """Launches Android Virtual Devices with a set configuration for testing Chrome. | |
| 7 | |
| 8 The script will launch a specified number of Android Virtual Devices (AVD's). | |
| 9 """ | |
| 10 | |
| 11 | |
| 12 import logging | |
| 13 import optparse | |
| 14 import os | |
| 15 import subprocess | |
| 16 import sys | |
| 17 | |
| 18 from pylib.utils import emulator | |
| 19 | |
| 20 | |
| 21 def main(argv): | |
| 22 # Run script from parent directory of chrome checkout, where emulator SDK is | |
| 23 # installed by install-emulator-deps.py | |
| 24 new_cwd = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', | |
|
frankf
2013/03/27 05:16:08
Declare this in constants.py relative to constants
navabi
2013/03/27 17:13:36
Done.
| |
| 25 '..', '..') | |
| 26 # The location of the SDK used to launch the emulator | |
| 27 emulator_sdk = os.path.join(new_cwd, 'android_tools', 'sdk') | |
| 28 os.environ['ANDROID_SDK_ROOT'] = emulator_sdk | |
| 29 | |
| 30 opt_parser = optparse.OptionParser(description='AVD script.') | |
| 31 opt_parser.add_option('-n', '--num', dest='emulator_count', | |
| 32 help='Number of emulators to launch.', | |
| 33 type='int', default='1') | |
| 34 opt_parser.add_option('--abi', default='arm', | |
| 35 help='Platform of emulators to launch.') | |
| 36 | |
| 37 options, _ = opt_parser.parse_args(argv[1:]) | |
| 38 if options.abi == 'arm': | |
| 39 options.abi = 'armeabi-v7a' | |
| 40 | |
| 41 logging.basicConfig(level=logging.INFO, | |
| 42 format='# %(asctime)-15s: %(message)s') | |
| 43 logging.root.setLevel(logging.INFO) | |
| 44 | |
| 45 emulator.LaunchEmulators(emulator_sdk, options.emulator_count, options.abi, | |
| 46 True) | |
| 47 | |
| 48 | |
| 49 if __name__ == '__main__': | |
| 50 sys.exit(main(sys.argv)) | |
| OLD | NEW |