Bug 774951 - Allow extensions to be excluded when running mochitest, r=jmaher
authorJonathan Griffin <jgriffin@mozilla.com>
Thu, 19 Jul 2012 10:31:51 -0700
changeset 99810 72b28584ecbf5163889cf84a4c0837b64d1b52d8
parent 99809 5191b82f297614d84edaa49115c62591ea722d91
child 99811 913bd4954d7baf9369464ece5fb77379ac35df41
push id12200
push userjgriffin@mozilla.com
push dateThu, 19 Jul 2012 19:17:22 +0000
treeherdermozilla-inbound@72b28584ecbf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs774951
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 774951 - Allow extensions to be excluded when running mochitest, r=jmaher
testing/mochitest/runtests.py
testing/mochitest/runtestsb2g.py
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -155,17 +155,24 @@ class MochitestOptions(optparse.OptionPa
     defaults["a11y"] = False
 
     self.add_option("--setenv",
                     action = "append", type = "string",
                     dest = "environment", metavar = "NAME=VALUE",
                     help = "sets the given variable in the application's "
                            "environment")
     defaults["environment"] = []
-    
+
+    self.add_option("--exclude-extension",
+                    action = "append", type = "string",
+                    dest = "extensionsToExclude",
+                    help = "excludes the given extension from being installed "
+                           "in the test profile")
+    defaults["extensionsToExclude"] = []
+
     self.add_option("--browser-arg",
                     action = "append", type = "string",
                     dest = "browserArgs", metavar = "ARG",
                     help = "provides an argument to the test application")
     defaults["browserArgs"] = []
 
     self.add_option("--leak-threshold",
                     action = "store", type = "int",
@@ -879,19 +886,20 @@ overlay chrome://webapprt/content/webapp
       os.path.normpath(os.path.join(self.SCRIPT_DIRECTORY, "extensions")),
       # Extensions distributed with the application.
       os.path.join(options.app[ : options.app.rfind(os.sep)], "distribution", "extensions")
     ]
 
     for extensionDir in extensionDirs:
       if os.path.isdir(extensionDir):
         for dirEntry in os.listdir(extensionDir):
-          path = os.path.join(extensionDir, dirEntry)
-          if os.path.isdir(path) or (os.path.isfile(path) and path.endswith(".xpi")):
-            self.installExtensionFromPath(options, path)
+          if dirEntry not in options.extensionsToExclude:
+            path = os.path.join(extensionDir, dirEntry)
+            if os.path.isdir(path) or (os.path.isfile(path) and path.endswith(".xpi")):
+              self.installExtensionFromPath(options, path)
 
     # Install custom extensions passed on the command line.
     for path in options.extensionsToInstall:
       self.installExtensionFromPath(options, path)
 
 def main():
   automation = Automation()
   mochitest = Mochitest(automation)
--- a/testing/mochitest/runtestsb2g.py
+++ b/testing/mochitest/runtestsb2g.py
@@ -91,16 +91,17 @@ class B2GOptions(MochitestOptions):
                     help = "name of the pidfile to generate")
         defaults["pidFile"] = ""
 
         defaults["remoteTestRoot"] = None
         defaults["logFile"] = "mochitest.log"
         defaults["autorun"] = True
         defaults["closeWhenDone"] = True
         defaults["testPath"] = ""
+        defaults["extensionsToExclude"] = ["specialpowers"]
 
         self.set_defaults(**defaults)
 
     def verifyRemoteOptions(self, options, automation):
         options.remoteTestRoot = automation._devicemanager.getDeviceRoot()
         productRoot = options.remoteTestRoot + "/" + automation._product
 
         if options.utilityPath == self._automation.DIST_BIN: