diff options
author | sivachandra@chromium.org <sivachandra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-06 00:25:19 +0000 |
---|---|---|
committer | sivachandra@chromium.org <sivachandra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-06 00:25:19 +0000 |
commit | c89aae03153ccacfdc0dca433a76ce2e639bc16a (patch) | |
tree | 05ac76b8b6450993376bf839f7265e0b3a7f1448 /build | |
parent | 46ba0652e6a3f07a7ff88671060ce1dff79befff (diff) | |
download | chromium_src-c89aae03153ccacfdc0dca433a76ce2e639bc16a.zip chromium_src-c89aae03153ccacfdc0dca433a76ce2e639bc16a.tar.gz chromium_src-c89aae03153ccacfdc0dca433a76ce2e639bc16a.tar.bz2 |
Add provision_devices step to all Android testers.
This CL adds --auto-reconnect as an option to the
provisioning script. This option is not being used.
BUG=164180
Review URL: https://chromiumcodereview.appspot.com/13649010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192668 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rwxr-xr-x | build/android/buildbot/bb_device_steps.py | 7 | ||||
-rwxr-xr-x | build/android/provision_devices.py | 66 |
2 files changed, 36 insertions, 37 deletions
diff --git a/build/android/buildbot/bb_device_steps.py b/build/android/buildbot/bb_device_steps.py index a0d0d19..04d49c2 100755 --- a/build/android/buildbot/bb_device_steps.py +++ b/build/android/buildbot/bb_device_steps.py @@ -272,10 +272,9 @@ def MainTestWrapper(options): RunCmd(['build/android/device_status_check.py']) # Provision devices - if options.auto_reconnect: - buildbot_report.PrintNamedStep('provision_devices') - target = options.factory_properties.get('target', 'Debug') - RunCmd(['build/android/provision_devices.py', '-t', target]) + buildbot_report.PrintNamedStep('provision_devices') + target = options.factory_properties.get('target', 'Debug') + RunCmd(['build/android/provision_devices.py', '-t', target]) if options.install: test_obj = INSTRUMENTATION_TESTS[options.install] diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py index 6ca53b1..6646556 100755 --- a/build/android/provision_devices.py +++ b/build/android/provision_devices.py @@ -21,30 +21,6 @@ from pylib import android_commands from pylib import constants -def PushAndLaunchAdbReboot(device, target): - """Pushes and launches the adb_reboot binary on the device. - - Arguments: - device: The serial number of the device to which the - adb_reboot binary should be pushed. - target: The build target (example, Debug or Release) which helps in - locating the adb_reboot binary. - """ - print 'Will push and launch adb_reboot on %s' % device - android_cmd = android_commands.AndroidCommands(device) - # Kill if adb_reboot is already running. - android_cmd.KillAllBlocking('adb_reboot', 2) - # Push adb_reboot - print ' Pushing adb_reboot ...' - adb_reboot = os.path.join(constants.CHROME_DIR, - 'out/%s/adb_reboot' % target) - android_cmd.PushIfNeeded(adb_reboot, '/data/local/') - # Launch adb_reboot - print ' Launching adb_reboot ...' - p = subprocess.Popen(['adb', '-s', device, 'shell'], stdin=subprocess.PIPE) - p.communicate('/data/local/adb_reboot; exit\n') - - def LaunchHostHeartbeat(): ps = subprocess.Popen(['ps', 'aux'], stdout = subprocess.PIPE) stdout, _ = ps.communicate() @@ -54,11 +30,37 @@ def LaunchHostHeartbeat(): pid = re.findall('(\d+)', match)[1] subprocess.call(['kill', str(pid)]) # Launch a new host_heartbeat - print 'Spawing host heartbeat...' + print 'Spawning host heartbeat...' subprocess.Popen([os.path.join(constants.CHROME_DIR, 'build/android/host_heartbeat.py')]) +def PushAndLaunchAdbReboot(devices, target): + """Pushes and launches the adb_reboot binary on the device. + + Arguments: + devices: The list of serial numbers of the device to which the + adb_reboot binary should be pushed. + target : The build target (example, Debug or Release) which helps in + locating the adb_reboot binary. + """ + for device in devices: + print 'Will push and launch adb_reboot on %s' % device + android_cmd = android_commands.AndroidCommands(device) + # Kill if adb_reboot is already running. + android_cmd.KillAllBlocking('adb_reboot', 2) + # Push adb_reboot + print ' Pushing adb_reboot ...' + adb_reboot = os.path.join(constants.CHROME_DIR, + 'out/%s/adb_reboot' % target) + android_cmd.PushIfNeeded(adb_reboot, '/data/local/') + # Launch adb_reboot + print ' Launching adb_reboot ...' + p = subprocess.Popen(['adb', '-s', device, 'shell'], stdin=subprocess.PIPE) + p.communicate('/data/local/adb_reboot; exit\n') + LaunchHostHeartbeat() + + def ProvisionDevices(options): if options.device is not None: devices = [options.device] @@ -67,26 +69,24 @@ def ProvisionDevices(options): for device in devices: android_cmd = android_commands.AndroidCommands(device) android_cmd.RunShellCommand('su -c date -u %f' % time.time()) - PushAndLaunchAdbReboot(device, options.target) - LaunchHostHeartbeat() + if options.auto_reconnect: + PushAndLaunchAdbReboot(devices, options.target) def main(argv): parser = optparse.OptionParser() parser.add_option('-d', '--device', help='The serial number of the device to be provisioned') - parser.add_option('-t', '--target', - help='Path to the adb_reboot binary') + parser.add_option('-t', '--target', default='Debug', help='The build target') + parser.add_option( + '-r', '--auto-reconnect', action='store_true', + help='Push binary which will reboot the device on adb disconnections.') options, args = parser.parse_args(argv[1:]) if args: print >> sys.stderr, 'Unused args %s' % args return 1 - if not options.target: - print >> sys.stderr, 'Build target not specified' - return 1 - ProvisionDevices(options) |