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