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 |
16 import sys | 17 import sys |
17 | 18 |
18 from pylib import constants | 19 from pylib import constants |
19 from pylib.utils import emulator | 20 from pylib.utils import emulator |
20 | 21 |
21 | 22 |
22 def main(argv): | 23 def main(argv): |
23 # ANDROID_SDK_ROOT needs to be set to the location of the SDK used to launch | 24 # ANDROID_SDK_ROOT needs to be set to the location of the SDK used to launch |
24 # the emulator to find the system images upon launch. | 25 # the emulator to find the system images upon launch. |
25 emulator_sdk = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk') | 26 emulator_sdk = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk') |
(...skipping 11 matching lines...) Expand all Loading... |
37 | 38 |
38 options, _ = opt_parser.parse_args(argv[1:]) | 39 options, _ = opt_parser.parse_args(argv[1:]) |
39 | 40 |
40 logging.basicConfig(level=logging.INFO, | 41 logging.basicConfig(level=logging.INFO, |
41 format='# %(asctime)-15s: %(message)s') | 42 format='# %(asctime)-15s: %(message)s') |
42 logging.root.setLevel(logging.INFO) | 43 logging.root.setLevel(logging.INFO) |
43 | 44 |
44 # Check if KVM is enabled for x86 AVD's and check for x86 system images. | 45 # Check if KVM is enabled for x86 AVD's and check for x86 system images. |
45 # TODO(andrewhayden) Since we can fix all of these with install_emulator_deps | 46 # TODO(andrewhayden) Since we can fix all of these with install_emulator_deps |
46 # why don't we just run it? | 47 # why don't we just run it? |
47 if options.abi == 'x86': | 48 if options.abi =='x86': |
48 if not install_emulator_deps.CheckKVM(): | 49 if not install_emulator_deps.CheckKVM(): |
49 logging.critical('ERROR: KVM must be enabled in BIOS, and installed. ' | 50 logging.critical('ERROR: KVM must be enabled in BIOS, and installed. ' |
50 'Enable KVM in BIOS and run install_emulator_deps.py') | 51 'Enable KVM in BIOS and run install_emulator_deps.py') |
51 return 1 | 52 return 1 |
52 elif not install_emulator_deps.CheckX86Image(options.api_level): | 53 elif not install_emulator_deps.CheckX86Image(options.api_level): |
53 logging.critical('ERROR: System image for x86 AVD not installed. Run ' | 54 logging.critical('ERROR: System image for x86 AVD not installed. Run ' |
54 'install_emulator_deps.py') | 55 'install_emulator_deps.py') |
55 return 1 | 56 return 1 |
56 | 57 |
57 if not install_emulator_deps.CheckSDK(): | 58 if not install_emulator_deps.CheckSDK(): |
58 logging.critical('ERROR: Emulator SDK not installed. Run ' | 59 logging.critical('ERROR: Emulator SDK not installed. Run ' |
59 'install_emulator_deps.py.') | 60 'install_emulator_deps.py.') |
60 return 1 | 61 return 1 |
61 | 62 |
62 if not install_emulator_deps.CheckSDKPlatform(options.api_level): | 63 if not install_emulator_deps.CheckSDKPlatform(options.api_level): |
63 logging.critical('ERROR: Emulator SDK missing required target for API %d. ' | 64 logging.critical('ERROR: Emulator SDK missing required target for API %d. ' |
64 'Run install_emulator_deps.py.') | 65 'Run install_emulator_deps.py.') |
65 return 1 | 66 return 1 |
66 | 67 |
67 emulator.LaunchEmulators(options.emulator_count, options.abi, | 68 emulator.LaunchEmulators(options.emulator_count, options.abi, |
68 options.api_level, True) | 69 options.api_level, True) |
69 | 70 |
70 | 71 |
71 if __name__ == '__main__': | 72 if __name__ == '__main__': |
72 sys.exit(main(sys.argv)) | 73 sys.exit(main(sys.argv)) |
OLD | NEW |