Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: build/android/provision_devices.py

Issue 1571803002: [Android] Prepare build/android/ for catapult+devil. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@create-device-library-links
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/play_services/update.py ('k') | build/android/push_libraries.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Provisions Android devices with settings required for bots. 7 """Provisions Android devices with settings required for bots.
8 8
9 Usage: 9 Usage:
10 ./provision_devices.py [-d <device serial number>] 10 ./provision_devices.py [-d <device serial number>]
(...skipping 15 matching lines...) Expand all
26 from devil.android import device_blacklist 26 from devil.android import device_blacklist
27 from devil.android import device_errors 27 from devil.android import device_errors
28 from devil.android import device_temp_file 28 from devil.android import device_temp_file
29 from devil.android import device_utils 29 from devil.android import device_utils
30 from devil.android.sdk import keyevent 30 from devil.android.sdk import keyevent
31 from devil.android.sdk import version_codes 31 from devil.android.sdk import version_codes
32 from devil.utils import run_tests_helper 32 from devil.utils import run_tests_helper
33 from devil.utils import timeout_retry 33 from devil.utils import timeout_retry
34 from pylib import constants 34 from pylib import constants
35 from pylib import device_settings 35 from pylib import device_settings
36 from pylib.constants import host_paths
36 37
37 _SYSTEM_WEBVIEW_PATHS = ['/system/app/webview', '/system/app/WebViewGoogle'] 38 _SYSTEM_WEBVIEW_PATHS = ['/system/app/webview', '/system/app/WebViewGoogle']
38 _CHROME_PACKAGE_REGEX = re.compile('.*chrom.*') 39 _CHROME_PACKAGE_REGEX = re.compile('.*chrom.*')
39 _TOMBSTONE_REGEX = re.compile('tombstone.*') 40 _TOMBSTONE_REGEX = re.compile('tombstone.*')
40 41
41 42
42 class _DEFAULT_TIMEOUTS(object): 43 class _DEFAULT_TIMEOUTS(object):
43 # L can take a while to reboot after a wipe. 44 # L can take a while to reboot after a wipe.
44 LOLLIPOP = 600 45 LOLLIPOP = 600
45 PRE_LOLLIPOP = 180 46 PRE_LOLLIPOP = 180
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 device: The DeviceUtils instance for the device to which the adb_reboot 421 device: The DeviceUtils instance for the device to which the adb_reboot
421 binary should be pushed. 422 binary should be pushed.
422 target: The build target (example, Debug or Release) which helps in 423 target: The build target (example, Debug or Release) which helps in
423 locating the adb_reboot binary. 424 locating the adb_reboot binary.
424 """ 425 """
425 logging.info('Will push and launch adb_reboot on %s', str(device)) 426 logging.info('Will push and launch adb_reboot on %s', str(device))
426 # Kill if adb_reboot is already running. 427 # Kill if adb_reboot is already running.
427 device.KillAll('adb_reboot', blocking=True, timeout=2, quiet=True) 428 device.KillAll('adb_reboot', blocking=True, timeout=2, quiet=True)
428 # Push adb_reboot 429 # Push adb_reboot
429 logging.info(' Pushing adb_reboot ...') 430 logging.info(' Pushing adb_reboot ...')
430 adb_reboot = os.path.join(constants.DIR_SOURCE_ROOT, 431 adb_reboot = os.path.join(host_paths.DIR_SOURCE_ROOT,
431 'out/%s/adb_reboot' % target) 432 'out/%s/adb_reboot' % target)
432 device.PushChangedFiles([(adb_reboot, '/data/local/tmp/')]) 433 device.PushChangedFiles([(adb_reboot, '/data/local/tmp/')])
433 # Launch adb_reboot 434 # Launch adb_reboot
434 logging.info(' Launching adb_reboot ...') 435 logging.info(' Launching adb_reboot ...')
435 device.RunShellCommand( 436 device.RunShellCommand(
436 ['/data/local/tmp/adb_reboot'], 437 ['/data/local/tmp/adb_reboot'],
437 check_return=True) 438 check_return=True)
438 439
439 440
440 def _LaunchHostHeartbeat(): 441 def _LaunchHostHeartbeat():
441 # Kill if existing host_heartbeat 442 # Kill if existing host_heartbeat
442 KillHostHeartbeat() 443 KillHostHeartbeat()
443 # Launch a new host_heartbeat 444 # Launch a new host_heartbeat
444 logging.info('Spawning host heartbeat...') 445 logging.info('Spawning host heartbeat...')
445 subprocess.Popen([os.path.join(constants.DIR_SOURCE_ROOT, 446 subprocess.Popen([os.path.join(host_paths.DIR_SOURCE_ROOT,
446 'build/android/host_heartbeat.py')]) 447 'build/android/host_heartbeat.py')])
447 448
448 def KillHostHeartbeat(): 449 def KillHostHeartbeat():
449 ps = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE) 450 ps = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
450 stdout, _ = ps.communicate() 451 stdout, _ = ps.communicate()
451 matches = re.findall('\\n.*host_heartbeat.*', stdout) 452 matches = re.findall('\\n.*host_heartbeat.*', stdout)
452 for match in matches: 453 for match in matches:
453 logging.info('An instance of host heart beart running... will kill') 454 logging.info('An instance of host heart beart running... will kill')
454 pid = re.findall(r'(\S+)', match)[1] 455 pid = re.findall(r'(\S+)', match)[1]
455 subprocess.call(['kill', str(pid)]) 456 subprocess.call(['kill', str(pid)])
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 519
519 run_tests_helper.SetLogLevel(args.verbose) 520 run_tests_helper.SetLogLevel(args.verbose)
520 521
521 devil_chromium.Initialize() 522 devil_chromium.Initialize()
522 523
523 return ProvisionDevices(args) 524 return ProvisionDevices(args)
524 525
525 526
526 if __name__ == '__main__': 527 if __name__ == '__main__':
527 sys.exit(main()) 528 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/play_services/update.py ('k') | build/android/push_libraries.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698