From 9800c05e3dccaddd8f4df8c1b76fced762676fd7 Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Mon, 9 Sep 2013 12:36:03 -0700 Subject: [PATCH] Bug 913241 - Support chunking mochitests from mach; r=jmaher --- testing/mochitest/mach_commands.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/testing/mochitest/mach_commands.py b/testing/mochitest/mach_commands.py index 8dee5d781db..8484044583a 100644 --- a/testing/mochitest/mach_commands.py +++ b/testing/mochitest/mach_commands.py @@ -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 ' \