| 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"; |
| 11 import "compiler_configuration.dart" show CompilerConfiguration; | 11 import "compiler_configuration.dart" show CompilerConfiguration; |
| 12 import "runtime_configuration.dart" show RuntimeConfiguration; | 12 import "runtime_configuration.dart" show RuntimeConfiguration; |
| 13 | 13 |
| 14 const List<String> defaultTestSelectors = const [ | 14 const List<String> defaultTestSelectors = const [ |
| 15 'samples', | 15 'samples', |
| 16 'standalone', | 16 'standalone', |
| 17 'corelib', | 17 'corelib', |
| 18 'co19', | 18 'co19', |
| 19 'language', | 19 'language', |
| 20 'isolate', | 20 'isolate', |
| 21 'vm', | 21 'vm', |
| 22 'html', | 22 'html', |
| 23 'benchmark_smoke', | 23 'benchmark_smoke', |
| 24 'utils', | 24 'utils', |
| 25 'lib', | 25 'lib', |
| 26 'pkg', | 26 'pkg', |
| 27 'analyze_library', | 27 'analyze_library', |
| 28 'service', | 28 'service', |
| 29 'kernel', | |
| 30 'observatory_ui' | 29 'observatory_ui' |
| 31 ]; | 30 ]; |
| 32 | 31 |
| 33 /** | 32 /** |
| 34 * Specification of a single test option. | 33 * Specification of a single test option. |
| 35 * | 34 * |
| 36 * The name of the specification is used as the key for the option in | 35 * The name of the specification is used as the key for the option in |
| 37 * the Map returned from the [TestOptionParser] parse method. | 36 * the Map returned from the [TestOptionParser] parse method. |
| 38 */ | 37 */ |
| 39 class _TestOptionSpecification { | 38 class _TestOptionSpecification { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 69 dart2js: Compile dart code to JavaScript by running dart2js. | 68 dart2js: Compile dart code to JavaScript by running dart2js. |
| 70 (only valid with the following runtimes: d8, drt, chrome, | 69 (only valid with the following runtimes: d8, drt, chrome, |
| 71 safari, ie9, ie10, ie11, firefox, opera, chromeOnAndroid, | 70 safari, ie9, ie10, ie11, firefox, opera, chromeOnAndroid, |
| 72 none (compile only)), | 71 none (compile only)), |
| 73 | 72 |
| 74 dart2analyzer: Perform static analysis on Dart code by running the analyzer | 73 dart2analyzer: Perform static analysis on Dart code by running the analyzer |
| 75 (only valid with the following runtimes: none) | 74 (only valid with the following runtimes: none) |
| 76 | 75 |
| 77 dart2app: | 76 dart2app: |
| 78 dart2appjit: Compile the Dart code into an app snapshot before running test | 77 dart2appjit: Compile the Dart code into an app snapshot before running test |
| 79 (only valid with dart_app runtime) | 78 (only valid with dart_app runtime)''', |
| 80 | |
| 81 dartk: Compile the Dart source into Kernel before running test. | |
| 82 | |
| 83 dartkp: Compiler the Dart source into Kernel and then Kernel into AOT | |
| 84 snapshot before running the test.''', | |
| 85 ['-c', '--compiler'], | 79 ['-c', '--compiler'], |
| 86 ['none', 'precompiler', 'dart2js', 'dart2analyzer', 'dart2app', | 80 ['none', 'precompiler', 'dart2js', 'dart2analyzer', 'dart2app', 'dart2
appjit'], |
| 87 'dart2appjit', 'dartk', 'dartkp'], | |
| 88 'none'), | 81 'none'), |
| 89 // TODO(antonm): fix the option drt. | 82 // TODO(antonm): fix the option drt. |
| 90 new _TestOptionSpecification( | 83 new _TestOptionSpecification( |
| 91 'runtime', | 84 'runtime', |
| 92 '''Where the tests should be run. | 85 '''Where the tests should be run. |
| 93 vm: Run Dart code on the standalone dart vm. | 86 vm: Run Dart code on the standalone dart vm. |
| 94 | 87 |
| 95 dart_precompiled: Run a precompiled snapshot on a variant of the standalone | 88 dart_precompiled: Run a precompiled snapshot on a variant of the standalone |
| 96 dart vm lacking a JIT. | 89 dart vm lacking a JIT. |
| 97 | 90 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 'simarm', | 149 'simarm', |
| 157 'simarmv6', | 150 'simarmv6', |
| 158 'simarmv5te', | 151 'simarmv5te', |
| 159 'simarm64', | 152 'simarm64', |
| 160 'simmips', | 153 'simmips', |
| 161 'simdbc', | 154 'simdbc', |
| 162 'simdbc64', | 155 'simdbc64', |
| 163 ], | 156 ], |
| 164 'x64'), | 157 'x64'), |
| 165 new _TestOptionSpecification( | 158 new _TestOptionSpecification( |
| 166 'kernel_transformers', | |
| 167 'The kernel transformations to apply in order (separated by comma). ' | |
| 168 'A transformer can either be just a "name" (in which case it must be ' | |
| 169 'available in kernel/bin/tansform.dart) or a "name:path" pair ' | |
| 170 '(in which case "path" must point to an executable script which takes' | |
| 171 ' `input-file` and `output-file` as arguments).', | |
| 172 ['--kernel_transformers'], | |
| 173 [], | |
| 174 ''), | |
| 175 new _TestOptionSpecification( | |
| 176 'system', | 159 'system', |
| 177 'The operating system to run tests on', | 160 'The operating system to run tests on', |
| 178 ['-s', '--system'], | 161 ['-s', '--system'], |
| 179 ['linux', 'macos', 'windows', 'android'], | 162 ['linux', 'macos', 'windows', 'android'], |
| 180 Platform.operatingSystem), | 163 Platform.operatingSystem), |
| 181 new _TestOptionSpecification( | 164 new _TestOptionSpecification( |
| 182 'checked', 'Run tests in checked mode', ['--checked'], [], false, | 165 'checked', 'Run tests in checked mode', ['--checked'], [], false, |
| 183 type: 'bool'), | 166 type: 'bool'), |
| 184 new _TestOptionSpecification( | 167 new _TestOptionSpecification( |
| 185 'strong', 'Run tests in strong mode', ['--strong'], [], false, | 168 'strong', 'Run tests in strong mode', ['--strong'], [], false, |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 case 'dart2analyzer': | 670 case 'dart2analyzer': |
| 688 validRuntimes = const ['none']; | 671 validRuntimes = const ['none']; |
| 689 break; | 672 break; |
| 690 case 'dart2app': | 673 case 'dart2app': |
| 691 case 'dart2appjit': | 674 case 'dart2appjit': |
| 692 validRuntimes = const ['dart_app']; | 675 validRuntimes = const ['dart_app']; |
| 693 break; | 676 break; |
| 694 case 'precompiler': | 677 case 'precompiler': |
| 695 validRuntimes = const ['dart_precompiled']; | 678 validRuntimes = const ['dart_precompiled']; |
| 696 break; | 679 break; |
| 697 case 'dartk': | |
| 698 validRuntimes = const ['vm']; | |
| 699 break; | |
| 700 case 'dartkp': | |
| 701 validRuntimes = const ['dart_precompiled']; | |
| 702 break; | |
| 703 case 'none': | 680 case 'none': |
| 704 validRuntimes = const [ | 681 validRuntimes = const [ |
| 705 'vm', | 682 'vm', |
| 706 'drt', | 683 'drt', |
| 707 'dartium', | 684 'dartium', |
| 708 'ContentShellOnAndroid', | 685 'ContentShellOnAndroid', |
| 709 'DartiumOnAndroid' | 686 'DartiumOnAndroid' |
| 710 ]; | 687 ]; |
| 711 break; | 688 break; |
| 712 } | 689 } |
| 713 var kernelCompilers = const ['dartk', 'dartkp']; | |
| 714 if (config['kernel_transformers']?.length > 0 && | |
| 715 !kernelCompilers.contains(config['compiler'])) { | |
| 716 isValid = false; | |
| 717 print("Warning: The `--kernel_transformers` option can only be used in " | |
| 718 "combination with the ${kernelCompilers.join(', ')} compilers."); | |
| 719 } | |
| 720 if (!validRuntimes.contains(config['runtime'])) { | 690 if (!validRuntimes.contains(config['runtime'])) { |
| 721 isValid = false; | 691 isValid = false; |
| 722 print("Warning: combination of compiler '${config['compiler']}' and " | 692 print("Warning: combination of compiler '${config['compiler']}' and " |
| 723 "runtime '${config['runtime']}' is invalid. " | 693 "runtime '${config['runtime']}' is invalid. " |
| 724 "Skipping this combination."); | 694 "Skipping this combination."); |
| 725 } | 695 } |
| 726 if (config['ie'] && Platform.operatingSystem != 'windows') { | 696 if (config['ie'] && Platform.operatingSystem != 'windows') { |
| 727 isValid = false; | 697 isValid = false; |
| 728 print("Warning cannot run Internet Explorer on non-Windows operating" | 698 print("Warning cannot run Internet Explorer on non-Windows operating" |
| 729 " system."); | 699 " system."); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 // Return the expansions of both configurations. Neither will reach | 831 // Return the expansions of both configurations. Neither will reach |
| 862 // this line in the recursive call to _expandConfigurations. | 832 // this line in the recursive call to _expandConfigurations. |
| 863 return _expandConfigurations(configuration) | 833 return _expandConfigurations(configuration) |
| 864 ..addAll(_expandConfigurations(observatoryConfiguration)); | 834 ..addAll(_expandConfigurations(observatoryConfiguration)); |
| 865 } | 835 } |
| 866 } | 836 } |
| 867 // Set the default package spec explicitly. | 837 // Set the default package spec explicitly. |
| 868 if (configuration['package_root'] == null && | 838 if (configuration['package_root'] == null && |
| 869 configuration['packages'] == null) { | 839 configuration['packages'] == null) { |
| 870 configuration['packages'] = | 840 configuration['packages'] = |
| 871 TestUtils.dartDirUri.resolve('.packages').toFilePath(); | 841 TestUtils.dartDirUri.resolve('.packages').toFilePath(); |
| 872 } | 842 } |
| 873 | 843 |
| 874 // Expand the architectures. | 844 // Expand the architectures. |
| 875 if (configuration['arch'].contains(',')) { | 845 if (configuration['arch'].contains(',')) { |
| 876 return _expandHelper('arch', configuration); | 846 return _expandHelper('arch', configuration); |
| 877 } | 847 } |
| 878 | 848 |
| 879 // Expand modes. | 849 // Expand modes. |
| 880 if (configuration['mode'].contains(',')) { | 850 if (configuration['mode'].contains(',')) { |
| 881 return _expandHelper('mode', configuration); | 851 return _expandHelper('mode', configuration); |
| 882 } | 852 } |
| 883 | 853 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 if (option.keys.contains(name)) { | 958 if (option.keys.contains(name)) { |
| 989 return option; | 959 return option; |
| 990 } | 960 } |
| 991 } | 961 } |
| 992 print('Unknown test option $name'); | 962 print('Unknown test option $name'); |
| 993 exit(1); | 963 exit(1); |
| 994 } | 964 } |
| 995 | 965 |
| 996 List<_TestOptionSpecification> _options; | 966 List<_TestOptionSpecification> _options; |
| 997 } | 967 } |
| OLD | NEW |