| 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', 'pub', 'lib', 'pkg']; | 15 'utils', 'pub', 'lib', 'pkg']; |
| 15 | 16 |
| 16 /** | 17 /** |
| 17 * Specification of a single test option. | 18 * Specification of a single test option. |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 } | 332 } |
| 332 // Parse the value for the option. | 333 // Parse the value for the option. |
| 333 if (spec.type == 'bool') { | 334 if (spec.type == 'bool') { |
| 334 if (!value.isEmpty()) { | 335 if (!value.isEmpty()) { |
| 335 print('No value expected for bool option $name'); | 336 print('No value expected for bool option $name'); |
| 336 exit(1); | 337 exit(1); |
| 337 } | 338 } |
| 338 configuration[spec.name] = true; | 339 configuration[spec.name] = true; |
| 339 } else if (spec.type == 'int') { | 340 } else if (spec.type == 'int') { |
| 340 try { | 341 try { |
| 341 configuration[spec.name] = Math.parseInt(value); | 342 configuration[spec.name] = parseInt(value); |
| 342 } catch (var e) { | 343 } catch (var e) { |
| 343 print('Integer value expected for int option $name'); | 344 print('Integer value expected for int option $name'); |
| 344 exit(1); | 345 exit(1); |
| 345 } | 346 } |
| 346 } else { | 347 } else { |
| 347 assert(spec.type == 'string'); | 348 assert(spec.type == 'string'); |
| 348 if (!spec.values.isEmpty()) { | 349 if (!spec.values.isEmpty()) { |
| 349 for (var v in value.split(',')) { | 350 for (var v in value.split(',')) { |
| 350 if (spec.values.lastIndexOf(v) == -1) { | 351 if (spec.values.lastIndexOf(v) == -1) { |
| 351 print('Unknown value ($v) for option $name'); | 352 print('Unknown value ($v) for option $name'); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 return option; | 627 return option; |
| 627 } | 628 } |
| 628 } | 629 } |
| 629 print('Unknown test option $name'); | 630 print('Unknown test option $name'); |
| 630 exit(1); | 631 exit(1); |
| 631 } | 632 } |
| 632 | 633 |
| 633 | 634 |
| 634 List<_TestOptionSpecification> _options; | 635 List<_TestOptionSpecification> _options; |
| 635 } | 636 } |
| OLD | NEW |