def run_desktop_mochitests(parser, options): # create our Marionette instance marionette_args = {} if options.marionette: host, port = options.marionette.split(':') marionette_args['host'] = host marionette_args['port'] = int(port) mochitest = B2GDesktopMochitest(marionette_args, options.profile_data_dir) # add a -bin suffix if b2g-bin exists, but just b2g was specified if options.app[-4:] != '-bin': if os.path.isfile("%s-bin" % options.app): options.app = "%s-bin" % options.app options = MochitestOptions.verifyOptions(parser, options, mochitest) if options == None: sys.exit(1) if options.desktop and not options.profile: raise Exception("must specify --profile when specifying --desktop") options.browserArgs += ['-marionette'] retVal = mochitest.runTests(options, onLaunch=mochitest.startTests) mochitest.message_logger.finish() sys.exit(retVal)
def run_desktop_mochitests(parser, options): # create our Marionette instance marionette_args = {} if options.marionette: host, port = options.marionette.split(':') marionette_args['host'] = host marionette_args['port'] = int(port) # add a -bin suffix if b2g-bin exists, but just b2g was specified if options.app[-4:] != '-bin': if os.path.isfile("%s-bin" % options.app): options.app = "%s-bin" % options.app mochitest = B2GDesktopMochitest(marionette_args, options, options.profile_data_dir) options = MochitestOptions.verifyOptions(parser, options, mochitest) if options == None: sys.exit(1) if options.desktop and not options.profile: raise Exception("must specify --profile when specifying --desktop") options.browserArgs += ['-marionette'] retVal = mochitest.runTests(options, onLaunch=mochitest.startTests) mochitest.message_logger.finish() sys.exit(retVal)
def main(): automation = Automation() mochitest = Mochitest(automation) parser = MochitestOptions(automation) options, args = parser.parse_args() options = parser.verifyOptions(options, mochitest) if options == None: sys.exit(1) options.utilityPath = mochitest.getFullPath(options.utilityPath) options.certPath = mochitest.getFullPath(options.certPath) if options.symbolsPath and not isURL(options.symbolsPath): options.symbolsPath = mochitest.getFullPath(options.symbolsPath) automation.setServerInfo(options.webServer, options.httpPort, options.sslPort, options.webSocketPort) sys.exit(mochitest.runTests(options))
def verifyOptions(self, options, mochitest): # since we are reusing verifyOptions, it will exit if App is not found temp = options.app options.app = __file__ tempPort = options.httpPort tempSSL = options.sslPort tempIP = options.webServer options = MochitestOptions.verifyOptions(self, options, mochitest) options.webServer = tempIP options.app = temp options.sslPort = tempSSL options.httpPort = tempPort return options
def verifyOptions(self, options, mochitest): # since we are reusing verifyOptions, it will exit if App is not found temp = options.app options.app = sys.argv[0] tempPort = options.httpPort tempSSL = options.sslPort tempIP = options.webServer options = MochitestOptions.verifyOptions(self, options, mochitest) options.webServer = tempIP options.app = temp options.sslPort = tempSSL options.httpPort = tempPort return options
def verifyOptions(self, options, mochitest): # since we are reusing verifyOptions, it will exit if App is not found temp = options.app options.app = __file__ tempPort = options.httpPort tempSSL = options.sslPort tempIP = options.webServer # We are going to override this option later anyway, just pretend # like it's not set for verification purposes. options.dumpOutputDirectory = None options = MochitestOptions.verifyOptions(self, options, mochitest) options.webServer = tempIP options.app = temp options.sslPort = tempSSL options.httpPort = tempPort return options
def __init__(self, automation, **kwargs): defaults = {} self._automation = automation or Automation() MochitestOptions.__init__(self) self.add_option("--remote-app-path", action="store", type = "string", dest = "remoteAppPath", help = "Path to remote executable relative to device root using only forward slashes. Either this or app must be specified but not both") defaults["remoteAppPath"] = None self.add_option("--deviceIP", action="store", type = "string", dest = "deviceIP", help = "ip address of remote device to test") defaults["deviceIP"] = None self.add_option("--dm_trans", action="store", type = "string", dest = "dm_trans", help = "the transport to use to communicate with device: [adb|sut]; default=sut") defaults["dm_trans"] = "sut" self.add_option("--devicePort", action="store", type = "string", dest = "devicePort", help = "port of remote device to test") defaults["devicePort"] = 20701 self.add_option("--remote-product-name", action="store", type = "string", dest = "remoteProductName", help = "The executable's name of remote product to test - either fennec or firefox, defaults to fennec") defaults["remoteProductName"] = "fennec" self.add_option("--remote-logfile", action="store", type = "string", dest = "remoteLogFile", help = "Name of log file on the device relative to the device root. PLEASE ONLY USE A FILENAME.") defaults["remoteLogFile"] = None self.add_option("--remote-webserver", action = "store", type = "string", dest = "remoteWebServer", help = "ip address where the remote web server is hosted at") defaults["remoteWebServer"] = None self.add_option("--http-port", action = "store", type = "string", dest = "httpPort", help = "http port of the remote web server") defaults["httpPort"] = automation.DEFAULT_HTTP_PORT self.add_option("--ssl-port", action = "store", type = "string", dest = "sslPort", help = "ssl port of the remote web server") defaults["sslPort"] = automation.DEFAULT_SSL_PORT self.add_option("--robocop-ini", action = "store", type = "string", dest = "robocopIni", help = "name of the .ini file containing the list of tests to run") defaults["robocopIni"] = "" self.add_option("--robocop", action = "store", type = "string", dest = "robocop", help = "name of the .ini file containing the list of tests to run. [DEPRECATED- please use --robocop-ini") defaults["robocop"] = "" self.add_option("--robocop-apk", action = "store", type = "string", dest = "robocopApk", help = "name of the Robocop APK to use for ADB test running") defaults["robocopApk"] = "" self.add_option("--robocop-path", action = "store", type = "string", dest = "robocopPath", help = "Path to the folder where robocop.apk is located at. Primarily used for ADB test running. [DEPRECATED- please use --robocop-apk]") defaults["robocopPath"] = "" self.add_option("--robocop-ids", action = "store", type = "string", dest = "robocopIds", help = "name of the file containing the view ID map (fennec_ids.txt)") defaults["robocopIds"] = "" self.add_option("--remoteTestRoot", action = "store", type = "string", dest = "remoteTestRoot", help = "remote directory to use as test root (eg. /mnt/sdcard/tests or /data/local/tests)") defaults["remoteTestRoot"] = None defaults["logFile"] = "mochitest.log" defaults["autorun"] = True defaults["closeWhenDone"] = True defaults["testPath"] = "" defaults["app"] = None defaults["utilityPath"] = None self.set_defaults(**defaults)
def __init__(self, automation, **kwargs): defaults = {} MochitestOptions.__init__(self, automation) self.add_option("--remote-app-path", action="store", type = "string", dest = "remoteAppPath", help = "Path to remote executable relative to device root using only forward slashes. Either this or app must be specified but not both") defaults["remoteAppPath"] = None self.add_option("--deviceIP", action="store", type = "string", dest = "deviceIP", help = "ip address of remote device to test") defaults["deviceIP"] = None self.add_option("--dm_trans", action="store", type = "string", dest = "dm_trans", help = "the transport to use to communicate with device: [adb|sut]; default=sut") defaults["dm_trans"] = "sut" self.add_option("--devicePort", action="store", type = "string", dest = "devicePort", help = "port of remote device to test") defaults["devicePort"] = 20701 self.add_option("--remote-product-name", action="store", type = "string", dest = "remoteProductName", help = "The executable's name of remote product to test - either fennec or firefox, defaults to fennec") defaults["remoteProductName"] = "fennec" self.add_option("--remote-logfile", action="store", type = "string", dest = "remoteLogFile", help = "Name of log file on the device relative to the device root. PLEASE ONLY USE A FILENAME.") defaults["remoteLogFile"] = None self.add_option("--remote-webserver", action = "store", type = "string", dest = "remoteWebServer", help = "ip address where the remote web server is hosted at") defaults["remoteWebServer"] = None self.add_option("--http-port", action = "store", type = "string", dest = "httpPort", help = "http port of the remote web server") defaults["httpPort"] = automation.DEFAULT_HTTP_PORT self.add_option("--ssl-port", action = "store", type = "string", dest = "sslPort", help = "ssl port of the remote web server") defaults["sslPort"] = automation.DEFAULT_SSL_PORT self.add_option("--pidfile", action = "store", type = "string", dest = "pidFile", help = "name of the pidfile to generate") defaults["pidFile"] = "" self.add_option("--robocop-ini", action = "store", type = "string", dest = "robocopIni", help = "name of the .ini file containing the list of tests to run") defaults["robocopIni"] = "" self.add_option("--robocop", action = "store", type = "string", dest = "robocop", help = "name of the .ini file containing the list of tests to run. [DEPRECATED- please use --robocop-ini") defaults["robocop"] = "" self.add_option("--robocop-apk", action = "store", type = "string", dest = "robocopApk", help = "name of the Robocop APK to use for ADB test running") defaults["robocopApk"] = "" self.add_option("--robocop-path", action = "store", type = "string", dest = "robocopPath", help = "Path to the folder where robocop.apk is located at. Primarily used for ADB test running. [DEPRECATED- please use --robocop-apk]") defaults["robocopPath"] = "" self.add_option("--robocop-ids", action = "store", type = "string", dest = "robocopIds", help = "name of the file containing the view ID map (fennec_ids.txt)") defaults["robocopIds"] = "" self.add_option("--remoteTestRoot", action = "store", type = "string", dest = "remoteTestRoot", help = "remote directory to use as test root (eg. /mnt/sdcard/tests or /data/local/tests)") defaults["remoteTestRoot"] = None defaults["logFile"] = "mochitest.log" defaults["autorun"] = True defaults["closeWhenDone"] = True defaults["testPath"] = "" defaults["app"] = None self.set_defaults(**defaults)