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

Side by Side Diff: lib/src/runner/configuration/args.dart

Issue 1782473005: Add support for configuration presets. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 9 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
« no previous file with comments | « lib/src/runner/configuration.dart ('k') | lib/src/runner/configuration/load.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:io'; 5 import 'dart:io';
6 6
7 import 'package:args/args.dart'; 7 import 'package:args/args.dart';
8 import 'package:boolean_selector/boolean_selector.dart'; 8 import 'package:boolean_selector/boolean_selector.dart';
9 9
10 import '../../backend/test_platform.dart'; 10 import '../../backend/test_platform.dart';
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 allowMultiple: true); 53 allowMultiple: true);
54 parser.addOption("exclude-tag", hide: true, allowMultiple: true); 54 parser.addOption("exclude-tag", hide: true, allowMultiple: true);
55 55
56 parser.addSeparator("======== Running Tests"); 56 parser.addSeparator("======== Running Tests");
57 parser.addOption("platform", 57 parser.addOption("platform",
58 abbr: 'p', 58 abbr: 'p',
59 help: 'The platform(s) on which to run the tests.', 59 help: 'The platform(s) on which to run the tests.',
60 defaultsTo: 'vm', 60 defaultsTo: 'vm',
61 allowed: allPlatforms.map((platform) => platform.identifier).toList(), 61 allowed: allPlatforms.map((platform) => platform.identifier).toList(),
62 allowMultiple: true); 62 allowMultiple: true);
63 parser.addOption("preset",
64 abbr: 'P',
65 help: 'The configuration preset(s) to use.',
66 allowMultiple: true);
63 parser.addOption("concurrency", 67 parser.addOption("concurrency",
64 abbr: 'j', 68 abbr: 'j',
65 help: 'The number of concurrent test suites run.', 69 help: 'The number of concurrent test suites run.',
66 defaultsTo: defaultConcurrency.toString(), 70 defaultsTo: defaultConcurrency.toString(),
67 valueHelp: 'threads'); 71 valueHelp: 'threads');
68 parser.addOption("pub-serve", 72 parser.addOption("pub-serve",
69 help: 'The port of a pub serve instance serving "test/".', 73 help: 'The port of a pub serve instance serving "test/".',
70 valueHelp: 'port'); 74 valueHelp: 'port');
71 parser.addOption("timeout", 75 parser.addOption("timeout",
72 help: 'The default test timeout. For example: 15s, 2x, none', 76 help: 'The default test timeout. For example: 15s, 2x, none',
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 pauseAfterLoad: ifParsed('pause-after-load'), 153 pauseAfterLoad: ifParsed('pause-after-load'),
150 color: ifParsed('color'), 154 color: ifParsed('color'),
151 packageRoot: ifParsed('package-root'), 155 packageRoot: ifParsed('package-root'),
152 reporter: ifParsed('reporter'), 156 reporter: ifParsed('reporter'),
153 pubServePort: _wrapFormatException(options, 'pub-serve', int.parse), 157 pubServePort: _wrapFormatException(options, 'pub-serve', int.parse),
154 concurrency: _wrapFormatException(options, 'concurrency', int.parse), 158 concurrency: _wrapFormatException(options, 'concurrency', int.parse),
155 timeout: _wrapFormatException(options, 'timeout', 159 timeout: _wrapFormatException(options, 'timeout',
156 (value) => new Timeout.parse(value)), 160 (value) => new Timeout.parse(value)),
157 pattern: pattern, 161 pattern: pattern,
158 platforms: ifParsed('platform')?.map(TestPlatform.find), 162 platforms: ifParsed('platform')?.map(TestPlatform.find),
163 chosenPresets: ifParsed('preset'),
159 paths: options.rest.isEmpty ? null : options.rest, 164 paths: options.rest.isEmpty ? null : options.rest,
160 includeTags: includeTags, 165 includeTags: includeTags,
161 excludeTags: excludeTags); 166 excludeTags: excludeTags);
162 } 167 }
163 168
164 /// Runs [parse] on the value of the option [name], and wraps any 169 /// Runs [parse] on the value of the option [name], and wraps any
165 /// [FormatException] it throws with additional information. 170 /// [FormatException] it throws with additional information.
166 _wrapFormatException(ArgResults options, String name, parse(value)) { 171 _wrapFormatException(ArgResults options, String name, parse(value)) {
167 if (!options.wasParsed(name)) return null; 172 if (!options.wasParsed(name)) return null;
168 173
169 var value = options[name]; 174 var value = options[name];
170 if (value == null) return null; 175 if (value == null) return null;
171 176
172 try { 177 try {
173 return parse(value); 178 return parse(value);
174 } on FormatException catch (error) { 179 } on FormatException catch (error) {
175 throw new FormatException('Couldn\'t parse --$name "${options[name]}": ' 180 throw new FormatException('Couldn\'t parse --$name "${options[name]}": '
176 '${error.message}'); 181 '${error.message}');
177 } 182 }
178 } 183 }
OLDNEW
« no previous file with comments | « lib/src/runner/configuration.dart ('k') | lib/src/runner/configuration/load.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698