| Index: tools/test.py | 
| =================================================================== | 
| --- tools/test.py	(revision 6231) | 
| +++ tools/test.py	(working copy) | 
| @@ -1181,6 +1181,12 @@ | 
| result.add_option("--crankshaft", | 
| help="Run with the --crankshaft flag", | 
| default=False, action="store_true") | 
| +  result.add_option("--shard-count", | 
| +                    help="Split testsuites into this number of shards", | 
| +                    default=1, type="int") | 
| +  result.add_option("--shard-run", | 
| +                    help="Run this shard from the split up tests.", | 
| +                    default=1, type="int") | 
| result.add_option("--noprof", help="Disable profiling support", | 
| default=False) | 
| return result | 
| @@ -1302,6 +1308,20 @@ | 
| millis = round(d * 1000) % 1000 | 
| return time.strftime("%M:%S.", time.gmtime(d)) + ("%03i" % millis) | 
|  | 
| +def ShardTests(tests, options): | 
| +  if options.shard_count < 2: | 
| +    return tests | 
| +  if options.shard_run < 1 or options.shard_run > options.shard_count: | 
| +    print "shard-run not a valid number, should be in [1:shard-count]" | 
| +    print "defaulting back to running all tests" | 
| +    return tests | 
| +  count = 0; | 
| +  shard = [] | 
| +  for test in tests: | 
| +    if count % options.shard_count == options.shard_run - 1: | 
| +      shard.append(test); | 
| +    count += 1 | 
| +  return shard | 
|  | 
| def Main(): | 
| parser = BuildOptions() | 
| @@ -1385,7 +1405,7 @@ | 
| globally_unused_rules = set(unused_rules) | 
| else: | 
| globally_unused_rules = globally_unused_rules.intersection(unused_rules) | 
| -      all_cases += cases | 
| +      all_cases += ShardTests(cases, options) | 
| all_unused.append(unused_rules) | 
|  | 
| if options.cat: | 
|  |