OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Launches Android Virtual Devices with a set configuration for testing Chrome. | 6 """Launches Android Virtual Devices with a set configuration for testing Chrome. |
7 | 7 |
8 The script will launch a specified number of Android Virtual Devices (AVD's). | 8 The script will launch a specified number of Android Virtual Devices (AVD's). |
9 """ | 9 """ |
10 | 10 |
11 | 11 |
12 import install_emulator_deps | 12 import install_emulator_deps |
13 import logging | 13 import logging |
14 import optparse | 14 import optparse |
15 import os | 15 import os |
16 import subprocess | |
17 import sys | 16 import sys |
18 | 17 |
19 from pylib import constants | 18 from pylib import constants |
20 from pylib.utils import emulator | 19 from pylib.utils import emulator |
21 | 20 |
22 | 21 |
23 def main(argv): | 22 def main(argv): |
24 # ANDROID_SDK_ROOT needs to be set to the location of the SDK used to launch | 23 # ANDROID_SDK_ROOT needs to be set to the location of the SDK used to launch |
25 # the emulator to find the system images upon launch. | 24 # the emulator to find the system images upon launch. |
26 emulator_sdk = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk') | 25 emulator_sdk = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk') |
(...skipping 11 matching lines...) Expand all Loading... |
38 | 37 |
39 options, _ = opt_parser.parse_args(argv[1:]) | 38 options, _ = opt_parser.parse_args(argv[1:]) |
40 | 39 |
41 logging.basicConfig(level=logging.INFO, | 40 logging.basicConfig(level=logging.INFO, |
42 format='# %(asctime)-15s: %(message)s') | 41 format='# %(asctime)-15s: %(message)s') |
43 logging.root.setLevel(logging.INFO) | 42 logging.root.setLevel(logging.INFO) |
44 | 43 |
45 # Check if KVM is enabled for x86 AVD's and check for x86 system images. | 44 # Check if KVM is enabled for x86 AVD's and check for x86 system images. |
46 # TODO(andrewhayden) Since we can fix all of these with install_emulator_deps | 45 # TODO(andrewhayden) Since we can fix all of these with install_emulator_deps |
47 # why don't we just run it? | 46 # why don't we just run it? |
48 if options.abi =='x86': | 47 if options.abi == 'x86': |
49 if not install_emulator_deps.CheckKVM(): | 48 if not install_emulator_deps.CheckKVM(): |
50 logging.critical('ERROR: KVM must be enabled in BIOS, and installed. ' | 49 logging.critical('ERROR: KVM must be enabled in BIOS, and installed. ' |
51 'Enable KVM in BIOS and run install_emulator_deps.py') | 50 'Enable KVM in BIOS and run install_emulator_deps.py') |
52 return 1 | 51 return 1 |
53 elif not install_emulator_deps.CheckX86Image(options.api_level): | 52 elif not install_emulator_deps.CheckX86Image(options.api_level): |
54 logging.critical('ERROR: System image for x86 AVD not installed. Run ' | 53 logging.critical('ERROR: System image for x86 AVD not installed. Run ' |
55 'install_emulator_deps.py') | 54 'install_emulator_deps.py') |
56 return 1 | 55 return 1 |
57 | 56 |
58 if not install_emulator_deps.CheckSDK(): | 57 if not install_emulator_deps.CheckSDK(): |
59 logging.critical('ERROR: Emulator SDK not installed. Run ' | 58 logging.critical('ERROR: Emulator SDK not installed. Run ' |
60 'install_emulator_deps.py.') | 59 'install_emulator_deps.py.') |
61 return 1 | 60 return 1 |
62 | 61 |
63 if not install_emulator_deps.CheckSDKPlatform(options.api_level): | 62 if not install_emulator_deps.CheckSDKPlatform(options.api_level): |
64 logging.critical('ERROR: Emulator SDK missing required target for API %d. ' | 63 logging.critical('ERROR: Emulator SDK missing required target for API %d. ' |
65 'Run install_emulator_deps.py.') | 64 'Run install_emulator_deps.py.') |
66 return 1 | 65 return 1 |
67 | 66 |
68 emulator.LaunchEmulators(options.emulator_count, options.abi, | 67 emulator.LaunchEmulators(options.emulator_count, options.abi, |
69 options.api_level, True) | 68 options.api_level, True) |
70 | 69 |
71 | 70 |
72 if __name__ == '__main__': | 71 if __name__ == '__main__': |
73 sys.exit(main(sys.argv)) | 72 sys.exit(main(sys.argv)) |
OLD | NEW |