Chromium Code Reviews| Index: tools/test.py |
| =================================================================== |
| --- tools/test.py (revision 6231) |
| +++ tools/test.py (working copy) |
| @@ -1181,6 +1181,10 @@ |
| 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", |
|
Mads Ager (chromium)
2011/01/10 13:51:12
Split over more lines like the other options?
Rico
2011/01/10 13:54:24
Done.
|
| + 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 +1306,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() |
| @@ -1380,12 +1398,13 @@ |
| } |
| test_list = root.ListTests([], path, context, mode) |
| unclassified_tests += test_list |
| + |
| (cases, unused_rules, all_outcomes) = config.ClassifyTests(test_list, env) |
| if globally_unused_rules is None: |
| 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: |