Пример #1
0
    retVal = reftest.startWebServer(options)
    if retVal:
        return retVal

    if options.printDeviceInfo and not options.verify:
        reftest.printDeviceInfo()

    retVal = 0
    try:
        if options.verify:
            retVal = reftest.verifyTests(options.tests, options)
        else:
            retVal = reftest.runTests(options.tests, options)
    except Exception:
        print "Automation Error: Exception caught while running tests"
        traceback.print_exc()
        retVal = 1

    reftest.stopWebServer(options)

    if options.printDeviceInfo and not options.verify:
        reftest.printDeviceInfo(printLogcat=True)

    return retVal


if __name__ == "__main__":
    parser = reftestcommandline.RemoteArgumentsParser()
    options = parser.parse_args()
    sys.exit(run_test_harness(parser, options))
Пример #2
0
def main():
    parser = reftestcommandline.RemoteArgumentsParser()
    options = parser.parse_args()
    retVal = runTests(options, parser)
    return retVal
Пример #3
0
def main():
    automation = RemoteAutomation(None)
    parser = reftestcommandline.RemoteArgumentsParser()
    options = parser.parse_args()

    if (options.dm_trans == 'sut' and options.deviceIP == None):
        print "Error: If --dm_trans = sut, you must provide a device IP to connect to via the --deviceIP option"
        return 1

    try:
        if (options.dm_trans == "adb"):
            if (options.deviceIP):
                dm = droid.DroidADB(options.deviceIP,
                                    options.devicePort,
                                    deviceRoot=options.remoteTestRoot)
            elif (options.deviceSerial):
                dm = droid.DroidADB(None,
                                    None,
                                    deviceSerial=options.deviceSerial,
                                    deviceRoot=options.remoteTestRoot)
            else:
                dm = droid.DroidADB(None,
                                    None,
                                    deviceRoot=options.remoteTestRoot)
        else:
            dm = droid.DroidSUT(options.deviceIP,
                                options.devicePort,
                                deviceRoot=options.remoteTestRoot)
    except devicemanager.DMError:
        print "Automation Error: exception while initializing devicemanager.  Most likely the device is not in a testable state."
        return 1

    automation.setDeviceManager(dm)

    if (options.remoteProductName != None):
        automation.setProduct(options.remoteProductName)

    # Set up the defaults and ensure options are set
    parser.validate_remote(options, automation)

    # Check that Firefox is installed
    expected = options.app.split('/')[-1]
    installed = dm.shellCheckOutput(['pm', 'list', 'packages', expected])
    if expected not in installed:
        print "%s is not installed on this device" % expected
        return 1

    automation.setAppName(options.app)
    automation.setRemoteProfile(options.remoteProfile)
    automation.setRemoteLog(options.remoteLogFile)
    reftest = RemoteReftest(automation, dm, options, SCRIPT_DIRECTORY)
    parser.validate(options, reftest)

    if mozinfo.info['debug']:
        print "changing timeout for remote debug reftests from %s to 600 seconds" % options.timeout
        options.timeout = 600

    # Hack in a symbolic link for jsreftest
    os.system("ln -s ../jsreftest " +
              str(os.path.join(SCRIPT_DIRECTORY, "jsreftest")))

    # Start the webserver
    retVal = reftest.startWebServer(options)
    if retVal:
        return retVal

    procName = options.app.split('/')[-1]
    if (dm.processExist(procName)):
        dm.killProcess(procName)

    reftest.printDeviceInfo()

    #an example manifest name to use on the cli
    #    manifest = "http://" + options.remoteWebServer + "/reftests/layout/reftests/reftest-sanity/reftest.list"
    retVal = 0
    try:
        dm.recordLogcat()
        retVal = reftest.runTests(options.tests, options)
    except:
        print "Automation Error: Exception caught while running tests"
        traceback.print_exc()
        retVal = 1

    reftest.stopWebServer(options)

    reftest.printDeviceInfo(printLogcat=True)

    return retVal