示例#1
0
def ProvisionDevices(options):
    bb_annotations.PrintNamedStep('provision_devices')

    if not bb_utils.TESTING:
        # Restart adb to work around bugs, sleep to wait for usb discovery.
        device_utils.RestartServer()
        RunCmd(['sleep', '1'])
    provision_cmd = [
        'build/android/provision_devices.py', '-t', options.target,
        '--blacklist-file', 'out/bad_devices.json'
    ]
    if options.auto_reconnect:
        provision_cmd.append('--auto-reconnect')
    if options.skip_wipe:
        provision_cmd.append('--skip-wipe')
    if options.disable_location:
        provision_cmd.append('--disable-location')
    RunCmd(provision_cmd, halt_on_failure=True)
示例#2
0
def CleanupLeftoverProcesses(devices):
    """Clean up the test environment, restarting fresh adb and HTTP daemons.

  Args:
    devices: The devices to clean.
  """
    _KillWebServers()
    device_utils.RestartServer()

    def cleanup_device(d):
        d.RestartAdbd()
        try:
            d.EnableRoot()
        except device_errors.CommandFailedError:
            logging.exception('Failed to enable root')
        d.WaitUntilFullyBooted()

    device_utils.DeviceUtils.parallel(devices).pMap(cleanup_device)