Bug 1305877 - Hash directory of test path, not full path; r?jgraham
Per discussion in the bug, we want automation to behave like local
development mode with regards to running tests in a directory. That
means we want all tests in a directory to be executed together.
Hashing the directory instead of the full filename ensures that
tests in the same directory end up in the same chunk. This will
likely make slow directories contribute to higher variance in
chunk execution times. But that's a compromise we're willing to
live with at this time.
MozReview-Commit-ID: GU25o5uHfQY
--- a/testing/web-platform/harness/wptrunner/testloader.py
+++ b/testing/web-platform/harness/wptrunner/testloader.py
@@ -41,17 +41,19 @@ class Unchunked(TestChunker):
for item in manifest:
yield item
class HashChunker(TestChunker):
def __call__(self, manifest):
chunk_index = self.chunk_number - 1
for test_path, tests in manifest:
- h = int(hashlib.md5(test_path).hexdigest(), 16)
+ # We hash the directory of the test so all tests in the same
+ # directory end up in the same chunk.
+ h = int(hashlib.md5(os.path.dirname(test_path)).hexdigest(), 16)
if h % self.total_chunks == chunk_index:
yield test_path, tests
class EqualTimeChunker(TestChunker):
def _group_by_directory(self, manifest_items):
"""Split the list of manifest items into a ordered dict that groups tests in
so that anything in the same subdirectory beyond a depth of 3 is in the same