Bug 989583 - Set self.testRoot and self.testRootAbs in only one place (runtests.py). r=jmaher
authorArmen Zambrano Gasparnian <armenzg@mozilla.com>
Tue, 17 Jun 2014 09:50:16 -0400
changeset 209909 c257e034da91f94e6b63b19a180816db8306d9f9
parent 209908 212f914cb83a2ac4bdfffe40bf2dde53bc083029
child 209910 3060e6862f153de500f7655962b7da925ec03e78
push id3857
push userraliiev@mozilla.com
push dateTue, 02 Sep 2014 16:39:23 +0000
treeherdermozilla-beta@5638b907b505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs989583
milestone33.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 989583 - Set self.testRoot and self.testRootAbs in only one place (runtests.py). r=jmaher
testing/mochitest/runtests.py
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -416,28 +416,34 @@ class MochitestUtilsMixin(object):
             not re.search(r'\^headers\^$', filename))
 
   def getTestPath(self, options):
     if options.ipcplugins:
       return "dom/plugins/test/mochitest"
     else:
       return options.testPath
 
-  def getTestRoot(self, options):
-    if options.browserChrome:
-      if options.immersiveMode:
-        return 'metro'
-      return 'browser'
-    elif options.a11y:
-      return 'a11y'
-    elif options.webapprtChrome:
-      return 'webapprtChrome'
-    elif options.chrome:
-      return 'chrome'
-    return self.TEST_PATH
+  def setTestRoot(self, options):
+    if hasattr(self, "testRoot"):
+      return self.testRoot, self.testRootAbs
+    else:
+      if options.browserChrome:
+        if options.immersiveMode:
+          self.testRoot = 'metro'
+        else:
+          self.testRoot = 'browser'
+      elif options.a11y:
+        self.testRoot = 'a11y'
+      elif options.webapprtChrome:
+        self.testRoot = 'webapprtChrome'
+      elif options.chrome:
+        self.testRoot = 'chrome'
+      else:
+        self.testRoot = self.TEST_PATH
+      self.testRootAbs = os.path.join(SCRIPT_DIR, self.testRoot)
 
   def buildTestURL(self, options):
     testHost = "http://mochi.test:8888"
     testPath = self.getTestPath(options)
     testURL = "/".join([testHost, self.TEST_PATH, testPath])
     if os.path.isfile(os.path.join(self.oldcwd, os.path.dirname(__file__), self.TEST_PATH, testPath)) and options.repeat > 0:
       testURL = "/".join([testHost, self.TEST_PATH, os.path.dirname(testPath)])
     if options.chrome or options.a11y:
@@ -448,20 +454,17 @@ class MochitestUtilsMixin(object):
 
   def buildTestPath(self, options, disabled=True):
     """ Build the url path to the specific test harness and test file or directory
         Build a manifest of tests to run and write out a json file for the harness to read
 
         disabled -- This allows to add all disabled tests on the build side
                     and then on the run side to only run the enabled ones
     """
-    # This would normally get set in runTests() but b2g mochitests
-    # call this function first
-    self.testRoot = self.getTestRoot(options)
-    self.testRootAbs = os.path.join(SCRIPT_DIR, self.testRoot)
+    self.setTestRoot(options)
     manifest = self.getTestManifest(options)
 
     if manifest:
       # Python 2.6 doesn't allow unicode keys to be used for keyword
       # arguments. This gross hack works around the problem until we
       # rid ourselves of 2.6.
       info = {}
       for k, v in mozinfo.info.items():
@@ -1331,18 +1334,17 @@ class Mochitest(MochitestUtilsMixin):
   def runTests(self, options, onLaunch=None):
     """ Prepare, configure, run tests and cleanup """
 
     # Create variables to count the number of passes, fails, todos.
     self.countpass = 0
     self.countfail = 0
     self.counttodo = 0
 
-    self.testRoot = self.getTestRoot(options)
-    self.testRootAbs = os.path.join(SCRIPT_DIR, self.testRoot)
+    self.setTestRoot(options)
 
     if not options.runByDir:
       return self.doTests(options, onLaunch)
 
     dirs = self.getDirectories(options)
     
     if options.totalChunks > 1:
       chunkSize = int(len(dirs) / options.totalChunks) + 1