Bug 973601 - Allow xpcshell test chunks; r=ted, a=bustage
authorGeoff Brown <gbrown@mozilla.com>
Wed, 03 Sep 2014 09:27:42 -0400
changeset 171620 2a9736d5d4f395f485fa10defeda1b8b22a16107
parent 171619 3e5e5366c3b7e969f84e32c518783a08fe9c2b9b
child 171621 59aa7df6904ef725c5c21bb40efdc7bb5f43aab4
push id599
push userahalberstadt@mozilla.com
push dateWed, 03 Sep 2014 13:29:51 +0000
reviewersted, bustage
bugs973601
milestone28.0
Bug 973601 - Allow xpcshell test chunks; r=ted, a=bustage
testing/xpcshell/runxpcshelltests.py
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -776,42 +776,24 @@ class XPCShellTests(object):
         if self.singleFile is None and self.totalChunks > 1:
             self.chunkTests()
 
     def chunkTests(self):
         """
           Split the list of tests up into [totalChunks] pieces and filter the
           self.alltests based on thisChunk, so we only run a subset.
         """
-        totalTests = 0
-        for dir in self.alltests:
-            totalTests += len(self.alltests[dir])
-
+        totalTests = len(self.alltests)
         testsPerChunk = math.ceil(totalTests / float(self.totalChunks))
         start = int(round((self.thisChunk-1) * testsPerChunk))
-        end = start + testsPerChunk
-        currentCount = 0
-
-        templist = {}
-        for dir in self.alltests:
-            startPosition = 0
-            dirCount = len(self.alltests[dir])
-            endPosition = dirCount
-            if currentCount < start and currentCount + dirCount >= start:
-                startPosition = int(start - currentCount)
-            if currentCount + dirCount > end:
-                endPosition = int(end - currentCount)
-            if end - currentCount < 0 or (currentCount + dirCount < start):
-                endPosition = 0
-
-            if startPosition is not endPosition:
-                templist[dir] = self.alltests[dir][startPosition:endPosition]
-            currentCount += dirCount
-
-        self.alltests = templist
+        end = int(start + testsPerChunk)
+        if end > totalTests:
+            end = totalTests
+        self.log.info("Running tests %d-%d/%d", start+1, end, totalTests)
+        self.alltests = self.alltests[start:end]
 
     def setAbsPath(self):
         """
           Set the absolute path for xpcshell, httpdjspath and xrepath.
           These 3 variables depend on input from the command line and we need to allow for absolute paths.
           This function is overloaded for a remote solution as os.path* won't work remotely.
         """
         self.testharnessdir = os.path.dirname(os.path.abspath(__file__))