예제 #1
0
def canTelnet(device):
    """ Checks if we can establish a Telnet session (via devicemanager)

    Sets global `dm`
    Returns False on failure, True on Success
    """
    global dm
    curRetry = 0
    sleepDuration = 0
    while curRetry < MAX_RETRIES:
        try:
            dm = connect(device, sleepDuration)
        except:
            curRetry += 1
            if curRetry == MAX_RETRIES:
                setFlag(
                    errorFile,
                    "Automation Error: Unable to connect to device after %s attempts"
                    % MAX_RETRIES)
                return False
            else:
                log.info("INFO: Unable to connect to device after %s try" %
                         curRetry)
                sleepDuration = 90
        else:
            break  # We're done here
    return True
예제 #2
0
def main(device):
    dm = connect(device)

    if not isVersionCorrect(dm=dm):
        return doUpdate(dm)
    else:
        # The SUT Agent was already up-to-date
        return RETCODE_SUCCESS
예제 #3
0
def main(device):
    dm = connect(device)

    if not isVersionCorrect(dm=dm):
        return doUpdate(dm)
    else:
        # The SUT Agent was already up-to-date
        return RETCODE_SUCCESS
예제 #4
0
def canTelnet(device):
    """ Checks if we can establish a Telnet session (via devicemanager)

    Sets global `dm`
    Returns False on failure, True on Success
    """
    global dm
    curRetry = 0
    sleepDuration = 0
    while curRetry < MAX_RETRIES:
        try:
            dm = connect(device, sleepDuration)
        except:
            curRetry += 1
            if curRetry == MAX_RETRIES:
                setFlag(errorFile, "Automation Error: Unable to connect to device after %s attempts" % MAX_RETRIES)
                return False
            else:
                log.info("INFO: Unable to connect to device after %s try" %
                         curRetry)
                sleepDuration = 90
        else:
            break  # We're done here
    return True
예제 #5
0
    dm._runCmds([{'cmd': 'push /mnt/sdcard/%s %s' % (apkfilename, str(
        len(data))), 'data': data}])
    dm.debug = 5
    dm._runCmds([{'cmd': 'updt com.mozilla.SUTAgentAndroid /mnt/sdcard/%s' %
                apkfilename}])
    # XXX devicemanager.py might need to close the sockets so we won't need
    # these 2 steps
    if dm._sock:
        dm._sock.close()
    dm._sock = None
    dm = None
    ver = None
    tries = 0
    while tries < 5:
        try:
            dm = connect(device_name, sleep=90)
            break
        except:
            tries += 1
            log.warning("Automation Error: updateSUT.py: We have tried to connect %s time(s) after trying to update." % tries)

    try:
        ver = version(dm)
    except Exception, e:
        log.error("Automation Error: updateSUT.py: We should have been able to get the version")
        log.error("Automation Error: updateSUT.py: %s" % e)
        return RETCODE_REVERIFY_FAILED

    dm.debug = _oldDebug  # Restore it

    if ver is None:
예제 #6
0
    }])
    dm.debug = 5
    dm._runCmds([{
        'cmd':
        'updt com.mozilla.SUTAgentAndroid /mnt/sdcard/%s' % apkfilename
    }])
    # XXX devicemanager.py might need to close the sockets so we won't need these 2 steps
    if dm._sock:
        dm._sock.close()
    dm._sock = None
    dm = None
    ver = None
    tries = 0
    while tries < 5:
        try:
            dm = connect(device_name, sleep=90)
            break
        except:
            tries += 1
            log.warning(
                "Automation Error: updateSUT.py: We have tried to connect %s time(s) after trying to update."
                % tries)

    try:
        ver = version(dm)
    except Exception, e:
        log.error(
            "Automation Error: updateSUT.py: We should have been able to get the version"
        )
        log.error("Automation Error: updateSUT.py: %s" % e)
        return RETCODE_REVERIFY_FAILED