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

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

Issue 9110031: Enable webdriver component in test.dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/testing/dart/test_runner.dart » ('j') | tools/testing/dart/test_suite.dart » ('J')
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', 'client']; 9 'isolate', 'stub-generator', 'vm', 'client'];
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 'mode', 55 'mode',
56 'Mode in which to run the tests', 56 'Mode in which to run the tests',
57 ['-m', '--mode'], 57 ['-m', '--mode'],
58 ['all', 'debug', 'release'], 58 ['all', 'debug', 'release'],
59 'debug'), 59 'debug'),
60 new _TestOptionSpecification( 60 new _TestOptionSpecification(
61 'component', 61 'component',
62 'The component to test against', 62 'The component to test against',
63 ['-c', '--component'], 63 ['-c', '--component'],
64 ['most', 'vm', 'dartc', 'frog', 'frogsh', 'leg', 64 ['most', 'vm', 'dartc', 'frog', 'frogsh', 'leg',
65 'dartium', 'chromium', 'frogium'], 65 'dartium', 'chromium', 'frogium', 'webdriver'],
66 'vm'), 66 'vm'),
67 new _TestOptionSpecification( 67 new _TestOptionSpecification(
68 'arch', 68 'arch',
69 'The architecture to run tests for', 69 'The architecture to run tests for',
70 ['-a', '--arch'], 70 ['-a', '--arch'],
71 ['all', 'ia32', 'x64', 'simarm'], 71 ['all', 'ia32', 'x64', 'simarm'],
72 'ia32'), 72 'ia32'),
73 new _TestOptionSpecification( 73 new _TestOptionSpecification(
74 'system', 74 'system',
75 'The operating system to run tests on', 75 'The operating system to run tests on',
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 specialCommandHelp, 143 specialCommandHelp,
144 ['--special-command'], 144 ['--special-command'],
145 [], 145 [],
146 ''), 146 ''),
147 new _TestOptionSpecification( 147 new _TestOptionSpecification(
148 'time', 148 'time',
149 'Print timing information after running tests', 149 'Print timing information after running tests',
150 ['--time'], 150 ['--time'],
151 [], 151 [],
152 false, 152 false,
153 'bool')]; 153 'bool'),
154 new _TestOptionSpecification(
155 'flag',
156 'Component-specific extra flags, comma separated',
157 ['--flag'],
158 [],
159 '')];
154 } 160 }
155 161
156 162
157 /** 163 /**
158 * Parse a list of strings as test options. 164 * Parse a list of strings as test options.
159 * 165 *
160 * Returns a list of configurations in which to run the 166 * Returns a list of configurations in which to run the
161 * tests. Configurations are maps mapping from option keys to 167 * tests. Configurations are maps mapping from option keys to
162 * values. When encountering the first non-option string, the rest 168 * values. When encountering the first non-option string, the rest
163 * of the arguments are stored in the returned Map under the 'rest' 169 * of the arguments are stored in the returned Map under the 'rest'
(...skipping 10 matching lines...) Expand all
174 for (var i = 0; i < numArguments; i++) { 180 for (var i = 0; i < numArguments; i++) {
175 // Extract name and value for options. 181 // Extract name and value for options.
176 var arg = arguments[i]; 182 var arg = arguments[i];
177 var name = ''; 183 var name = '';
178 var value = ''; 184 var value = '';
179 if (arg.startsWith('--')) { 185 if (arg.startsWith('--')) {
180 if (arg == '--help') { 186 if (arg == '--help') {
181 _printHelp(); 187 _printHelp();
182 return null; 188 return null;
183 } 189 }
184 var split = arg.lastIndexOf('='); 190 var split = arg.indexOf('=');
185 if (split == -1) { 191 if (split == -1) {
186 name = arg; 192 name = arg;
187 // Boolean options do not have a value. 193 // Boolean options do not have a value.
188 if (_getSpecification(name).type != 'bool') { 194 if (_getSpecification(name).type != 'bool') {
189 if ((i + 1) >= arguments.length) { 195 if ((i + 1) >= arguments.length) {
190 print('No value supplied for option $name'); 196 print('No value supplied for option $name');
191 return null; 197 return null;
192 } 198 }
193 value = arguments[++i]; 199 value = arguments[++i];
194 } 200 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 configuration[spec.name] = true; 245 configuration[spec.name] = true;
240 } else if (spec.type == 'int') { 246 } else if (spec.type == 'int') {
241 try { 247 try {
242 configuration[spec.name] = Math.parseInt(value); 248 configuration[spec.name] = Math.parseInt(value);
243 } catch (var e) { 249 } catch (var e) {
244 print('Integer value expected for int option $name'); 250 print('Integer value expected for int option $name');
245 exit(1); 251 exit(1);
246 } 252 }
247 } else { 253 } else {
248 assert(spec.type == 'string'); 254 assert(spec.type == 'string');
249 for (var v in value.split(',')) { 255 if (!spec.values.isEmpty()) {
250 if (spec.values.lastIndexOf(v) == -1) { 256 for (var v in value.split(',')) {
251 print('Unknown value ($v) for option $name'); 257 if (spec.values.lastIndexOf(v) == -1) {
252 exit(1); 258 print('Unknown value ($v) for option $name');
259 exit(1);
260 }
253 } 261 }
254 } 262 }
255 configuration[spec.name] = value; 263 configuration[spec.name] = value;
256 } 264 }
257 } 265 }
258 266
259 return _expandConfigurations(configuration); 267 return _expandConfigurations(configuration);
260 } 268 }
261 269
262 270
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 if (option.keys.some((key) => key == name)) { 448 if (option.keys.some((key) => key == name)) {
441 return option; 449 return option;
442 } 450 }
443 } 451 }
444 return null; 452 return null;
445 } 453 }
446 454
447 455
448 List<_TestOptionSpecification> _options; 456 List<_TestOptionSpecification> _options;
449 } 457 }
OLDNEW
« no previous file with comments | « no previous file | tools/testing/dart/test_runner.dart » ('j') | tools/testing/dart/test_suite.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698