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

Unified Diff: lib/src/runner/configuration/args.dart

Issue 1890853003: Add support for sharding test runs. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 8 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 | « lib/src/runner/configuration.dart ('k') | test/runner/configuration/configuration_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/configuration/args.dart
diff --git a/lib/src/runner/configuration/args.dart b/lib/src/runner/configuration/args.dart
index 38a200d3a68f8530bd57f6c01aa56ba04be6191c..3f6b66f48d1e51bcab2809ca7cfc7272af5dcdfa 100644
--- a/lib/src/runner/configuration/args.dart
+++ b/lib/src/runner/configuration/args.dart
@@ -85,6 +85,12 @@ final ArgParser _parser = (() {
'Currently only supported for browser tests.',
negatable: false);
+ // These are used by the internal Google test runner, so they're hidden from
+ // the --help output but still supported as stable API surface. See
+ // [Configuration.shardIndex] for details on their semantics.
+ parser.addOption("shard-index", hide: true);
+ parser.addOption("total-shards", hide: true);
+
parser.addSeparator("======== Output");
parser.addOption("reporter",
abbr: 'r',
@@ -146,6 +152,20 @@ class _Parser {
return selector.union(tagSelector);
});
+ var shardIndex = _parseOption('shard-index', int.parse);
+ var totalShards = _parseOption('total-shards', int.parse);
+ if ((shardIndex == null) != (totalShards == null)) {
+ throw new FormatException(
+ "--shard-index and --total-shards may only be passed together.");
+ } else if (shardIndex != null) {
+ if (shardIndex < 0) {
+ throw new FormatException("--shard-index may not be negative.");
+ } else if (shardIndex >= totalShards) {
+ throw new FormatException(
+ "--shard-index must be less than --total-shards.");
+ }
+ }
+
return new Configuration(
help: _ifParsed('help'),
version: _ifParsed('version'),
@@ -157,6 +177,8 @@ class _Parser {
reporter: _ifParsed('reporter'),
pubServePort: _parseOption('pub-serve', int.parse),
concurrency: _parseOption('concurrency', int.parse),
+ shardIndex: shardIndex,
+ totalShards: totalShards,
timeout: _parseOption('timeout', (value) => new Timeout.parse(value)),
patterns: patterns,
platforms: _ifParsed('platform')?.map(TestPlatform.find),
« no previous file with comments | « lib/src/runner/configuration.dart ('k') | test/runner/configuration/configuration_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698