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

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

Issue 290573004: [Android] Support generic parallel execution across devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix the parallelizer tests Created 6 years, 7 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/adb_install_apk.py ('k') | build/android/pylib/device/device_utils.py » ('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>]
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 subprocess 17 import subprocess
18 import sys 18 import sys
19 import time 19 import time
20 20
21 from pylib import android_commands 21 from pylib import android_commands
22 from pylib import constants 22 from pylib import constants
23 from pylib import device_settings 23 from pylib import device_settings
24 from pylib.cmd_helper import GetCmdOutput 24 from pylib.cmd_helper import GetCmdOutput
25 from pylib.device import device_utils 25 from pylib.device import device_utils
26 26
27 sys.path.append(os.path.join(constants.DIR_SOURCE_ROOT,
28 'third_party', 'android_testrunner'))
29 import errors
30
27 def KillHostHeartbeat(): 31 def KillHostHeartbeat():
28 ps = subprocess.Popen(['ps', 'aux'], stdout = subprocess.PIPE) 32 ps = subprocess.Popen(['ps', 'aux'], stdout = subprocess.PIPE)
29 stdout, _ = ps.communicate() 33 stdout, _ = ps.communicate()
30 matches = re.findall('\\n.*host_heartbeat.*', stdout) 34 matches = re.findall('\\n.*host_heartbeat.*', stdout)
31 for match in matches: 35 for match in matches:
32 print 'An instance of host heart beart running... will kill' 36 print 'An instance of host heart beart running... will kill'
33 pid = re.findall('(\d+)', match)[1] 37 pid = re.findall('(\d+)', match)[1]
34 subprocess.call(['kill', str(pid)]) 38 subprocess.call(['kill', str(pid)])
35 39
36 40
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 169
166 if args: 170 if args:
167 print >> sys.stderr, 'Unused args %s' % args 171 print >> sys.stderr, 'Unused args %s' % args
168 return 1 172 return 1
169 173
170 if options.wipe: 174 if options.wipe:
171 devices = android_commands.GetAttachedDevices() 175 devices = android_commands.GetAttachedDevices()
172 for device_serial in devices: 176 for device_serial in devices:
173 device = device_utils.DeviceUtils(device_serial) 177 device = device_utils.DeviceUtils(device_serial)
174 WipeDeviceData(device) 178 WipeDeviceData(device)
175 device_utils.RebootDevices() 179 try:
180 (device_utils.DeviceUtils.parallel(devices)
181 .old_interface.Reboot(True).pFinish(None))
182 except errors.DeviceUnresponsiveError:
183 pass
176 else: 184 else:
177 ProvisionDevices(options) 185 ProvisionDevices(options)
178 186
179 187
180 if __name__ == '__main__': 188 if __name__ == '__main__':
181 sys.exit(main(sys.argv)) 189 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/adb_install_apk.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698