Add support for swarming.

Add support for swarming.

Adds command line arguments corresponding to GTEST_SHARD_INDEX and GTEST_TOTAL_SHARDS to permit sharding across multiple machines.
diff --git a/gtest-parallel b/gtest-parallel
index 4e80928..778a29a 100755
--- a/gtest-parallel
+++ b/gtest-parallel
@@ -265,7 +265,13 @@
 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')
+                  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()
 
@@ -279,7 +285,15 @@
 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:
+  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")
@@ -321,6 +335,8 @@
     tests.append((times.get_test_time(test_binary, test),
                   test_binary, test, command))
 
+tests = tests[options.shard_index::options.shard_count]
+
 if options.failed:
   # The first element of each entry is the runtime of the most recent
   # run if it was successful, or None if the test is new or the most