Пример #1
0
def find_robocop():
    # we hardcode the relative path to robocop.apk for bug 715215
    # but it may not be unpacked at the time this runs, so be prepared
    # to extract if needed (but use the extracted one if there)
    extracted_location = 'build/tests/bin/robocop.apk'
    self_extracted_location = 'build/robocop.apk'
    actual_location = None

    # for better error reporting
    global errorFile

    if os.path.exists(extracted_location):
        actual_location = extracted_location
    elif os.path.exists(self_extracted_location):
        # already grabbed it in prior step
        actual_location = self_extracted_location
    else:
        expected_zip_location = 'build/fennec*tests.zip'
        matches = glob.glob(expected_zip_location)
        if len(matches) == 1:
            # try to grab the file we need from there, giving up if any
            # assumption doesn't match
            try:
                archive = zipfile.ZipFile(matches[0], 'r')
                apk_info = archive.getinfo('bin/robocop.apk')
                # it's in the archive, extract to tmp dir - will be created
                archive.extract(apk_info, 'build/tmp')
                shutil.move(
                    'build/tmp/bin/robocop.apk', self_extracted_location)
                actual_location = self_extracted_location
                # got it
            except Exception as e:
                log.warning(
                    "(robocop): zip file not as expected: %s (%s)" % (e.message,
                                                                      str(e.args)))
                log.warning("(robocop): robocop.apk will not be installed")
        else:
            log.warning(
                "(robocop): Didn't find just one %s; found '%s'" % (expected_zip_location,
                                                                    str(matches)))
            log.warning("(robocop): robocop.apk will not be installed")

    return actual_location
Пример #2
0
def find_robocop():
    # we hardcode the relative path to robocop.apk for bug 715215
    # but it may not be unpacked at the time this runs, so be prepared
    # to extract if needed (but use the extracted one if there)
    extracted_location = 'build/tests/bin/robocop.apk'
    self_extracted_location = 'build/robocop.apk'
    actual_location = None

    # for better error reporting
    global errorFile

    if os.path.exists(extracted_location):
        actual_location = extracted_location
    elif os.path.exists(self_extracted_location):
        # already grabbed it in prior step
        actual_location = self_extracted_location
    else:
        expected_zip_location = 'build/fennec*tests.zip'
        matches = glob.glob(expected_zip_location)
        if len(matches) == 1:
            # try to grab the file we need from there, giving up if any
            # assumption doesn't match
            try:
                archive = zipfile.ZipFile(matches[0], 'r')
                apk_info = archive.getinfo('bin/robocop.apk')
                # it's in the archive, extract to tmp dir - will be created
                archive.extract(apk_info, 'build/tmp')
                shutil.move('build/tmp/bin/robocop.apk',
                            self_extracted_location)
                actual_location = self_extracted_location
                # got it
            except Exception as e:
                log.warning("(robocop): zip file not as expected: %s (%s)" %
                            (e.message, str(e.args)))
                log.warning("(robocop): robocop.apk will not be installed")
        else:
            log.warning("(robocop): Didn't find just one %s; found '%s'" %
                        (expected_zip_location, str(matches)))
            log.warning("(robocop): robocop.apk will not be installed")

    return actual_location
Пример #3
0
                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:
        log.error("Automation Error: updateSUT.py: We should have been able to connect and determine the version.")
        return RETCODE_REVERIFY_FAILED
    elif not isVersionCorrect(ver=ver):
        log.error("Automation Error: updateSUT.py: We should have had the %s version but instead we have %s" %
Пример #4
0
    }])
    # 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 == None:
        log.error(