Bug 805428 - Install reftest extension on B2G as app bundle, r=ahal, DONTBUILD(NPOTB)
authorJonathan Griffin <jgriffin@mozilla.com>
Thu, 25 Oct 2012 09:55:42 -0700
changeset 111470 32f9f7af31a1841d2f026ec19bc93f3b03124d9d
parent 111469 5374fb4806348de2a9ba4fef05518130e7d5d91f
child 111471 972986c4f75e2e044be6312d700280327cf5ff56
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersahal, DONTBUILD
bugs805428
milestone19.0a1
Bug 805428 - Install reftest extension on B2G as app bundle, r=ahal, DONTBUILD(NPOTB)
layout/tools/reftest/runreftestb2g.py
--- a/layout/tools/reftest/runreftestb2g.py
+++ b/layout/tools/reftest/runreftestb2g.py
@@ -203,16 +203,17 @@ class B2GReftest(RefTest):
         RefTest.__init__(self, self._automation)
         self._devicemanager = devicemanager
         self.runSSLTunnel = False
         self.remoteTestRoot = options.remoteTestRoot
         self.remoteProfile = options.remoteProfile
         self._automation.setRemoteProfile(self.remoteProfile)
         self.localLogName = options.localLogName
         self.remoteLogFile = options.remoteLogFile
+        self.bundlesDir = '/system/b2g/distribution/bundles'
         self.userJS = '/data/local/user.js'
         self.testDir = '/data/local/tests'
         self.remoteMozillaPath = '/data/b2g/mozilla'
         self.remoteProfilesIniPath = os.path.join(self.remoteMozillaPath, 'profiles.ini')
         self.originalProfilesIni = None
         self.scriptDir = scriptDir
         self.SERVER_STARTUP_TIMEOUT = 90
         if self._automation.IS_DEBUG_BUILD:
@@ -222,16 +223,25 @@ class B2GReftest(RefTest):
         # Pull results back from device
         if (self.remoteLogFile):
             try:
                 self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
             except:
                 print "ERROR: We were not able to retrieve the info from %s" % self.remoteLogFile
                 sys.exit(5)
 
+        # Delete any bundled extensions
+        extensionDir = os.path.join(profileDir, 'extensions', 'staged')
+        for filename in os.listdir(extensionDir):
+            try:
+                self._devicemanager._checkCmdAs(['shell', 'rm', '-rf',
+                                                 os.path.join(self.bundlesDir, filename)])
+            except devicemanager.DMError:
+                pass
+
         # Restore the original profiles.ini.
         if self.originalProfilesIni:
             try:
                 if not self._automation._is_emulator:
                     self.restoreProfilesIni()
                 os.remove(self.originalProfilesIni)
             except:
                 pass
@@ -404,16 +414,29 @@ user_pref("capability.principal.codebase
         # Copy the profile to the device.
         self._devicemanager.removeDir(self.remoteProfile)
         try:
             self._devicemanager.pushDir(profileDir, self.remoteProfile)
         except devicemanager.DMError:
             print "Automation Error: Unable to copy profile to device."
             raise
 
+        # Copy the extensions to the B2G bundles dir.
+        extensionDir = os.path.join(profileDir, 'extensions', 'staged')
+        # need to write to read-only dir
+        self._devicemanager._checkCmdAs(['remount'])
+        for filename in os.listdir(extensionDir):
+            self._devicemanager._checkCmdAs(['shell', 'rm', '-rf',
+                                             os.path.join(self.bundlesDir, filename)])
+        try:
+            self._devicemanager.pushDir(extensionDir, self.bundlesDir)
+        except devicemanager.DMError:
+            print "Automation Error: Unable to copy extensions to device."
+            raise
+
         # In B2G, user.js is always read from /data/local, not the profile
         # directory.  Backup the original user.js first so we can restore it.
         self._devicemanager._checkCmdAs(['shell', 'rm', '-f', '%s.orig' % self.userJS])
         if self._devicemanager.useDDCopy:
             self._devicemanager._checkCmdAs(['shell', 'dd', 'if=%s' % self.userJS, 'of=%s.orig' % self.userJS])
         else:
             self._devicemanager._checkCmdAs(['shell', 'cp', self.userJS, '%s.orig' % self.userJS])
         self._devicemanager.pushFile(os.path.join(profileDir, "user.js"), self.userJS)