OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** Create and return an options parser for the test runner. */ | 5 /** Create and return an options parser for the test runner. */ |
6 ArgParser getOptionParser() { | 6 ArgParser getOptionParser() { |
7 var parser = new ArgParser(); | 7 var parser = new ArgParser(); |
8 | 8 |
9 parser.addOption('help', abbr: '?', | 9 parser.addOption('help', abbr: '?', |
10 help: 'Show usage information.'); | 10 help: 'Show usage information.'); |
11 | 11 |
12 parser.addOption('runtime', abbr: 'r', defaultsTo: 'vm', | 12 parser.addOption('runtime', abbr: 'r', defaultsTo: 'vm', |
13 help: 'Where the tests should be run.', | 13 help: 'Where the tests should be run.', |
14 allowed: ['vm', 'drt-dart', 'drt-js'], | 14 allowed: ['vm', 'drt-dart', 'drt-js'], |
15 allowedHelp: { | 15 allowedHelp: { |
16 'vm': 'Run Dart code natively on the standalone dart vm.', | 16 'vm': 'Run Dart code natively on the standalone dart vm.', |
17 'drt-dart': 'Run Dart code natively in the headless version of\n' | 17 'drt-dart': 'Run Dart code natively in the headless version of\n' |
18 'Chrome, DumpRenderTree.', | 18 'Chrome, DumpRenderTree.', |
19 'drt-js': 'Run Dart compiled to JavaScript in the headless version\n' | 19 'drt-js': 'Run Dart compiled to JavaScript in the headless version\n' |
20 'of Chrome, DumpRenderTree.' | 20 'of Chrome, DumpRenderTree.' |
21 }); | 21 }); |
22 | 22 |
23 parser.addFlag('checked', defaultsTo: false, | 23 parser.addFlag('checked', defaultsTo: false, |
24 help: 'Run tests in checked mode.'); | 24 help: 'Run tests in checked mode.'); |
25 | 25 |
| 26 parser.addFlag('layout', defaultsTo: false, |
| 27 help: 'Run layout tests.'); |
| 28 |
26 parser.addOption('timeout', abbr: 't', | 29 parser.addOption('timeout', abbr: 't', |
27 help: 'Timeout in seconds', defaultsTo: '60'); | 30 help: 'Timeout in seconds', defaultsTo: '60'); |
28 | 31 |
29 parser.addOption('tasks', abbr: 'j', | 32 parser.addOption('tasks', abbr: 'j', |
30 defaultsTo: Platform.numberOfProcessors.toString(), | 33 defaultsTo: Platform.numberOfProcessors.toString(), |
31 help: 'The number of parallel tasks to run.'); | 34 help: 'The number of parallel tasks to run.'); |
32 | 35 |
33 parser.addOption('out', abbr: 'o', defaultsTo: 'stdout', | 36 parser.addOption('out', abbr: 'o', defaultsTo: 'stdout', |
34 help: 'File to send test results. This should be a ' | 37 help: 'File to send test results. This should be a ' |
35 'file name or one of stdout, stderr, or none.'); | 38 'file name or one of stdout, stderr, or none.'); |
36 | 39 |
37 parser.addOption('list-format', | 40 parser.addOption('list-format', |
38 defaultsTo: '${Macros.testfile}${Macros.testGroup}${Macros.testDescription
}', | 41 defaultsTo: |
| 42 '${Macros.testfile}${Macros.testGroup}${Macros.testDescription}', |
39 help: 'Format for test list result output.'); | 43 help: 'Format for test list result output.'); |
40 | 44 |
41 parser.addOption('pass-format', | 45 parser.addOption('pass-format', |
42 defaultsTo: 'PASS ${Macros.testTime}' | 46 defaultsTo: 'PASS ${Macros.testTime}' |
43 '${Macros.testfile}${Macros.testGroup}' | 47 '${Macros.testfile}${Macros.testGroup}' |
44 '${Macros.testDescription}${Macros.testMessage}', | 48 '${Macros.testDescription}${Macros.testMessage}', |
45 help: 'Format for passing test result output.'); | 49 help: 'Format for passing test result output.'); |
46 | 50 |
47 parser.addOption('fail-format', | 51 parser.addOption('fail-format', |
48 defaultsTo: 'FAIL ${Macros.testTime}' | 52 defaultsTo: 'FAIL ${Macros.testTime}' |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 parser.addFlag('recurse', abbr: 'R', | 130 parser.addFlag('recurse', abbr: 'R', |
127 help: 'Recurse through child directories looking for tests.', | 131 help: 'Recurse through child directories looking for tests.', |
128 defaultsTo: false); | 132 defaultsTo: false); |
129 | 133 |
130 parser.addFlag('immediate', | 134 parser.addFlag('immediate', |
131 help: 'Print test results immediately, instead of at the end of a test ' | 135 help: 'Print test results immediately, instead of at the end of a test ' |
132 'file. Note that in some async cases this may result in multiple ' | 136 'file. Note that in some async cases this may result in multiple ' |
133 'messages for a single test.', | 137 'messages for a single test.', |
134 defaultsTo: false); | 138 defaultsTo: false); |
135 | 139 |
| 140 parser.addFlag('generate-renders', |
| 141 help: 'Generate .render files for layout tests.', |
| 142 defaultsTo: false); |
| 143 |
136 parser.addOption('unittest', help: '#import path for unit test library.'); | 144 parser.addOption('unittest', help: '#import path for unit test library.'); |
137 | 145 |
138 return parser; | 146 return parser; |
139 } | 147 } |
140 | 148 |
141 /** Print a value option, quoting it if it has embedded spaces. */ | 149 /** Print a value option, quoting it if it has embedded spaces. */ |
142 _printValueOption(String name, value, OutputStream stream) { | 150 _printValueOption(String name, value, OutputStream stream) { |
143 if (value.indexOf(' ') >= 0) { | 151 if (value.indexOf(' ') >= 0) { |
144 stream.writeString("--$name='$value'\n"); | 152 stream.writeString("--$name='$value'\n"); |
145 } else { | 153 } else { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 239 } |
232 if (config['unittest'] == null) { | 240 if (config['unittest'] == null) { |
233 print('Missing required option --unittest'); | 241 print('Missing required option --unittest'); |
234 return false; | 242 return false; |
235 } | 243 } |
236 if (config['include'].length > 0 && | 244 if (config['include'].length > 0 && |
237 config['exclude'].length > 0) { | 245 config['exclude'].length > 0) { |
238 print('--include and --exclude are mutually exclusive.'); | 246 print('--include and --exclude are mutually exclusive.'); |
239 return false; | 247 return false; |
240 } | 248 } |
| 249 if (config['layout'] && config['runtime'] == 'vm') { |
| 250 print('Layout tests must use --runtime values of "drt-dart" or "drt-js"'); |
| 251 return false; |
| 252 } |
241 return true; | 253 return true; |
242 } | 254 } |
243 | 255 |
244 | 256 |
OLD | NEW |