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

Unified Diff: chrome/tools/test/smoketests.py

Issue 159568: Update smoketests.py so we can run ui_tests in parallel, with... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | tools/python/google/process_utils.py » ('j') | tools/python/google/process_utils.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/tools/test/smoketests.py
===================================================================
--- chrome/tools/test/smoketests.py (revision 21827)
+++ chrome/tools/test/smoketests.py (working copy)
@@ -109,6 +109,39 @@
return [word % substitutions for word in list]
+def RunTestsInShards(test_command, verbose=True):
+ """Runs a test in shards. The number of shards is equal to
+ NUMBER_OF_PROCESSORS.
+
+ Args:
+ test_command: the test command to run, which is a list of one or more
+ strings.
+ verbose: if True, combines stdout and stderr into stdout.
+ Otherwise, prints only the command's stderr to stdout.
+
+ Returns:
+ The first shard process's exit status.
+
+ Raises:
+ CommandNotFound if the command executable could not be found.
+ """
+ processor_count = 2
M-A Ruel 2009/07/29 22:24:46 nit: I think it should default to 1.
+ try:
+ processor_count = int(os.environ['NUMBER_OF_PROCESSORS'])
+ except KeyError:
+ print 'No NUMBER_OF_PROCESSORS defined. Use 2 instances.'
+
+ commands = []
+ for i in xrange(processor_count):
+ command = [test_command[j] for j in xrange(len(test_command))]
+ # To support sharding, the test executable needs to provide --batch-count
+ # --batch-index command line switches.
+ command.append('--batch-count=%s' % processor_count)
+ command.append('--batch-index=%d' % i)
+ commands.append(command)
+ return google.process_utils.RunCommandsInParallel(commands, verbose)[0][0]
+
+
def main(options, args):
"""Runs all the selected tests for the given build type and target."""
options.build_type = options.build_type.lower()
@@ -184,7 +217,10 @@
print
print 'Running %s:' % test,
try:
- result = google.process_utils.RunCommand(command, options.verbose)
+ if test == 'ui':
+ result = RunTestsInShards(command, options.verbose)
+ else:
+ result = google.process_utils.RunCommand(command, options.verbose)
except google.process_utils.CommandNotFound, e:
print '%s' % e
raise
« no previous file with comments | « no previous file | tools/python/google/process_utils.py » ('j') | tools/python/google/process_utils.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698