summaryrefslogtreecommitdiffstats
path: root/cppunit-parallelize.py
diff options
context:
space:
mode:
authorVegard Sjonfjell <vegard@yahoo-inc.com>2016-11-17 13:16:24 +0100
committerVegard Sjonfjell <vegard@yahoo-inc.com>2016-11-17 13:17:14 +0100
commit849a0fc325aa26af2685b21f6e5f79db222e3936 (patch)
tree94cb3d7c4f822c3d6eb6225691a38c2b430ddf00 /cppunit-parallelize.py
parent329b6654d80ee8262c0d98de7fba90bdc8c1311d (diff)
Require chunk size > 0 and limit chunk size to number of test suites
Diffstat (limited to 'cppunit-parallelize.py')
-rwxr-xr-xcppunit-parallelize.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/cppunit-parallelize.py b/cppunit-parallelize.py
index 70d1a2eca12..25106568d56 100755
--- a/cppunit-parallelize.py
+++ b/cppunit-parallelize.py
@@ -12,7 +12,11 @@ def parse_arguments():
argparser = argparse.ArgumentParser(description="Run Vespa cppunit tests in parallell")
argparser.add_argument("testrunner", type=str, help="Test runner executable")
argparser.add_argument("--chunks", type=int, help="Number of chunks", default=5)
- return argparser.parse_args()
+ args = argparser.parse_args()
+ if args.chunks < 1:
+ raise RuntimeError, "I require at least one chunk"
+
+ return args
def take(lst, n):
return [ lst.pop() for i in xrange(n) ]
@@ -60,7 +64,7 @@ def cleanup_processes(processes):
args = parse_arguments()
test_suites = subprocess.check_output((args.testrunner, "--list")).strip().split("\n")
-test_suite_groups = chunkify(test_suites, args.chunks)
+test_suite_groups = chunkify(test_suites, min(len(test_suites), args.chunks))
processes = build_processes(test_suite_groups)
print "Running %d test suites in %d parallel chunks with ~%d tests each" % (len(test_suites), len(test_suite_groups), len(test_suite_groups[0]))