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

Side by Side Diff: tools/isolate/shard_test_cases.py

Issue 11045023: Move src/tools/isolate to src/tools/swarm_client as a DEPS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use r159961 Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/isolate/run_test_from_archive.py ('k') | tools/isolate/tests/gtest_fake/__init__.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Runs a google-test shard.
7
8 This makes a simple interface to run a shard on the command line independent of
9 the interpreter, e.g. cmd.exe vs bash.
10 """
11
12 import optparse
13 import os
14 import subprocess
15 import sys
16
17
18 def fix_python_path(cmd):
19 """Returns the fixed command line to call the right python executable."""
20 out = cmd[:]
21 if out[0] == 'python':
22 out[0] = sys.executable
23 elif out[0].endswith('.py'):
24 out.insert(0, sys.executable)
25 return out
26
27
28 def main():
29 parser = optparse.OptionParser(usage='%prog <options> [gtest]')
30 parser.disable_interspersed_args()
31 parser.add_option(
32 '-I', '--index',
33 type='int',
34 default=os.environ.get('GTEST_SHARD_INDEX'),
35 help='Shard index to run')
36 parser.add_option(
37 '-S', '--shards',
38 type='int',
39 default=os.environ.get('GTEST_TOTAL_SHARDS'),
40 help='Total number of shards to calculate from the --index to run')
41 options, args = parser.parse_args()
42 env = os.environ.copy()
43 env['GTEST_TOTAL_SHARDS'] = str(options.shards)
44 env['GTEST_SHARD_INDEX'] = str(options.index)
45 return subprocess.call(fix_python_path(args), env=env)
46
47
48 if __name__ == '__main__':
49 sys.exit(main())
OLDNEW
« no previous file with comments | « tools/isolate/run_test_from_archive.py ('k') | tools/isolate/tests/gtest_fake/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698