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

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

Issue 179333002: Update android device provisioning script to set some reliability settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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>]
11 """ 11 """
12 12
13 import optparse 13 import optparse
14 import os 14 import os
15 import re 15 import re
16 import subprocess 16 import subprocess
17 import sys 17 import sys
18 import time 18 import time
19 19
20 from pylib import android_commands 20 from pylib import android_commands
21 from pylib import bot_device_settings
21 from pylib import constants 22 from pylib import constants
22 23
24
23 def KillHostHeartbeat(): 25 def KillHostHeartbeat():
24 ps = subprocess.Popen(['ps', 'aux'], stdout = subprocess.PIPE) 26 ps = subprocess.Popen(['ps', 'aux'], stdout = subprocess.PIPE)
25 stdout, _ = ps.communicate() 27 stdout, _ = ps.communicate()
26 matches = re.findall('\\n.*host_heartbeat.*', stdout) 28 matches = re.findall('\\n.*host_heartbeat.*', stdout)
27 for match in matches: 29 for match in matches:
28 print 'An instance of host heart beart running... will kill' 30 print 'An instance of host heart beart running... will kill'
29 pid = re.findall('(\d+)', match)[1] 31 pid = re.findall('(\d+)', match)[1]
30 subprocess.call(['kill', str(pid)]) 32 subprocess.call(['kill', str(pid)])
31 33
32 34
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 68
67 69
68 def ProvisionDevices(options): 70 def ProvisionDevices(options):
69 if options.device is not None: 71 if options.device is not None:
70 devices = [options.device] 72 devices = [options.device]
71 else: 73 else:
72 devices = android_commands.GetAttachedDevices() 74 devices = android_commands.GetAttachedDevices()
73 for device in devices: 75 for device in devices:
74 android_cmd = android_commands.AndroidCommands(device) 76 android_cmd = android_commands.AndroidCommands(device)
75 android_cmd.RunShellCommandWithSU('date -u %f' % time.time()) 77 android_cmd.RunShellCommandWithSU('date -u %f' % time.time())
78 bot_device_settings.ConfigureDevice(android_cmd)
76 if options.auto_reconnect: 79 if options.auto_reconnect:
77 PushAndLaunchAdbReboot(devices, options.target) 80 PushAndLaunchAdbReboot(devices, options.target)
78 81
79 82
80 def main(argv): 83 def main(argv):
81 parser = optparse.OptionParser() 84 parser = optparse.OptionParser()
82 parser.add_option('-d', '--device', 85 parser.add_option('-d', '--device',
83 help='The serial number of the device to be provisioned') 86 help='The serial number of the device to be provisioned')
84 parser.add_option('-t', '--target', default='Debug', help='The build target') 87 parser.add_option('-t', '--target', default='Debug', help='The build target')
85 parser.add_option( 88 parser.add_option(
86 '-r', '--auto-reconnect', action='store_true', 89 '-r', '--auto-reconnect', action='store_true',
87 help='Push binary which will reboot the device on adb disconnections.') 90 help='Push binary which will reboot the device on adb disconnections.')
88 options, args = parser.parse_args(argv[1:]) 91 options, args = parser.parse_args(argv[1:])
89 constants.SetBuildType(options.target) 92 constants.SetBuildType(options.target)
90 93
91 if args: 94 if args:
92 print >> sys.stderr, 'Unused args %s' % args 95 print >> sys.stderr, 'Unused args %s' % args
93 return 1 96 return 1
94 97
95 ProvisionDevices(options) 98 ProvisionDevices(options)
96 99
97 100
98 if __name__ == '__main__': 101 if __name__ == '__main__':
99 sys.exit(main(sys.argv)) 102 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/bot_device_settings.py » ('j') | build/android/pylib/bot_device_settings.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698