| 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, | 26 parser.addFlag('layout-text', defaultsTo: false, |
| 27 help: 'Run layout tests.'); | 27 help: 'Run text layout tests.'); |
| 28 |
| 29 parser.addFlag('layout-pixel', defaultsTo: false, |
| 30 help: 'Run pixel layout tests.'); |
| 28 | 31 |
| 29 parser.addOption('timeout', abbr: 't', | 32 parser.addOption('timeout', abbr: 't', |
| 30 help: 'Timeout in seconds', defaultsTo: '60'); | 33 help: 'Timeout in seconds', defaultsTo: '60'); |
| 31 | 34 |
| 32 parser.addOption('tasks', abbr: 'j', | 35 parser.addOption('tasks', abbr: 'j', |
| 33 defaultsTo: Platform.numberOfProcessors.toString(), | 36 defaultsTo: Platform.numberOfProcessors.toString(), |
| 34 help: 'The number of parallel tasks to run.'); | 37 help: 'The number of parallel tasks to run.'); |
| 35 | 38 |
| 36 parser.addOption('out', abbr: 'o', defaultsTo: 'stdout', | 39 parser.addOption('out', abbr: 'o', defaultsTo: 'stdout', |
| 37 help: 'File to send test results. This should be a ' | 40 help: 'File to send test results. This should be a ' |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 parser.addFlag('recurse', abbr: 'R', | 133 parser.addFlag('recurse', abbr: 'R', |
| 131 help: 'Recurse through child directories looking for tests.', | 134 help: 'Recurse through child directories looking for tests.', |
| 132 defaultsTo: false); | 135 defaultsTo: false); |
| 133 | 136 |
| 134 parser.addFlag('immediate', | 137 parser.addFlag('immediate', |
| 135 help: 'Print test results immediately, instead of at the end of a test ' | 138 help: 'Print test results immediately, instead of at the end of a test ' |
| 136 'file. Note that in some async cases this may result in multiple ' | 139 'file. Note that in some async cases this may result in multiple ' |
| 137 'messages for a single test.', | 140 'messages for a single test.', |
| 138 defaultsTo: false); | 141 defaultsTo: false); |
| 139 | 142 |
| 140 parser.addFlag('generate-renders', | 143 parser.addFlag('regenerate', |
| 141 help: 'Generate .render files for layout tests.', | 144 help: 'Regenerate layout test expectation files.', |
| 142 defaultsTo: false); | 145 defaultsTo: false); |
| 143 | 146 |
| 144 parser.addOption('unittest', help: '#import path for unit test library.'); | 147 parser.addOption('unittest', help: '#import path for unit test library.'); |
| 145 | 148 |
| 146 return parser; | 149 return parser; |
| 147 } | 150 } |
| 148 | 151 |
| 149 /** Print a value option, quoting it if it has embedded spaces. */ | 152 /** Print a value option, quoting it if it has embedded spaces. */ |
| 150 _printValueOption(String name, value, OutputStream stream) { | 153 _printValueOption(String name, value, OutputStream stream) { |
| 151 if (value.indexOf(' ') >= 0) { | 154 if (value.indexOf(' ') >= 0) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 242 } |
| 240 if (config['unittest'] == null) { | 243 if (config['unittest'] == null) { |
| 241 print('Missing required option --unittest'); | 244 print('Missing required option --unittest'); |
| 242 return false; | 245 return false; |
| 243 } | 246 } |
| 244 if (config['include'].length > 0 && | 247 if (config['include'].length > 0 && |
| 245 config['exclude'].length > 0) { | 248 config['exclude'].length > 0) { |
| 246 print('--include and --exclude are mutually exclusive.'); | 249 print('--include and --exclude are mutually exclusive.'); |
| 247 return false; | 250 return false; |
| 248 } | 251 } |
| 249 if (config['layout'] && config['runtime'] == 'vm') { | 252 if ((config['layout-text'] || config['layout-pixel']) && |
| 253 config['runtime'] == 'vm') { |
| 250 print('Layout tests must use --runtime values of "drt-dart" or "drt-js"'); | 254 print('Layout tests must use --runtime values of "drt-dart" or "drt-js"'); |
| 251 return false; | 255 return false; |
| 252 } | 256 } |
| 253 return true; | 257 return true; |
| 254 } | 258 } |
| 255 | 259 |
| 256 | 260 |
| OLD | NEW |