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

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

Issue 15979032: Android: renames pylib.constants.CHROME_DIR to DIR_SOURCE_ROOT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
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 13 matching lines...) Expand all
24 def LaunchHostHeartbeat(): 24 def LaunchHostHeartbeat():
25 ps = subprocess.Popen(['ps', 'aux'], stdout = subprocess.PIPE) 25 ps = subprocess.Popen(['ps', 'aux'], stdout = subprocess.PIPE)
26 stdout, _ = ps.communicate() 26 stdout, _ = ps.communicate()
27 matches = re.findall('\\n.*host_heartbeat.*', stdout) 27 matches = re.findall('\\n.*host_heartbeat.*', stdout)
28 for match in matches: 28 for match in matches:
29 print 'An instance of host heart beart already running... will kill' 29 print 'An instance of host heart beart already running... will kill'
30 pid = re.findall('(\d+)', match)[1] 30 pid = re.findall('(\d+)', match)[1]
31 subprocess.call(['kill', str(pid)]) 31 subprocess.call(['kill', str(pid)])
32 # Launch a new host_heartbeat 32 # Launch a new host_heartbeat
33 print 'Spawning host heartbeat...' 33 print 'Spawning host heartbeat...'
34 subprocess.Popen([os.path.join(constants.CHROME_DIR, 34 subprocess.Popen([os.path.join(constants.DIR_SOURCE_ROOT,
35 'build/android/host_heartbeat.py')]) 35 'build/android/host_heartbeat.py')])
36 36
37 37
38 def PushAndLaunchAdbReboot(devices, target): 38 def PushAndLaunchAdbReboot(devices, target):
39 """Pushes and launches the adb_reboot binary on the device. 39 """Pushes and launches the adb_reboot binary on the device.
40 40
41 Arguments: 41 Arguments:
42 devices: The list of serial numbers of the device to which the 42 devices: The list of serial numbers of the device to which the
43 adb_reboot binary should be pushed. 43 adb_reboot binary should be pushed.
44 target : The build target (example, Debug or Release) which helps in 44 target : The build target (example, Debug or Release) which helps in
45 locating the adb_reboot binary. 45 locating the adb_reboot binary.
46 """ 46 """
47 for device in devices: 47 for device in devices:
48 print 'Will push and launch adb_reboot on %s' % device 48 print 'Will push and launch adb_reboot on %s' % device
49 android_cmd = android_commands.AndroidCommands(device) 49 android_cmd = android_commands.AndroidCommands(device)
50 # Kill if adb_reboot is already running. 50 # Kill if adb_reboot is already running.
51 android_cmd.KillAllBlocking('adb_reboot', 2) 51 android_cmd.KillAllBlocking('adb_reboot', 2)
52 # Push adb_reboot 52 # Push adb_reboot
53 print ' Pushing adb_reboot ...' 53 print ' Pushing adb_reboot ...'
54 adb_reboot = os.path.join(constants.CHROME_DIR, 54 adb_reboot = os.path.join(constants.DIR_SOURCE_ROOT,
55 'out/%s/adb_reboot' % target) 55 'out/%s/adb_reboot' % target)
56 android_cmd.PushIfNeeded(adb_reboot, '/data/local/') 56 android_cmd.PushIfNeeded(adb_reboot, '/data/local/')
57 # Launch adb_reboot 57 # Launch adb_reboot
58 print ' Launching adb_reboot ...' 58 print ' Launching adb_reboot ...'
59 p = subprocess.Popen(['adb', '-s', device, 'shell'], stdin=subprocess.PIPE) 59 p = subprocess.Popen(['adb', '-s', device, 'shell'], stdin=subprocess.PIPE)
60 p.communicate('/data/local/adb_reboot; exit\n') 60 p.communicate('/data/local/adb_reboot; exit\n')
61 LaunchHostHeartbeat() 61 LaunchHostHeartbeat()
62 62
63 63
64 def ProvisionDevices(options): 64 def ProvisionDevices(options):
(...skipping 20 matching lines...) Expand all
85 85
86 if args: 86 if args:
87 print >> sys.stderr, 'Unused args %s' % args 87 print >> sys.stderr, 'Unused args %s' % args
88 return 1 88 return 1
89 89
90 ProvisionDevices(options) 90 ProvisionDevices(options)
91 91
92 92
93 if __name__ == '__main__': 93 if __name__ == '__main__':
94 sys.exit(main(sys.argv)) 94 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698