Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: tools/testing/dart/test_options.dart

Issue 2434123003: Merge more Kernel infrastructure from kernel_sdk SDK fork. (Closed)
Patch Set: address more comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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',
29 'observatory_ui' 30 'observatory_ui'
30 ]; 31 ];
31 32
32 /** 33 /**
33 * Specification of a single test option. 34 * Specification of a single test option.
34 * 35 *
35 * The name of the specification is used as the key for the option in 36 * The name of the specification is used as the key for the option in
36 * the Map returned from the [TestOptionParser] parse method. 37 * the Map returned from the [TestOptionParser] parse method.
37 */ 38 */
38 class _TestOptionSpecification { 39 class _TestOptionSpecification {
(...skipping 29 matching lines...) Expand all
68 dart2js: Compile dart code to JavaScript by running dart2js. 69 dart2js: Compile dart code to JavaScript by running dart2js.
69 (only valid with the following runtimes: d8, drt, chrome, 70 (only valid with the following runtimes: d8, drt, chrome,
70 safari, ie9, ie10, ie11, firefox, opera, chromeOnAndroid, 71 safari, ie9, ie10, ie11, firefox, opera, chromeOnAndroid,
71 none (compile only)), 72 none (compile only)),
72 73
73 dart2analyzer: Perform static analysis on Dart code by running the analyzer 74 dart2analyzer: Perform static analysis on Dart code by running the analyzer
74 (only valid with the following runtimes: none) 75 (only valid with the following runtimes: none)
75 76
76 dart2app: 77 dart2app:
77 dart2appjit: Compile the Dart code into an app snapshot before running test 78 dart2appjit: Compile the Dart code into an app snapshot before running test
78 (only valid with dart_app runtime)''', 79 (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.''',
79 ['-c', '--compiler'], 85 ['-c', '--compiler'],
80 ['none', 'precompiler', 'dart2js', 'dart2analyzer', 'dart2app', 'dart2 appjit'], 86 ['none', 'precompiler', 'dart2js', 'dart2analyzer', 'dart2app',
87 'dart2appjit', 'dartk', 'dartkp'],
81 'none'), 88 'none'),
82 // TODO(antonm): fix the option drt. 89 // TODO(antonm): fix the option drt.
83 new _TestOptionSpecification( 90 new _TestOptionSpecification(
84 'runtime', 91 'runtime',
85 '''Where the tests should be run. 92 '''Where the tests should be run.
86 vm: Run Dart code on the standalone dart vm. 93 vm: Run Dart code on the standalone dart vm.
87 94
88 dart_precompiled: Run a precompiled snapshot on a variant of the standalone 95 dart_precompiled: Run a precompiled snapshot on a variant of the standalone
89 dart vm lacking a JIT. 96 dart vm lacking a JIT.
90 97
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 'simarm', 156 'simarm',
150 'simarmv6', 157 'simarmv6',
151 'simarmv5te', 158 'simarmv5te',
152 'simarm64', 159 'simarm64',
153 'simmips', 160 'simmips',
154 'simdbc', 161 'simdbc',
155 'simdbc64', 162 'simdbc64',
156 ], 163 ],
157 'x64'), 164 'x64'),
158 new _TestOptionSpecification( 165 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(
159 'system', 176 'system',
160 'The operating system to run tests on', 177 'The operating system to run tests on',
161 ['-s', '--system'], 178 ['-s', '--system'],
162 ['linux', 'macos', 'windows', 'android'], 179 ['linux', 'macos', 'windows', 'android'],
163 Platform.operatingSystem), 180 Platform.operatingSystem),
164 new _TestOptionSpecification( 181 new _TestOptionSpecification(
165 'checked', 'Run tests in checked mode', ['--checked'], [], false, 182 'checked', 'Run tests in checked mode', ['--checked'], [], false,
166 type: 'bool'), 183 type: 'bool'),
167 new _TestOptionSpecification( 184 new _TestOptionSpecification(
168 'strong', 'Run tests in strong mode', ['--strong'], [], false, 185 'strong', 'Run tests in strong mode', ['--strong'], [], false,
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 case 'dart2analyzer': 687 case 'dart2analyzer':
671 validRuntimes = const ['none']; 688 validRuntimes = const ['none'];
672 break; 689 break;
673 case 'dart2app': 690 case 'dart2app':
674 case 'dart2appjit': 691 case 'dart2appjit':
675 validRuntimes = const ['dart_app']; 692 validRuntimes = const ['dart_app'];
676 break; 693 break;
677 case 'precompiler': 694 case 'precompiler':
678 validRuntimes = const ['dart_precompiled']; 695 validRuntimes = const ['dart_precompiled'];
679 break; 696 break;
697 case 'dartk':
698 validRuntimes = const ['vm'];
699 break;
700 case 'dartkp':
701 validRuntimes = const ['dart_precompiled'];
702 break;
680 case 'none': 703 case 'none':
681 validRuntimes = const [ 704 validRuntimes = const [
682 'vm', 705 'vm',
683 'drt', 706 'drt',
684 'dartium', 707 'dartium',
685 'ContentShellOnAndroid', 708 'ContentShellOnAndroid',
686 'DartiumOnAndroid' 709 'DartiumOnAndroid'
687 ]; 710 ];
688 break; 711 break;
689 } 712 }
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 }
690 if (!validRuntimes.contains(config['runtime'])) { 720 if (!validRuntimes.contains(config['runtime'])) {
691 isValid = false; 721 isValid = false;
692 print("Warning: combination of compiler '${config['compiler']}' and " 722 print("Warning: combination of compiler '${config['compiler']}' and "
693 "runtime '${config['runtime']}' is invalid. " 723 "runtime '${config['runtime']}' is invalid. "
694 "Skipping this combination."); 724 "Skipping this combination.");
695 } 725 }
696 if (config['ie'] && Platform.operatingSystem != 'windows') { 726 if (config['ie'] && Platform.operatingSystem != 'windows') {
697 isValid = false; 727 isValid = false;
698 print("Warning cannot run Internet Explorer on non-Windows operating" 728 print("Warning cannot run Internet Explorer on non-Windows operating"
699 " system."); 729 " system.");
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 // Return the expansions of both configurations. Neither will reach 861 // Return the expansions of both configurations. Neither will reach
832 // this line in the recursive call to _expandConfigurations. 862 // this line in the recursive call to _expandConfigurations.
833 return _expandConfigurations(configuration) 863 return _expandConfigurations(configuration)
834 ..addAll(_expandConfigurations(observatoryConfiguration)); 864 ..addAll(_expandConfigurations(observatoryConfiguration));
835 } 865 }
836 } 866 }
837 // Set the default package spec explicitly. 867 // Set the default package spec explicitly.
838 if (configuration['package_root'] == null && 868 if (configuration['package_root'] == null &&
839 configuration['packages'] == null) { 869 configuration['packages'] == null) {
840 configuration['packages'] = 870 configuration['packages'] =
841 TestUtils.dartDirUri.resolve('.packages').toFilePath(); 871 TestUtils.dartDirUri.resolve('.packages').toFilePath();
842 } 872 }
843 873
844 // Expand the architectures. 874 // Expand the architectures.
845 if (configuration['arch'].contains(',')) { 875 if (configuration['arch'].contains(',')) {
846 return _expandHelper('arch', configuration); 876 return _expandHelper('arch', configuration);
847 } 877 }
848 878
849 // Expand modes. 879 // Expand modes.
850 if (configuration['mode'].contains(',')) { 880 if (configuration['mode'].contains(',')) {
851 return _expandHelper('mode', configuration); 881 return _expandHelper('mode', configuration);
852 } 882 }
853 883
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 if (option.keys.contains(name)) { 988 if (option.keys.contains(name)) {
959 return option; 989 return option;
960 } 990 }
961 } 991 }
962 print('Unknown test option $name'); 992 print('Unknown test option $name');
963 exit(1); 993 exit(1);
964 } 994 }
965 995
966 List<_TestOptionSpecification> _options; 996 List<_TestOptionSpecification> _options;
967 } 997 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698