Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(693)

Unified Diff: tools/run-tests.py

Issue 1395343002: [swarming] Let v8 test driver use gtest environment variables for shards. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Log problems Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/run-tests.py
diff --git a/tools/run-tests.py b/tools/run-tests.py
index 971843cc678c44548d2208ad5d962f5959971bde..84d2929c2152d12dd72f54631a61a7688bf1bc57 100755
--- a/tools/run-tests.py
+++ b/tools/run-tests.py
@@ -458,7 +458,27 @@ 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.
+ 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 options.shard_count > 1:
+ # Log if a value was passed on the cmd line and it differs from the
+ # environment variables.
+ if options.shard_count != shard_count:
+ print("shard_count from cmd line differs from environment variable "
+ "GTEST_TOTAL_SHARDS")
+ if options.shard_run > 1 and options.shard_run != shard_run:
+ print("shard_run from cmd line differs from environment variable "
+ "GTEST_SHARD_INDEX")
+
if shard_count < 2:
return tests
if shard_run < 1 or shard_run > shard_count:
@@ -650,7 +670,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:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698