Bug 973601 - Allow xpcshell test chunks; r=ted
authorGeoff Brown <gbrown@mozilla.com>
Fri, 28 Feb 2014 14:58:35 -0700
changeset 171680 0f57e0bf64b8c0f5f8f6470f4398931eae3c65c4
parent 171679 06ab7ca6ee788d9e416c478c070d26fcdcebb6ae
child 171681 99caa6e9d6a46acecdf6b48604071ff641d9d587
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersted
bugs973601
milestone30.0a1
Bug 973601 - Allow xpcshell test chunks; r=ted
testing/xpcshell/runxpcshelltests.py
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -805,42 +805,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__))