Example #1
0
def main():

  parser = RemoteXPCShellOptions()
  options, args = parser.parse_args()

  if len(args) < 2 and options.manifest is None or \
     (len(args) < 1 and options.manifest is not None):
     print "len(args): " + str(len(args))
     print >>sys.stderr, """Usage: %s <path to xpcshell> <test dirs>
           or: %s --manifest=test.manifest <path to xpcshell>""" % (sys.argv[0],
                                                           sys.argv[0])
     sys.exit(1)

  if (options.device == ''):
    print >>sys.stderr, "Error: Please provide an ip address for the remote device with the --device option"
    sys.exit(1)


  dm = devicemanager.DeviceManager(options.device, 20701)
  xpcsh = XPCShellRemote(dm)
  debuggerInfo = getDebuggerInfo(xpcsh.oldcwd, options.debugger, options.debuggerArgs,
    options.debuggerInteractive);

  if options.interactive and not options.testPath:
    print >>sys.stderr, "Error: You must specify a test filename in interactive mode!"
    sys.exit(1)

  # Zip up the xpcshell directory: 7z a <zipName> xpcshell/*, assuming we are in the xpcshell directory
  # TODO: ensure the system has 7z, this is adding a new dependency to the overall system
  zipName = 'xpcshell.7z'
  try:
    Popen(['7z', 'a', zipName, '../xpcshell']).wait()
  except:
    print "to run these tests remotely, we require 7z to be installed and in your path"
    sys.exit(1)

  if dm.pushFile(zipName, '/tests/xpcshell.7z') == None:
     raise devicemanager.FileError("failed to copy xpcshell.7z to device")
  if dm.unpackFile('xpcshell.7z') == None:
     raise devicemanager.FileError("failed to unpack xpcshell.7z on the device")

  if not xpcsh.runTests(args[0],
                        xrePath=options.xrePath,
                        symbolsPath=options.symbolsPath,
                        manifest=options.manifest,
                        testdirs=args[1:],
                        testPath=options.testPath,
                        interactive=options.interactive,
                        logfiles=options.logfiles,
                        debuggerInfo=debuggerInfo):
    sys.exit(1)
    def createReftestProfile(self, options, profileDir, reftestlist):
        RefTest.createReftestProfile(self,
                                     options,
                                     profileDir,
                                     reftestlist,
                                     server=options.remoteWebServer)

        # Turn off the locale picker screen
        fhandle = open(os.path.join(profileDir, "user.js"), 'a')
        fhandle.write("""
user_pref("browser.firstrun.show.localepicker", false);
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
user_pref("reftest.remote", true);
user_pref("toolkit.telemetry.prompted", true);
user_pref("reftest.uri", "%s");
""" % reftestlist)

        #workaround for jsreftests.
        if options.enablePrivilege:
            fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalXPConnect");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))

        # Close the file
        fhandle.close()

        if (self._devicemanager.pushDir(profileDir,
                                        options.remoteProfile) == None):
            raise devicemanager.FileError(
                "Failed to copy profiledir to device")
    def buildProfile(self, options):
        manifest = Mochitest.buildProfile(self, options)
        self.localProfile = options.profilePath
        if self._dm.pushDir(options.profilePath, self.remoteProfile) == None:
            raise devicemanager.FileError("Unable to copy profile to device.")

        options.profilePath = self.remoteProfile
        return manifest
 def installChromeFile(self, filename, options):
     parts = options.app.split('/')
     if (parts[0] == options.app):
       return "NO_CHROME_ON_DROID"
     path = '/'.join(parts[:-1])
     manifest = path + "/chrome/" + os.path.basename(filename)
     if self._dm.pushFile(filename, manifest) == False:
         raise devicemanager.FileError("Unable to install Chrome files on device.")
     return manifest
    def buildURLOptions(self, options):
        self.localLog = options.logFile
        options.logFile = self.remoteLog
        options.profilePath = self.localProfile
        retVal = Mochitest.buildURLOptions(self, options)
        #we really need testConfig.js (for browser chrome)
        if self._dm.pushDir(options.profilePath, self.remoteProfile) == None:
            raise devicemanager.FileError("Unable to copy profile to device.")

        options.profilePath = self.remoteProfile
        options.logFile = self.localLog
        return retVal
    def createReftestProfile(self, options, profileDir):
        RefTest.createReftestProfile(self, options, profileDir, server=options.remoteWebServer)

        #workaround for jsreftests.
        if options.enablePrivilege:
          fhandle = open(os.path.join(profileDir, "user.js"), 'a')
          fhandle.write("""
user_pref("capability.principal.codebase.p2.granted", "UniversalPreferencesWrite UniversalXPConnect UniversalBrowserWrite UniversalPreferencesRead UniversalBrowserRead");
user_pref("capability.principal.codebase.p2.id", "http://%s:%s");
""" % (options.remoteWebServer, options.httpPort))
          fhandle.close()

        if (self._devicemanager.pushDir(profileDir, options.remoteProfile) == None):
            raise devicemanager.FileError("Failed to copy profiledir to device")
Example #7
0
 def verifyDirPath(self, fileName):
     # approot - path to root of application - firefox or fennec
     # xreroot - path to xulrunner binaries - firefox or fennec/xulrunner
     # xpcshell - full or relative path to xpcshell binary
     #given fileName, returns full path of existing file
     if (self.device.dirExists(fileName)):
         return fileName
     
     fileName = self.device.getAppRoot() + '/' + fileName.split('/')[-1]
     if (self.device.dirExists(fileName)):
         return fileName
     
     fileName = self.device.getDeviceRoot() + '/' + fileName.split('/')[-1]
     if (not self.device.dirExists(fileName)):
         raise devicemanager.FileError("No Dir found for: " + str(fileName))
     return fileName
 def copyExtraFilesToProfile(self, options, profileDir):
     RefTest.copyExtraFilesToProfile(self, options, profileDir)
     if (self._devicemanager.pushDir(profileDir,
                                     options.remoteProfile) == None):
         raise devicemanager.FileError(
             "Failed to copy extra files to device")