Bug 913241 - Support chunking mochitests from mach; r=jmaher

This commit is contained in:
Gregory Szorc 2013-09-09 12:36:03 -07:00
parent 45d6be5fe9
commit 9800c05e3d

View File

@ -98,7 +98,8 @@ class MochitestRunner(MozbuildObject):
def run_desktop_test(self, suite=None, test_file=None, debugger=None,
debugger_args=None, shuffle=False, keep_open=False, rerun_failures=False,
no_autorun=False, repeat=0, run_until_failure=False, slow=False):
no_autorun=False, repeat=0, run_until_failure=False, slow=False,
chunk_by_dir=0, total_chunks=None, this_chunk=None):
"""Runs a mochitest.
test_file is a path to a test file. It can be a relative path from the
@ -204,6 +205,9 @@ class MochitestRunner(MozbuildObject):
options.testingModulesDir = os.path.join(self.tests_dir, 'modules')
options.extraProfileFiles.append(os.path.join(self.distdir, 'plugins'))
options.symbolsPath = os.path.join(self.distdir, 'crashreporter-symbols')
options.chunkByDir = chunk_by_dir
options.totalChunks = total_chunks
options.thisChunk = this_chunk
options.failureFile = failure_file_path
@ -315,6 +319,18 @@ def MochitestCommand(func):
help='Delay execution between tests.')
func = slow(func)
chunk_dir = CommandArgument('--chunk-by-dir', type=int,
help='Group tests together in chunks by this many top directories.')
func = chunk_dir(func)
chunk_total = CommandArgument('--total-chunks', type=int,
help='Total number of chunks to split tests into.')
func = chunk_total(func)
this_chunk = CommandArgument('--this-chunk', type=int,
help='If running tests by chunks, the number of the chunk to run.')
func = this_chunk(func)
path = CommandArgument('test_file', default=None, nargs='?',
metavar='TEST',
help='Test to run. Can be specified as a single file, a ' \