| 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 "path.dart"; | 10 import "path.dart"; |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 if (selectorMap.containsKey(suite)) { | 801 if (selectorMap.containsKey(suite)) { |
| 802 print("Error: '$suite/$pattern'. Only one test selection" | 802 print("Error: '$suite/$pattern'. Only one test selection" |
| 803 " pattern is allowed to start with '$suite/'"); | 803 " pattern is allowed to start with '$suite/'"); |
| 804 exit(1); | 804 exit(1); |
| 805 } | 805 } |
| 806 selectorMap[suite] = new RegExp(pattern); | 806 selectorMap[suite] = new RegExp(pattern); |
| 807 } | 807 } |
| 808 configuration['selectors'] = selectorMap; | 808 configuration['selectors'] = selectorMap; |
| 809 } | 809 } |
| 810 | 810 |
| 811 // Put observatory_ui in a configuration with its own packages override. |
| 812 // Only one value in the configuration map is mutable: |
| 813 selectors = configuration['selectors']; |
| 814 if (selectors.containsKey('observatory_ui')) { |
| 815 if (selectors.length == 1) { |
| 816 configuration['packages'] = TestUtils.dartDirUri |
| 817 .resolve('runtime/observatory/.packages').toFilePath(); |
| 818 } else { |
| 819 // Make a new configuration whose selectors map only contains |
| 820 // observatory_ui, and remove the key from the original selectors. |
| 821 // The only mutable value in the map is the selectors, so a |
| 822 // shallow copy is safe. |
| 823 var observatoryConfiguration = new Map.from(configuration); |
| 824 observatoryConfiguration['selectors'] = |
| 825 {'observatory_ui': selectors['observatory_ui']}; |
| 826 selectors.remove('observatory_ui'); |
| 827 |
| 828 // Set the packages flag. |
| 829 observatoryConfiguration['packages'] = TestUtils.dartDirUri |
| 830 .resolve('runtime/observatory/.packages').toFilePath(); |
| 831 |
| 832 // Return the expansions of both configurations. Neither will reach |
| 833 // this line in the recursive call to _expandConfigurations. |
| 834 return _expandConfigurations(configuration) |
| 835 ..addAll(_expandConfigurations(observatoryConfiguration)); |
| 836 } |
| 837 } |
| 838 // Set the default package spec explicitly. |
| 839 if (configuration['package_root'] == null && |
| 840 configuration['packages'] == null) { |
| 841 configuration['packages'] = |
| 842 TestUtils.dartDirUri.resolve('.packages').toFilePath(); |
| 843 } |
| 844 |
| 811 // Expand the architectures. | 845 // Expand the architectures. |
| 812 if (configuration['arch'].contains(',')) { | 846 if (configuration['arch'].contains(',')) { |
| 813 return _expandHelper('arch', configuration); | 847 return _expandHelper('arch', configuration); |
| 814 } | 848 } |
| 815 | 849 |
| 816 // Expand modes. | 850 // Expand modes. |
| 817 if (configuration['mode'].contains(',')) { | 851 if (configuration['mode'].contains(',')) { |
| 818 return _expandHelper('mode', configuration); | 852 return _expandHelper('mode', configuration); |
| 819 } | 853 } |
| 820 | 854 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 if (option.keys.contains(name)) { | 959 if (option.keys.contains(name)) { |
| 926 return option; | 960 return option; |
| 927 } | 961 } |
| 928 } | 962 } |
| 929 print('Unknown test option $name'); | 963 print('Unknown test option $name'); |
| 930 exit(1); | 964 exit(1); |
| 931 } | 965 } |
| 932 | 966 |
| 933 List<_TestOptionSpecification> _options; | 967 List<_TestOptionSpecification> _options; |
| 934 } | 968 } |
| OLD | NEW |