Bug 1517363 - Rebalance mozmill test chunks. r=jorgk DONTBUILD
--- a/mail/test/mozmill/runtestlist.py
+++ b/mail/test/mozmill/runtestlist.py
@@ -1,17 +1,17 @@
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+import glob
import optparse
import sys
import os
-import shutil
import subprocess
import logging
SCRIPT_DIRECTORY = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])))
class RunTestListOptions(optparse.OptionParser):
"""Parsed run test list command line options."""
def __init__(self, **kwargs):
@@ -74,25 +74,41 @@ options, args = parser.parse_args()
if options.binary == "" or options.list == "":
parser.print_help()
sys.exit(1)
totalTestErrors = 0
totalTestPasses = 0
totalDirectories = 0
-tests = open(options.list, "rt").readlines()
+tests = [t.strip() for t in open(options.list, "rt").readlines()]
if options.total_chunks > 1:
- tests_per_chunk = float(len(tests)) / options.total_chunks
+ test_counts = {}
+ total_test_count = 0
+ for t in tests:
+ if os.path.isdir(os.path.join(SCRIPT_DIRECTORY, t)):
+ test_counts[t] = len(glob.glob(os.path.join(SCRIPT_DIRECTORY, t, "test*.js")))
+ else:
+ test_counts[t] = 1
+ total_test_count += test_counts[t]
+
+ tests_per_chunk = float(total_test_count) / options.total_chunks
start = int(round((options.this_chunk - 1) * tests_per_chunk))
end = int(round(options.this_chunk * tests_per_chunk))
- tests = (t for t in tests[start:end])
-
+ chunk_tests = []
+ cumulative_test_count = 0
+ for t in tests:
+ if cumulative_test_count >= end:
+ break
+ if cumulative_test_count >= start:
+ chunk_tests.append(t)
+ cumulative_test_count += test_counts[t]
+ tests = chunk_tests
for directory in tests:
log.info("INFO | (runtestlist.py) | Running directory: %s",
directory.rstrip())
if options.dir != "":
testDirectory = os.path.join(options.dir, directory.rstrip())
else:
testDirectory = directory.rstrip()
--- a/taskcluster/ci/test/tests.yml
+++ b/taskcluster/ci/test/tests.yml
@@ -38,17 +38,16 @@ xpcshell:
treeherder-symbol: X(X)
run-on-projects: built-projects
docker-image:
in-tree: "desktop1604-test"
chunks:
by-test-platform:
linux32/debug: 8
linux64/debug: 8
- macosx64.*: 2
default: 4
instance-size: default
max-run-time: 5400
e10s: false
allow-software-gl-layers: false
mozharness:
script: desktop_unittest.py
config: