Index: tools/run-tests.py |
diff --git a/tools/run-tests.py b/tools/run-tests.py |
index 971843cc678c44548d2208ad5d962f5959971bde..fe6d25a600be0e92286fe0ff16e5fc4b7562d967 100755 |
--- a/tools/run-tests.py |
+++ b/tools/run-tests.py |
@@ -458,7 +458,17 @@ def ProcessOptions(options): |
return True |
-def ShardTests(tests, shard_count, shard_run): |
+def ShardTests(tests, options): |
+ # Read gtest shard configuration from environment (e.g. set by swarming). |
+ # If none is present, use values passed on the command line. |
tandrii(chromium)
2015/10/12 11:54:31
since this overrides values specified on cmd, mayb
Michael Achenbach
2015/10/12 12:03:03
Done.
|
+ shard_count = int(os.environ.get('GTEST_TOTAL_SHARDS', options.shard_count)) |
+ shard_run = os.environ.get('GTEST_SHARD_INDEX') |
+ if shard_run is not None: |
+ # The v8 shard_run starts at 1, while GTEST_SHARD_INDEX starts at 0. |
+ shard_run = int(shard_run) + 1 |
+ else: |
+ shard_run = options.shard_run |
+ |
if shard_count < 2: |
return tests |
if shard_run < 1 or shard_run > shard_count: |
@@ -650,7 +660,7 @@ def Execute(arch, mode, args, options, suites, workspace): |
else: |
s.tests = variant_tests |
- s.tests = ShardTests(s.tests, options.shard_count, options.shard_run) |
+ s.tests = ShardTests(s.tests, options) |
num_tests += len(s.tests) |
if options.cat: |