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

Side by Side Diff: tools/testing/dart/test_options.dart

Issue 8566001: Implement test selection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 9 years, 1 month 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 | « tests/standalone/test_config.dart ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #library("test_options_parser"); 5 #library("test_options_parser");
6 6
7 List<String> defaultTestSelectors = const ['standalone', 'corelib'];
8
7 /** 9 /**
8 * Specification of a single test option. 10 * Specification of a single test option.
9 * 11 *
10 * The name of the specification is used as the key for the option in 12 * The name of the specification is used as the key for the option in
11 * the Map returned from the [TestOptionParser] parse method. 13 * the Map returned from the [TestOptionParser] parse method.
12 */ 14 */
13 class _TestOptionSpecification { 15 class _TestOptionSpecification {
14 _TestOptionSpecification(this.name, 16 _TestOptionSpecification(this.name,
15 this.description, 17 this.description,
16 this.keys, 18 this.keys,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 name = arg; 135 name = arg;
134 if ((i + 1) >= arguments.length) { 136 if ((i + 1) >= arguments.length) {
135 print('No value supplied for option $name'); 137 print('No value supplied for option $name');
136 return null; 138 return null;
137 } 139 }
138 value = arguments[++i]; 140 value = arguments[++i];
139 } else { 141 } else {
140 // The option name does not start with '-' or '--' so we 142 // The option name does not start with '-' or '--' so we
141 // assume that the rest of the arguments specify tests or test 143 // assume that the rest of the arguments specify tests or test
142 // suites to run. 144 // suites to run.
143 configuration['rest'] = arguments.getRange(i, numArguments - i); 145 configuration['patterns'] = arguments.getRange(i, numArguments - i);
144 return _expandConfigurations(configuration); 146 return _expandConfigurations(configuration);
145 } 147 }
146 // Find the option specification for the name. 148 // Find the option specification for the name.
147 var spec = _getSpecification(name); 149 var spec = _getSpecification(name);
148 if (spec == null) { 150 if (spec == null) {
149 print('Unknown test option $name'); 151 print('Unknown test option $name');
150 return null; 152 return null;
151 } 153 }
152 // Parse the value for the option. 154 // Parse the value for the option.
153 if (spec.type == 'bool') { 155 if (spec.type == 'bool') {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (configuration['architecture'] == 'all') { 190 if (configuration['architecture'] == 'all') {
189 configuration['architecture'] = 'ia32,x64,simarm'; 191 configuration['architecture'] = 'ia32,x64,simarm';
190 } 192 }
191 if (configuration['mode'] == 'all') { 193 if (configuration['mode'] == 'all') {
192 configuration['mode'] = 'debug,release'; 194 configuration['mode'] = 'debug,release';
193 } 195 }
194 if (configuration['component'] == 'most') { 196 if (configuration['component'] == 'most') {
195 configuration['component'] = 'vm,dartc'; 197 configuration['component'] = 'vm,dartc';
196 } 198 }
197 199
200 // Expand the test selectors into simple regular expressions to be
201 // used on the full path of a test file. If no selectors are
202 // explicitly given use the default suite patterns.
203 List patterns = configuration['patterns'];
204 if (patterns == null) {
205 patterns = new List.from(defaultTestSelectors);
206 }
207 for (var i = 0; i < patterns.length; i++) {
208 patterns[i] = patterns[i].replaceAll('*', '.*');
209 patterns[i] = patterns[i].replaceAll('/', '.*');
210 patterns[i] = new RegExp(patterns[i]);
211 }
212 configuration['patterns'] = patterns;
213
198 // Expand the architectures. 214 // Expand the architectures.
199 var archs = configuration['architecture']; 215 var archs = configuration['architecture'];
200 if (archs.contains(',')) { 216 if (archs.contains(',')) {
201 var result = new List<Map>(); 217 var result = new List<Map>();
202 for (var arch in archs.split(',')) { 218 for (var arch in archs.split(',')) {
203 var newConfiguration = new Map.from(configuration); 219 var newConfiguration = new Map.from(configuration);
204 newConfiguration['architecture'] = arch; 220 newConfiguration['architecture'] = arch;
205 result.addAll(_expandConfigurations(newConfiguration)); 221 result.addAll(_expandConfigurations(newConfiguration));
206 } 222 }
207 return result; 223 return result;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 if (option.keys.some((key) => key == name)) { 316 if (option.keys.some((key) => key == name)) {
301 return option; 317 return option;
302 } 318 }
303 } 319 }
304 return null; 320 return null;
305 } 321 }
306 322
307 323
308 List<_TestOptionSpecification> _options; 324 List<_TestOptionSpecification> _options;
309 } 325 }
OLDNEW
« no previous file with comments | « tests/standalone/test_config.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698