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 """Installs deps for using SDK emulator for testing. | 6 """Installs deps for using SDK emulator for testing. |
7 | 7 |
8 The script will download the SDK and system images, if they are not present, and | 8 The script will download the SDK and system images, if they are not present, and |
9 install and enable KVM, if virtualization has been enabled in the BIOS. | 9 install and enable KVM, if virtualization has been enabled in the BIOS. |
10 """ | 10 """ |
11 | 11 |
12 | 12 |
13 import logging | 13 import logging |
14 import optparse | 14 import optparse |
15 import os | 15 import os |
16 import re | 16 import re |
17 import sys | 17 import sys |
18 | 18 |
| 19 import devil_chromium |
19 from devil.utils import cmd_helper | 20 from devil.utils import cmd_helper |
20 from devil.utils import run_tests_helper | 21 from devil.utils import run_tests_helper |
21 from pylib import constants | 22 from pylib import constants |
22 from pylib import pexpect | 23 from pylib import pexpect |
23 | 24 |
24 # Android API level | 25 # Android API level |
25 DEFAULT_ANDROID_API_LEVEL = constants.ANDROID_SDK_VERSION | 26 DEFAULT_ANDROID_API_LEVEL = constants.ANDROID_SDK_VERSION |
26 | 27 |
27 # Default Time out for downloading SDK component | 28 # Default Time out for downloading SDK component |
28 DOWNLOAD_SYSTEM_IMAGE_TIMEOUT = 30 | 29 DOWNLOAD_SYSTEM_IMAGE_TIMEOUT = 30 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 default=DEFAULT_ANDROID_API_LEVEL) | 207 default=DEFAULT_ANDROID_API_LEVEL) |
207 opt_parser.add_option('-v', | 208 opt_parser.add_option('-v', |
208 dest='verbosity', | 209 dest='verbosity', |
209 default=1, | 210 default=1, |
210 action='count', | 211 action='count', |
211 help='Verbose level (multiple times for more)') | 212 help='Verbose level (multiple times for more)') |
212 options, _ = opt_parser.parse_args(argv[1:]) | 213 options, _ = opt_parser.parse_args(argv[1:]) |
213 | 214 |
214 run_tests_helper.SetLogLevel(verbose_count=options.verbosity) | 215 run_tests_helper.SetLogLevel(verbose_count=options.verbosity) |
215 | 216 |
| 217 devil_chromium.Initialize() |
| 218 |
216 # Calls below will download emulator SDK and/or system images only if needed. | 219 # Calls below will download emulator SDK and/or system images only if needed. |
217 if CheckSDK(): | 220 if CheckSDK(): |
218 logging.info('android_emulator_sdk/ exists') | 221 logging.info('android_emulator_sdk/ exists') |
219 else: | 222 else: |
220 logging.critical('ERROR: Emulator SDK not installed in %s' | 223 logging.critical('ERROR: Emulator SDK not installed in %s' |
221 , constants.ANDROID_SDK_ROOT) | 224 , constants.ANDROID_SDK_ROOT) |
222 return 1 | 225 return 1 |
223 | 226 |
224 # Check target. The target has to be installed in order to run the emulator. | 227 # Check target. The target has to be installed in order to run the emulator. |
225 if CheckSDKPlatform(options.api_level): | 228 if CheckSDKPlatform(options.api_level): |
(...skipping 13 matching lines...) Expand all Loading... |
239 | 242 |
240 # Make sure KVM packages are installed and enabled. | 243 # Make sure KVM packages are installed and enabled. |
241 if CheckKVM(): | 244 if CheckKVM(): |
242 logging.info('KVM already installed and enabled.') | 245 logging.info('KVM already installed and enabled.') |
243 else: | 246 else: |
244 logging.warning('KVM is not installed or enabled.') | 247 logging.warning('KVM is not installed or enabled.') |
245 | 248 |
246 | 249 |
247 if __name__ == '__main__': | 250 if __name__ == '__main__': |
248 sys.exit(main(sys.argv)) | 251 sys.exit(main(sys.argv)) |
OLD | NEW |