| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "drt_updater.dart"; | 8 import "drt_updater.dart"; |
| 9 import "test_suite.dart"; | 9 import "test_suite.dart"; |
| 10 import "compiler_configuration.dart" show CompilerConfiguration; | 10 import "compiler_configuration.dart" show CompilerConfiguration; |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 'test options. Used to be able to make sane updates to the ' | 397 'test options. Used to be able to make sane updates to the ' |
| 398 'status files.', | 398 'status files.', |
| 399 ['--builder-tag'], | 399 ['--builder-tag'], |
| 400 [], | 400 [], |
| 401 ''), | 401 ''), |
| 402 new _TestOptionSpecification( | 402 new _TestOptionSpecification( |
| 403 'vm_options', | 403 'vm_options', |
| 404 'Extra options to send to the vm when running', | 404 'Extra options to send to the vm when running', |
| 405 ['--vm-options'], | 405 ['--vm-options'], |
| 406 [], | 406 [], |
| 407 null), |
| 408 new _TestOptionSpecification( |
| 409 'exclude_suite', |
| 410 'Exclude suites from default selector, only works when no' |
| 411 ' selector has been specified on the command line', |
| 412 ['--exclude-suite'], |
| 413 defaultTestSelectors, |
| 407 null),]; | 414 null),]; |
| 408 } | 415 } |
| 409 | 416 |
| 410 | 417 |
| 411 /** | 418 /** |
| 412 * Parse a list of strings as test options. | 419 * Parse a list of strings as test options. |
| 413 * | 420 * |
| 414 * Returns a list of configurations in which to run the | 421 * Returns a list of configurations in which to run the |
| 415 * tests. Configurations are maps mapping from option keys to | 422 * tests. Configurations are maps mapping from option keys to |
| 416 * values. When encountering the first non-option string, the rest | 423 * values. When encountering the first non-option string, the rest |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 // Allow suppression that is valid for all ie versions | 676 // Allow suppression that is valid for all ie versions |
| 670 configuration['ie'] = runtime.startsWith('ie'); | 677 configuration['ie'] = runtime.startsWith('ie'); |
| 671 | 678 |
| 672 // Expand the test selectors into a suite name and a simple | 679 // Expand the test selectors into a suite name and a simple |
| 673 // regular expressions to be used on the full path of a test file | 680 // regular expressions to be used on the full path of a test file |
| 674 // in that test suite. If no selectors are explicitly given use | 681 // in that test suite. If no selectors are explicitly given use |
| 675 // the default suite patterns. | 682 // the default suite patterns. |
| 676 var selectors = configuration['selectors']; | 683 var selectors = configuration['selectors']; |
| 677 if (selectors is !Map) { | 684 if (selectors is !Map) { |
| 678 if (selectors == null) { | 685 if (selectors == null) { |
| 679 selectors = defaultTestSelectors; | 686 selectors = new List.from(defaultTestSelectors); |
| 687 var exclude_suites = configuration['exclude_suite'] != null ? |
| 688 configuration['exclude_suite'].split(',') : []; |
| 689 for (var exclude in exclude_suites) { |
| 690 if (selectors.contains(exclude)) { |
| 691 selectors.remove(exclude); |
| 692 } else { |
| 693 print("Error: default selectors does not contain $exclude"); |
| 694 exit(1); |
| 695 } |
| 696 } |
| 680 } | 697 } |
| 681 Map<String, RegExp> selectorMap = new Map<String, RegExp>(); | 698 Map<String, RegExp> selectorMap = new Map<String, RegExp>(); |
| 682 for (var i = 0; i < selectors.length; i++) { | 699 for (var i = 0; i < selectors.length; i++) { |
| 683 var pattern = selectors[i]; | 700 var pattern = selectors[i]; |
| 684 var suite = pattern; | 701 var suite = pattern; |
| 685 var slashLocation = pattern.indexOf('/'); | 702 var slashLocation = pattern.indexOf('/'); |
| 686 if (slashLocation != -1) { | 703 if (slashLocation != -1) { |
| 687 suite = pattern.substring(0, slashLocation); | 704 suite = pattern.substring(0, slashLocation); |
| 688 pattern = pattern.substring(slashLocation + 1); | 705 pattern = pattern.substring(slashLocation + 1); |
| 689 pattern = pattern.replaceAll('*', '.*'); | 706 pattern = pattern.replaceAll('*', '.*'); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 return option; | 827 return option; |
| 811 } | 828 } |
| 812 } | 829 } |
| 813 print('Unknown test option $name'); | 830 print('Unknown test option $name'); |
| 814 exit(1); | 831 exit(1); |
| 815 } | 832 } |
| 816 | 833 |
| 817 | 834 |
| 818 List<_TestOptionSpecification> _options; | 835 List<_TestOptionSpecification> _options; |
| 819 } | 836 } |
| OLD | NEW |