Index: third_party/gtest-parallel/gtest-parallel |
diff --git a/third_party/gtest-parallel/gtest-parallel b/third_party/gtest-parallel/gtest-parallel |
index 5c4d44e63ba885fd1cdd6c8057d814c40b2ea02e..778a29a07732364f45c3bb3d406bb65813c80087 100755 |
--- a/third_party/gtest-parallel/gtest-parallel |
+++ b/third_party/gtest-parallel/gtest-parallel |
@@ -265,16 +265,13 @@ parser.add_option('--gtest_also_run_disabled_tests', action='store_true', |
parser.add_option('--format', type='string', default='filter', |
help='output format (raw,filter)') |
parser.add_option('--print_test_times', action='store_true', default=False, |
- help='When done, list the run time of each test') |
-parser.add_option('--shard_count', type='int', |
- default=int(os.environ.pop('GTEST_TOTAL_SHARDS', 1)), |
- help=('Total number of shards (for sharding test execution ' |
- 'between multiple machines). Default: %default')) |
-parser.add_option('--shard_index', type='int', |
- default=int(os.environ.pop('GTEST_SHARD_INDEX', 0)), |
- help=('Zero-indexed number identifying this shard (for ' |
- 'sharding test execution between multiple machines). ' |
- 'Default: %default')) |
+ help='list the run time of each test at the end of execution') |
+parser.add_option('--shard_count', type='int', default=1, |
+ help='total number of shards (for sharding test execution ' |
+ 'between multiple machines)') |
+parser.add_option('--shard_index', type='int', default=0, |
+ help='zero-indexed number identifying this shard (for ' |
+ 'sharding test execution between multiple machines)') |
(options, binaries) = parser.parse_args() |
@@ -288,15 +285,15 @@ if options.format == 'raw': |
elif options.format == 'filter': |
logger = FilterFormat() |
else: |
- sys.exit("Unknown output format: " + options.format) |
+ parser.error("Unknown output format: " + options.format) |
if options.shard_count < 1: |
- sys.exit("Invalid number of shards: %d. Must be at least 1." % |
- options.shard_count) |
-if options.shard_index < 0 or options.shard_count <= options.shard_index: |
- sys.exit("Invalid shard index: %d. Must be between 0 and %d." % |
- (options.shard_index, options.shard_count - 1)) |
- |
+ parser.error("Invalid number of shards: %d. Must be at least 1." % |
+ options.shard_count) |
+if not (0 <= options.shard_index < options.shard_count): |
+ parser.error("Invalid shard index: %d. Must be between 0 and %d " |
+ "(less than the number of shards)." % |
+ (options.shard_index, options.shard_count - 1)) |
# Find tests. |
save_file = os.path.join(os.path.expanduser("~"), ".gtest-parallel-times") |