Пример #1
0
def installOneApp(dm, devRoot, app_file_local_path):

    source = app_file_local_path
    filename = os.path.basename(source)
    target = os.path.join(devRoot, filename)

    global proxyFile, errorFile

    print "Installing %s" % target
    if dm.pushFile(source, target):
        status = dm.installApp(target)
        if status is None:
            print '-' * 42
            print 'installApp() done - gathering debug info'
            dm.getInfo('process')
            dm.getInfo('memory')
            dm.getInfo('uptime')
            try:
                print dm.sendCMD(['exec su -c "logcat -d -v time *:W"'])
            except devicemanager.DMError, e:
                print "Exception hit while trying to run logcat: %s" % str(e)
                setFlag(errorFile, "Remote Device Error: can't run logcat")
                sys.exit(1)
        else:
            clearFlag(proxyFile)
            setFlag(errorFile,
                    "Remote Device Error: updateApp() call failed - exiting")
            sys.exit(1)
Пример #2
0
def installOneApp(dm, devRoot, app_file_local_path):

    source = app_file_local_path
    filename = os.path.basename(source)
    target = os.path.join(devRoot, filename)

    global proxyFile, errorFile

    print "Installing %s" % target
    if dm.pushFile(source, target):
        status = dm.installApp(target)
        if status is None:
            print "-" * 42
            print "installApp() done - gathering debug info"
            dm.getInfo("process")
            dm.getInfo("memory")
            dm.getInfo("uptime")
            try:
                print dm.sendCMD(['exec su -c "logcat -d -v time *:W"'])
            except devicemanager.DMError, e:
                print "Exception hit while trying to run logcat: %s" % str(e)
                setFlag(errorFile, "Remote Device Error: can't run logcat")
                sys.exit(1)
        else:
            clearFlag(proxyFile)
            setFlag(errorFile, "Remote Device Error: updateApp() call failed - exiting")
            sys.exit(1)
Пример #3
0
cwd       = os.getcwd()
pidDir    = os.path.join(cwd, '..')
flagFile  = os.path.join(pidDir, 'proxy.flg')
errorFile = os.path.join(pidDir, 'error.flg')

processNames = [ 'org.mozilla.fennec',
                 'org.mozilla.fennec_aurora',
                 'org.mozilla.fennec_unofficial',
                 'org.mozilla.firefox',
                 'org.mozilla.firefox_beta',
                 'org.mozilla.roboexample.test', 
               ]

if os.path.exists(flagFile):
    print "Warning proxy.flg found during cleanup"
    clearFlag(flagFile)

print "Connecting to: " + sys.argv[1]
dm = devicemanager.DeviceManagerSUT(sys.argv[1])

dm.debug = 5
devRoot  = checkDeviceRoot(dm)

if not str(devRoot).startswith("/mnt/sdcard"):
    setFlag(errorFile, "Remote Device Error: devRoot from devicemanager [%s] is not correct" % str(devRoot))
    sys.exit(1)

if dm.dirExists(devRoot):
    status = dm.removeDir(devRoot)
    print "removeDir() returned [%s]" % status
    if status is None or not status:
Пример #4
0
def one_time_setup(ip_addr, major_source):
    """ One time setup of state

    ip_addr - of the tegra we want to install app at
    major_source - we've hacked this script to install
            may-also-be-needed tools, but the source we're asked to
            install has the meta data we need

    Side Effects:
        We two globals, needed for error reporting:
            errorFile, proxyFile
    """

    # set up the flag files, used throughout
    cwd = os.getcwd()
    global proxyFile, errorFile
    proxyFile = os.path.join(cwd, "..", "proxy.flg")
    errorFile = os.path.join(cwd, "..", "error.flg")

    proxyIP = getOurIP()
    proxyPort = calculatePort()

    workdir = os.path.dirname(major_source)
    inifile = os.path.join(workdir, "fennec", "application.ini")
    remoteappini = os.path.join(workdir, "talos", "remoteapp.ini")
    print "copying %s to %s" % (inifile, remoteappini)
    runCommand(["cp", inifile, remoteappini])

    print "connecting to: %s" % ip_addr
    dm = devicemanager.DeviceManagerSUT(ip_addr)
    # Moar data!
    dm.debug = 3

    devRoot = checkDeviceRoot(dm)

    if devRoot is None or devRoot == "/tests":
        setFlag(errorFile, "Remote Device Error: devRoot from devicemanager [%s] is not correct - exiting" % devRoot)
        sys.exit(1)

    try:
        setFlag(proxyFile)
        print proxyIP, proxyPort
        getDeviceTimestamp(dm)
        setDeviceTimestamp(dm)
        getDeviceTimestamp(dm)
        dm.getInfo("process")
        dm.getInfo("memory")
        dm.getInfo("uptime")

        width, height = getResolution(dm)
        # adjust resolution down to allow fennec to install without memory issues
        if width >= 1050 or height >= 1050:
            dm.adjustResolution(1024, 768, "crt")
            print "calling reboot"
            dm.reboot(proxyIP, proxyPort)
            waitForDevice(dm)

            width, height = getResolution(dm)
            if width != 1024 and height != 768:
                clearFlag(proxyFile)
                setFlag(
                    errorFile,
                    "Remote Device Error: Resolution change failed.  Should be %d/%d but is %d/%d"
                    % (1024, 768, width, height),
                )
                sys.exit(1)

    finally:
        clearFlag(proxyFile)

    return dm, devRoot
Пример #5
0
            dm.getInfo("process")
            dm.getInfo("memory")
            dm.getInfo("uptime")
            try:
                print dm.sendCMD(['exec su -c "logcat -d -v time *:W"'])
            except devicemanager.DMError, e:
                print "Exception hit while trying to run logcat: %s" % str(e)
                setFlag(errorFile, "Remote Device Error: can't run logcat")
                sys.exit(1)
        else:
            clearFlag(proxyFile)
            setFlag(errorFile, "Remote Device Error: updateApp() call failed - exiting")
            sys.exit(1)

    else:
        clearFlag(proxyFile)
        setFlag(errorFile, "Remote Device Error: unable to push %s" % target)
        sys.exit(1)


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 proxyFile, errorFile
Пример #6
0
errorFile = os.path.join(cwd, '..', 'error.flg')
proxyIP   = getOurIP()
proxyPort = calculatePort()

print "connecting to: %s" % sys.argv[1]
dm = devicemanager.DeviceManagerSUT(sys.argv[1])
dm.debug = 5

setFlag(proxyFile)
try:
    dm.getInfo('process')
    print dm.sendCMD(['exec su -c "logcat -d -v time *:W"'])

    print 'calling dm.reboot()'

    status = dm.reboot(ipAddr=proxyIP, port=proxyPort)
    print status
finally:
    try:
        waitForDevice(dm, waitTime=600)
    except SystemExit:
        clearFlag(proxyFile)
        setFlag(errorFile, "Remote Device Error: call for device reboot failed")
        sys.exit(1)
        
    clearFlag(proxyFile)

#if status is None or not status:
#    print "Remote Device Error: call for device reboot failed"
#    sys.exit(1)
Пример #7
0
def one_time_setup(ip_addr, major_source):
    ''' One time setup of state

    ip_addr - of the tegra we want to install app at
    major_source - we've hacked this script to install
            may-also-be-needed tools, but the source we're asked to
            install has the meta data we need

    Side Effects:
        We two globals, needed for error reporting:
            errorFile, proxyFile
    '''

    # set up the flag files, used throughout
    cwd = os.getcwd()
    global proxyFile, errorFile
    proxyFile = os.path.join(cwd, '..', 'proxy.flg')
    errorFile = os.path.join(cwd, '..', 'error.flg')

    proxyIP = getOurIP()
    proxyPort = calculatePort()

    workdir = os.path.dirname(major_source)
    inifile = os.path.join(workdir, 'fennec', 'application.ini')
    remoteappini = os.path.join(workdir, 'talos', 'remoteapp.ini')
    print 'copying %s to %s' % (inifile, remoteappini)
    runCommand(['cp', inifile, remoteappini])

    print "connecting to: %s" % ip_addr
    dm = devicemanager.DeviceManagerSUT(ip_addr)
    # Moar data!
    dm.debug = 3

    devRoot = checkDeviceRoot(dm)

    if devRoot is None or devRoot == '/tests':
        setFlag(
            errorFile,
            "Remote Device Error: devRoot from devicemanager [%s] is not correct - exiting"
            % devRoot)
        sys.exit(1)

    try:
        setFlag(proxyFile)
        print proxyIP, proxyPort
        getDeviceTimestamp(dm)
        setDeviceTimestamp(dm)
        getDeviceTimestamp(dm)
        dm.getInfo('process')
        dm.getInfo('memory')
        dm.getInfo('uptime')

        width, height = getResolution(dm)
        #adjust resolution down to allow fennec to install without memory issues
        if (width >= 1050 or height >= 1050):
            dm.adjustResolution(1024, 768, 'crt')
            print 'calling reboot'
            dm.reboot(proxyIP, proxyPort)
            waitForDevice(dm)

            width, height = getResolution(dm)
            if width != 1024 and height != 768:
                clearFlag(proxyFile)
                setFlag(
                    errorFile,
                    "Remote Device Error: Resolution change failed.  Should be %d/%d but is %d/%d"
                    % (1024, 768, width, height))
                sys.exit(1)

    finally:
        clearFlag(proxyFile)

    return dm, devRoot
Пример #8
0
cwd       = os.getcwd()
pidDir    = os.path.join(cwd, '..')
flagFile  = os.path.join(pidDir, 'proxy.flg')
errorFile = os.path.join(pidDir, 'error.flg')

processNames = [ 'org.mozilla.fennec',
                 'org.mozilla.fennec_aurora',
                 'org.mozilla.fennec_unofficial',
                 'org.mozilla.firefox',
                 'org.mozilla.firefox_beta',
                 'org.mozilla.roboexample.test', 
               ]

if os.path.exists(flagFile):
    print "Warning proxy.flg found during cleanup"
    clearFlag(flagFile)

print "Connecting to: " + sys.argv[1]
dm = devicemanager.DeviceManagerSUT(sys.argv[1])

dm.debug = 5
devRoot  = checkDeviceRoot(dm)

if not str(devRoot).startswith("/mnt/sdcard"):
    setFlag(errorFile, "Remote Device Error: devRoot from devicemanager [%s] is not correct" % str(devRoot))
    sys.exit(1)

if dm.dirExists(devRoot):
    status = dm.removeDir(devRoot)
    print "removeDir() returned [%s]" % status
    if status is None or not status: