| 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 library test_options_parser; | 5 library test_options_parser; |
| 6 | 6 |
| 7 import "dart:io"; | 7 import "dart:io"; |
| 8 import "dart:math"; |
| 8 import "drt_updater.dart"; | 9 import "drt_updater.dart"; |
| 9 import "test_suite.dart"; | 10 import "test_suite.dart"; |
| 10 | 11 |
| 11 List<String> defaultTestSelectors = | 12 List<String> defaultTestSelectors = |
| 12 const ['dartc', 'samples', 'standalone', 'corelib', 'co19', 'language', | 13 const ['dartc', 'samples', 'standalone', 'corelib', 'co19', 'language', |
| 13 'isolate', 'vm', 'html', 'json', 'benchmark_smoke', | 14 'isolate', 'vm', 'html', 'json', 'benchmark_smoke', |
| 14 'utils', 'lib', 'pkg']; | 15 'utils', 'lib', 'pkg']; |
| 15 | 16 |
| 16 /** | 17 /** |
| 17 * Specification of a single test option. | 18 * Specification of a single test option. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 'Timeout in seconds', | 142 'Timeout in seconds', |
| 142 ['-t', '--timeout'], | 143 ['-t', '--timeout'], |
| 143 [], | 144 [], |
| 144 -1, | 145 -1, |
| 145 'int'), | 146 'int'), |
| 146 new _TestOptionSpecification( | 147 new _TestOptionSpecification( |
| 147 'progress', | 148 'progress', |
| 148 'Progress indication mode', | 149 'Progress indication mode', |
| 149 ['-p', '--progress'], | 150 ['-p', '--progress'], |
| 150 ['compact', 'color', 'line', 'verbose', | 151 ['compact', 'color', 'line', 'verbose', |
| 151 'silent', 'status', 'buildbot', 'diff'], | 152 'silent', 'status', 'buildbot'], |
| 152 'compact'), | 153 'compact'), |
| 153 new _TestOptionSpecification( | 154 new _TestOptionSpecification( |
| 154 'step_name', | 155 'step_name', |
| 155 'Step name for use by -pbuildbot', | 156 'Step name for use by -pbuildbot', |
| 156 ['--step_name'], | 157 ['--step_name'], |
| 157 [], | 158 [], |
| 158 null), | 159 null), |
| 159 new _TestOptionSpecification( | 160 new _TestOptionSpecification( |
| 160 'report', | 161 'report', |
| 161 'Print a summary report of the number of tests, by expectation', | 162 'Print a summary report of the number of tests, by expectation', |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 } | 361 } |
| 361 // Parse the value for the option. | 362 // Parse the value for the option. |
| 362 if (spec.type == 'bool') { | 363 if (spec.type == 'bool') { |
| 363 if (!value.isEmpty) { | 364 if (!value.isEmpty) { |
| 364 print('No value expected for bool option $name'); | 365 print('No value expected for bool option $name'); |
| 365 exit(1); | 366 exit(1); |
| 366 } | 367 } |
| 367 configuration[spec.name] = true; | 368 configuration[spec.name] = true; |
| 368 } else if (spec.type == 'int') { | 369 } else if (spec.type == 'int') { |
| 369 try { | 370 try { |
| 370 configuration[spec.name] = int.parse(value); | 371 configuration[spec.name] = parseInt(value); |
| 371 } catch (e) { | 372 } catch (e) { |
| 372 print('Integer value expected for int option $name'); | 373 print('Integer value expected for int option $name'); |
| 373 exit(1); | 374 exit(1); |
| 374 } | 375 } |
| 375 } else { | 376 } else { |
| 376 assert(spec.type == 'string'); | 377 assert(spec.type == 'string'); |
| 377 if (!spec.values.isEmpty) { | 378 if (!spec.values.isEmpty) { |
| 378 for (var v in value.split(',')) { | 379 for (var v in value.split(',')) { |
| 379 if (spec.values.lastIndexOf(v) == -1) { | 380 if (spec.values.lastIndexOf(v) == -1) { |
| 380 print('Unknown value ($v) for option $name'); | 381 print('Unknown value ($v) for option $name'); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 return option; | 669 return option; |
| 669 } | 670 } |
| 670 } | 671 } |
| 671 print('Unknown test option $name'); | 672 print('Unknown test option $name'); |
| 672 exit(1); | 673 exit(1); |
| 673 } | 674 } |
| 674 | 675 |
| 675 | 676 |
| 676 List<_TestOptionSpecification> _options; | 677 List<_TestOptionSpecification> _options; |
| 677 } | 678 } |
| OLD | NEW |