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 # Android ABI/Arch | 27 # Android ABI/Arch |
27 DEFAULT_ABI = 'x86' | 28 DEFAULT_ABI = 'x86' |
28 | 29 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 opt_parser.add_option('--google', | 270 opt_parser.add_option('--google', |
270 dest='google', | 271 dest='google', |
271 action='store_true', | 272 action='store_true', |
272 default=False, | 273 default=False, |
273 help='Install Google System Image instead of AOSP') | 274 help='Install Google System Image instead of AOSP') |
274 | 275 |
275 options, _ = opt_parser.parse_args(argv[1:]) | 276 options, _ = opt_parser.parse_args(argv[1:]) |
276 | 277 |
277 run_tests_helper.SetLogLevel(verbose_count=options.verbosity) | 278 run_tests_helper.SetLogLevel(verbose_count=options.verbosity) |
278 | 279 |
| 280 devil_chromium.Initialize() |
| 281 |
279 # Calls below will download emulator SDK and/or system images only if needed. | 282 # Calls below will download emulator SDK and/or system images only if needed. |
280 if CheckSDK(): | 283 if CheckSDK(): |
281 logging.info('android_emulator_sdk/ exists') | 284 logging.info('android_emulator_sdk/ exists') |
282 else: | 285 else: |
283 logging.critical('ERROR: Emulator SDK not installed in %s' | 286 logging.critical('ERROR: Emulator SDK not installed in %s' |
284 , constants.ANDROID_SDK_ROOT) | 287 , constants.ANDROID_SDK_ROOT) |
285 return 1 | 288 return 1 |
286 | 289 |
287 # Check target. The target has to be installed in order to run the emulator. | 290 # Check target. The target has to be installed in order to run the emulator. |
288 if CheckSDKPlatform(options.api_level, options.google): | 291 if CheckSDKPlatform(options.api_level, options.google): |
(...skipping 17 matching lines...) Expand all Loading... |
306 # Make sure KVM packages are installed and enabled. | 309 # Make sure KVM packages are installed and enabled. |
307 if options.abi == 'x86': | 310 if options.abi == 'x86': |
308 if CheckKVM(): | 311 if CheckKVM(): |
309 logging.info('KVM already installed and enabled.') | 312 logging.info('KVM already installed and enabled.') |
310 else: | 313 else: |
311 logging.warning('KVM is not installed or enabled.') | 314 logging.warning('KVM is not installed or enabled.') |
312 | 315 |
313 | 316 |
314 if __name__ == '__main__': | 317 if __name__ == '__main__': |
315 sys.exit(main(sys.argv)) | 318 sys.exit(main(sys.argv)) |
OLD | NEW |