diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-15 20:45:39 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-15 20:45:39 +0000 |
commit | 2c65b4da251f9620a42d2ac24efb4267dba16d2e (patch) | |
tree | 5f004e682010d766dee136e400d7026ad8cd182f /tools | |
parent | 90314c0a8eb87342278c3e6ea5f12f6ecb5cfb76 (diff) | |
download | chromium_src-2c65b4da251f9620a42d2ac24efb4267dba16d2e.zip chromium_src-2c65b4da251f9620a42d2ac24efb4267dba16d2e.tar.gz chromium_src-2c65b4da251f9620a42d2ac24efb4267dba16d2e.tar.bz2 |
Transparently handle outer sharding in parallel test launcher.
BUG=54098
TEST=none
Review URL: http://codereview.chromium.org/3450003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/parallel_launcher/parallel_launcher.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/parallel_launcher/parallel_launcher.py b/tools/parallel_launcher/parallel_launcher.py index 85e4182..57358f5 100755 --- a/tools/parallel_launcher/parallel_launcher.py +++ b/tools/parallel_launcher/parallel_launcher.py @@ -69,8 +69,20 @@ class TestLauncher(object): def launch(self): env = os.environ.copy() - env['GTEST_TOTAL_SHARDS'] = str(self._num_shards) - env['GTEST_SHARD_INDEX'] = str(self._shard) + if 'GTEST_TOTAL_SHARDS' in env: + # Handle the requested sharding transparently. + outer_shards = int(env['GTEST_TOTAL_SHARDS']) + outer_index = int(env['GTEST_SHARD_INDEX']) + + env['GTEST_TOTAL_SHARDS'] = str(self._num_shards * outer_shards) + + # Calculate the right shard index to pass to the child. This is going + # to be a shard of a shard. + env['GTEST_SHARD_INDEX'] = str((self._num_shards * outer_index) + + self._shard) + else: + env['GTEST_TOTAL_SHARDS'] = str(self._num_shards) + env['GTEST_SHARD_INDEX'] = str(self._shard) args = self._args + ['--test-server-shard=' + str(self._shard)] @@ -115,6 +127,12 @@ def main(argv): print 'You must provide path to the test binary' return 1 + env = os.environ + if bool('GTEST_TOTAL_SHARDS' in env) != bool('GTEST_SHARD_INDEX' in env): + print 'Inconsistent environment. GTEST_TOTAL_SHARDS and GTEST_SHARD_INDEX' + print 'should either be both defined, or both undefined.' + return 1 + launchers = [] for shard in range(options.shards): |