| OLD | NEW |
| 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 ['samples', 'standalone', 'corelib', 'co19', 'language', | 8 const ['samples', 'standalone', 'corelib', 'co19', 'language', |
| 9 'isolate', 'stub-generator', 'vm']; | 9 'isolate', 'stub-generator', 'vm']; |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 [ new _TestOptionSpecification( | 42 [ new _TestOptionSpecification( |
| 43 'mode', | 43 'mode', |
| 44 'Mode in which to run the tests', | 44 'Mode in which to run the tests', |
| 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 'chromium', 'dartium', 'frogium', 'webdriver'], | |
| 54 'vm'), | 53 'vm'), |
| 55 new _TestOptionSpecification( | 54 new _TestOptionSpecification( |
| 56 'architecture', | 55 'architecture', |
| 57 'The architecture to run tests for', | 56 'The architecture to run tests for', |
| 58 ['-a', '--arch'], | 57 ['-a', '--arch'], |
| 59 ['all', 'ia32', 'x64', 'simarm'], | 58 ['all', 'ia32', 'x64', 'simarm'], |
| 60 'ia32'), | 59 'ia32'), |
| 61 new _TestOptionSpecification( | 60 new _TestOptionSpecification( |
| 62 'system', | 61 'system', |
| 63 'The operating system to run tests on', | 62 'The operating system to run tests on', |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // pattern. | 164 // pattern. |
| 166 configuration.putIfAbsent('selectors', () => []); | 165 configuration.putIfAbsent('selectors', () => []); |
| 167 var patterns = configuration['selectors']; | 166 var patterns = configuration['selectors']; |
| 168 patterns.add(arg); | 167 patterns.add(arg); |
| 169 continue; | 168 continue; |
| 170 } | 169 } |
| 171 // Find the option specification for the name. | 170 // Find the option specification for the name. |
| 172 var spec = _getSpecification(name); | 171 var spec = _getSpecification(name); |
| 173 if (spec == null) { | 172 if (spec == null) { |
| 174 print('Unknown test option $name'); | 173 print('Unknown test option $name'); |
| 175 return null; | 174 exit(1); |
| 176 } | 175 } |
| 177 // Parse the value for the option. | 176 // Parse the value for the option. |
| 178 if (spec.type == 'bool') { | 177 if (spec.type == 'bool') { |
| 179 if (!value.isEmpty()) { | 178 if (!value.isEmpty()) { |
| 180 print('No value expected for bool option $name'); | 179 print('No value expected for bool option $name'); |
| 181 return null; | 180 exit(1); |
| 182 } | 181 } |
| 183 configuration[spec.name] = true; | 182 configuration[spec.name] = true; |
| 184 } else if (spec.type == 'int') { | 183 } else if (spec.type == 'int') { |
| 185 try { | 184 try { |
| 186 configuration[spec.name] = Math.parseInt(value); | 185 configuration[spec.name] = Math.parseInt(value); |
| 187 } catch (var e) { | 186 } catch (var e) { |
| 188 print('Integer value expected for int option $name'); | 187 print('Integer value expected for int option $name'); |
| 189 return null; | 188 exit(1); |
| 190 } | 189 } |
| 191 } else { | 190 } else { |
| 192 assert(spec.type == 'string'); | 191 assert(spec.type == 'string'); |
| 193 for (var v in value.split(',')) { | 192 for (var v in value.split(',')) { |
| 194 if (spec.values.lastIndexOf(v) == -1) { | 193 if (spec.values.lastIndexOf(v) == -1) { |
| 195 print('Unknown value ($v) for option $name'); | 194 print('Unknown value ($v) for option $name'); |
| 196 return null; | 195 exit(1); |
| 197 } | 196 } |
| 198 } | 197 } |
| 199 configuration[spec.name] = value; | 198 configuration[spec.name] = value; |
| 200 } | 199 } |
| 201 } | 200 } |
| 202 | 201 |
| 203 return _expandConfigurations(configuration); | 202 return _expandConfigurations(configuration); |
| 204 } | 203 } |
| 205 | 204 |
| 206 | 205 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 if (option.keys.some((key) => key == name)) { | 365 if (option.keys.some((key) => key == name)) { |
| 367 return option; | 366 return option; |
| 368 } | 367 } |
| 369 } | 368 } |
| 370 return null; | 369 return null; |
| 371 } | 370 } |
| 372 | 371 |
| 373 | 372 |
| 374 List<_TestOptionSpecification> _options; | 373 List<_TestOptionSpecification> _options; |
| 375 } | 374 } |
| OLD | NEW |