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

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

Issue 8835008: Correctly handle the --arch argument to dart test scripts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo Created 9 years 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 | « tools/testing/dart/multitest.dart ('k') | tools/testing/dart/test_runner.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) 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 = 7 List<String> defaultTestSelectors =
8 const ['dartc', 'samples', 'standalone', 'corelib', 'co19', 'language', 8 const ['dartc', 'samples', 'standalone', 'corelib', 'co19', 'language',
9 'isolate', 'stub-generator', 'vm']; 9 'isolate', 'stub-generator', 'vm'];
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 ['-m', '--mode'], 45 ['-m', '--mode'],
46 ['all', 'debug', 'release'], 46 ['all', 'debug', 'release'],
47 'debug'), 47 'debug'),
48 new _TestOptionSpecification( 48 new _TestOptionSpecification(
49 'component', 49 'component',
50 'The component to test against', 50 'The component to test against',
51 ['-c', '--component'], 51 ['-c', '--component'],
52 ['most', 'vm', 'dartc', 'frog', 'frogsh', 'leg'], 52 ['most', 'vm', 'dartc', 'frog', 'frogsh', 'leg'],
53 'vm'), 53 'vm'),
54 new _TestOptionSpecification( 54 new _TestOptionSpecification(
55 'architecture', 55 'arch',
56 'The architecture to run tests for', 56 'The architecture to run tests for',
57 ['-a', '--arch'], 57 ['-a', '--arch'],
58 ['all', 'ia32', 'x64', 'simarm'], 58 ['all', 'ia32', 'x64', 'simarm'],
59 'ia32'), 59 'ia32'),
60 new _TestOptionSpecification( 60 new _TestOptionSpecification(
61 'system', 61 'system',
62 'The operating system to run tests on', 62 'The operating system to run tests on',
63 ['-s', '--system'], 63 ['-s', '--system'],
64 ['linux', 'macos', 'windows'], 64 ['linux', 'macos', 'windows'],
65 new Platform().operatingSystem()), 65 new Platform().operatingSystem()),
(...skipping 30 matching lines...) Expand all
96 ['-j', '--tasks'], 96 ['-j', '--tasks'],
97 [], 97 [],
98 new Platform().numberOfProcessors(), 98 new Platform().numberOfProcessors(),
99 'int'), 99 'int'),
100 new _TestOptionSpecification( 100 new _TestOptionSpecification(
101 'help', 101 'help',
102 'Print list of options', 102 'Print list of options',
103 ['-h', '--help'], 103 ['-h', '--help'],
104 [], 104 [],
105 false, 105 false,
106 'bool'),
107 new _TestOptionSpecification(
108 'verbose',
109 'Verbose output',
110 ['-v', '--verbose'],
111 [],
112 false,
106 'bool')]; 113 'bool')];
107 } 114 }
108 115
109 116
110 /** 117 /**
111 * Parse a list of strings as test options. 118 * Parse a list of strings as test options.
112 * 119 *
113 * Returns a list of configurations in which to run the 120 * Returns a list of configurations in which to run the
114 * tests. Configurations are maps mapping from option keys to 121 * tests. Configurations are maps mapping from option keys to
115 * values. When encountering the first non-option string, the rest 122 * values. When encountering the first non-option string, the rest
(...skipping 29 matching lines...) Expand all
145 } else if (arg.startsWith('-')) { 152 } else if (arg.startsWith('-')) {
146 if (arg == '-h') { 153 if (arg == '-h') {
147 _printHelp(); 154 _printHelp();
148 return null; 155 return null;
149 } 156 }
150 if (arg.length > 2) { 157 if (arg.length > 2) {
151 name = arg.substring(0, 2); 158 name = arg.substring(0, 2);
152 value = arg.substring(2, arg.length); 159 value = arg.substring(2, arg.length);
153 } else { 160 } else {
154 name = arg; 161 name = arg;
155 if ((i + 1) >= arguments.length) { 162 // Boolean options do not have a value.
156 print('No value supplied for option $name'); 163 if (_getSpecification(name).type != 'bool') {
157 return null; 164 if ((i + 1) >= arguments.length) {
165 print('No value supplied for option $name');
166 return null;
167 }
168 value = arguments[++i];
158 } 169 }
159 value = arguments[++i];
160 } 170 }
161 } else { 171 } else {
162 // The argument does not start with '-' or '--' and is 172 // The argument does not start with '-' or '--' and is
163 // therefore not an option. We use it as a test selection 173 // therefore not an option. We use it as a test selection
164 // pattern. 174 // pattern.
165 configuration.putIfAbsent('selectors', () => []); 175 configuration.putIfAbsent('selectors', () => []);
166 var patterns = configuration['selectors']; 176 var patterns = configuration['selectors'];
167 patterns.add(arg); 177 patterns.add(arg);
168 continue; 178 continue;
169 } 179 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 List<Map> _expandConfigurations(Map configuration) { 220 List<Map> _expandConfigurations(Map configuration) {
211 221
212 // TODO(ager): Get rid of this. This is for backwards 222 // TODO(ager): Get rid of this. This is for backwards
213 // compatibility with the python test scripts. They use system 223 // compatibility with the python test scripts. They use system
214 // 'win32' for Windows. 224 // 'win32' for Windows.
215 if (configuration['system'] == 'windows') { 225 if (configuration['system'] == 'windows') {
216 configuration['system'] = 'win32'; 226 configuration['system'] = 'win32';
217 } 227 }
218 228
219 // Expand the pseudo-values such as 'all'. 229 // Expand the pseudo-values such as 'all'.
220 if (configuration['architecture'] == 'all') { 230 if (configuration['arch'] == 'all') {
221 configuration['architecture'] = 'ia32,x64,simarm'; 231 configuration['arch'] = 'ia32,x64,simarm';
222 } 232 }
223 if (configuration['mode'] == 'all') { 233 if (configuration['mode'] == 'all') {
224 configuration['mode'] = 'debug,release'; 234 configuration['mode'] = 'debug,release';
225 } 235 }
226 if (configuration['component'] == 'most') { 236 if (configuration['component'] == 'most') {
227 configuration['component'] = 'vm,dartc'; 237 configuration['component'] = 'vm,dartc';
228 } 238 }
229 239
240 // Use verbose progress indication for verbose output.
241 if (configuration['verbose']) {
242 configuration['progress'] = 'verbose';
243 }
244
230 // Create the artificial 'unchecked' option that test status files 245 // Create the artificial 'unchecked' option that test status files
231 // expect. 246 // expect.
232 configuration['unchecked'] = !configuration['checked']; 247 configuration['unchecked'] = !configuration['checked'];
233 248
234 // Expand the test selectors into a suite name and a simple 249 // Expand the test selectors into a suite name and a simple
235 // regular expressions to be used on the full path of a test file 250 // regular expressions to be used on the full path of a test file
236 // in that test suite. If no selectors are explicitly given use 251 // in that test suite. If no selectors are explicitly given use
237 // the default suite patterns. 252 // the default suite patterns.
238 var selectors = configuration['selectors']; 253 var selectors = configuration['selectors'];
239 if (selectors is !Map) { 254 if (selectors is !Map) {
(...skipping 16 matching lines...) Expand all
256 if (selectorMap.containsKey(suite)) { 271 if (selectorMap.containsKey(suite)) {
257 print("Warning: selector '$suite/$pattern' overrides " + 272 print("Warning: selector '$suite/$pattern' overrides " +
258 "previous selector for suite '$suite'"); 273 "previous selector for suite '$suite'");
259 } 274 }
260 selectorMap[suite] = new RegExp(pattern); 275 selectorMap[suite] = new RegExp(pattern);
261 } 276 }
262 configuration['selectors'] = selectorMap; 277 configuration['selectors'] = selectorMap;
263 } 278 }
264 279
265 // Expand the architectures. 280 // Expand the architectures.
266 var archs = configuration['architecture']; 281 var archs = configuration['arch'];
267 if (archs.contains(',')) { 282 if (archs.contains(',')) {
268 var result = new List<Map>(); 283 var result = new List<Map>();
269 for (var arch in archs.split(',')) { 284 for (var arch in archs.split(',')) {
270 var newConfiguration = new Map.from(configuration); 285 var newConfiguration = new Map.from(configuration);
271 newConfiguration['architecture'] = arch; 286 newConfiguration['arch'] = arch;
272 result.addAll(_expandConfigurations(newConfiguration)); 287 result.addAll(_expandConfigurations(newConfiguration));
273 } 288 }
274 return result; 289 return result;
275 } 290 }
276 291
277 // Expand modes. 292 // Expand modes.
278 var modes = configuration['mode']; 293 var modes = configuration['mode'];
279 if (modes.contains(',')) { 294 if (modes.contains(',')) {
280 var result = new List<Map>(); 295 var result = new List<Map>();
281 for (var mode in modes.split(',')) { 296 for (var mode in modes.split(',')) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 if (option.keys.some((key) => key == name)) { 382 if (option.keys.some((key) => key == name)) {
368 return option; 383 return option;
369 } 384 }
370 } 385 }
371 return null; 386 return null;
372 } 387 }
373 388
374 389
375 List<_TestOptionSpecification> _options; 390 List<_TestOptionSpecification> _options;
376 } 391 }
OLDNEW
« no previous file with comments | « tools/testing/dart/multitest.dart ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698