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

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

Issue 2434123003: Merge more Kernel infrastructure from kernel_sdk SDK fork. (Closed)
Patch Set: Created 4 years, 2 months 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)''',
Bill Hesse 2016/10/21 12:17:39 Can we expand this comment with the new compilers?
Vyacheslav Egorov (Google) 2016/10/21 13:39:44 Done.
79 ['-c', '--compiler'], 80 ['-c', '--compiler'],
80 ['none', 'precompiler', 'dart2js', 'dart2analyzer', 'dart2app', 'dart2 appjit'], 81 ['none', 'precompiler', 'dart2js', 'dart2analyzer', 'dart2app',
82 'dart2appjit', 'dartk', 'dartkp', 'ir2ir'],
81 'none'), 83 'none'),
82 // TODO(antonm): fix the option drt. 84 // TODO(antonm): fix the option drt.
83 new _TestOptionSpecification( 85 new _TestOptionSpecification(
84 'runtime', 86 'runtime',
85 '''Where the tests should be run. 87 '''Where the tests should be run.
86 vm: Run Dart code on the standalone dart vm. 88 vm: Run Dart code on the standalone dart vm.
87 89
88 dart_precompiled: Run a precompiled snapshot on a variant of the standalone 90 dart_precompiled: Run a precompiled snapshot on a variant of the standalone
89 dart vm lacking a JIT. 91 dart vm lacking a JIT.
90 92
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 'simarm', 151 'simarm',
150 'simarmv6', 152 'simarmv6',
151 'simarmv5te', 153 'simarmv5te',
152 'simarm64', 154 'simarm64',
153 'simmips', 155 'simmips',
154 'simdbc', 156 'simdbc',
155 'simdbc64', 157 'simdbc64',
156 ], 158 ],
157 'x64'), 159 'x64'),
158 new _TestOptionSpecification( 160 new _TestOptionSpecification(
161 'kernel_transformers',
162 'The kernel transformations to apply in order (separated by comma). '
163 'A transformer can either be just a "name" (in which case it must be '
164 'available in kernel/bin/tansform.dart) or a "name:path" pair '
165 '(in which case "path" must point to an executable script which takes'
166 ' `input-file` and `output-file` as arguments).',
167 ['--kernel_transformers'],
168 [],
169 ''),
170 new _TestOptionSpecification(
159 'system', 171 'system',
160 'The operating system to run tests on', 172 'The operating system to run tests on',
161 ['-s', '--system'], 173 ['-s', '--system'],
162 ['linux', 'macos', 'windows', 'android'], 174 ['linux', 'macos', 'windows', 'android'],
163 Platform.operatingSystem), 175 Platform.operatingSystem),
164 new _TestOptionSpecification( 176 new _TestOptionSpecification(
165 'checked', 'Run tests in checked mode', ['--checked'], [], false, 177 'checked', 'Run tests in checked mode', ['--checked'], [], false,
166 type: 'bool'), 178 type: 'bool'),
167 new _TestOptionSpecification( 179 new _TestOptionSpecification(
168 'strong', 'Run tests in strong mode', ['--strong'], [], false, 180 'strong', 'Run tests in strong mode', ['--strong'], [], false,
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 'safarimobilesim' 679 'safarimobilesim'
668 ]; 680 ];
669 break; 681 break;
670 case 'dart2analyzer': 682 case 'dart2analyzer':
671 validRuntimes = const ['none']; 683 validRuntimes = const ['none'];
672 break; 684 break;
673 case 'dart2app': 685 case 'dart2app':
674 case 'dart2appjit': 686 case 'dart2appjit':
675 validRuntimes = const ['dart_app']; 687 validRuntimes = const ['dart_app'];
676 break; 688 break;
689 case 'ir2ir':
690 validRuntimes = const ['vm'];
691 break;
677 case 'precompiler': 692 case 'precompiler':
678 validRuntimes = const ['dart_precompiled']; 693 validRuntimes = const ['dart_precompiled'];
679 break; 694 break;
695 case 'dartk':
696 validRuntimes = const ['vm'];
697 break;
698 case 'dartkp':
699 validRuntimes = const ['dart_precompiled'];
700 break;
680 case 'none': 701 case 'none':
681 validRuntimes = const [ 702 validRuntimes = const [
682 'vm', 703 'vm',
683 'drt', 704 'drt',
684 'dartium', 705 'dartium',
685 'ContentShellOnAndroid', 706 'ContentShellOnAndroid',
686 'DartiumOnAndroid' 707 'DartiumOnAndroid'
687 ]; 708 ];
688 break; 709 break;
689 } 710 }
711 var kernelCompilers = const ['dartk', 'dartkp', 'ir2ir'];
712 if (config['kernel_transformers']?.length > 0 &&
713 !kernelCompilers.contains(config['compiler'])) {
714 isValid = false;
715 print("Warning: The `--kernel_transformers` option can only be used in "
716 "combination with the ${kernelCompilers.join(', ')} compilers.");
717 }
690 if (!validRuntimes.contains(config['runtime'])) { 718 if (!validRuntimes.contains(config['runtime'])) {
691 isValid = false; 719 isValid = false;
692 print("Warning: combination of compiler '${config['compiler']}' and " 720 print("Warning: combination of compiler '${config['compiler']}' and "
693 "runtime '${config['runtime']}' is invalid. " 721 "runtime '${config['runtime']}' is invalid. "
694 "Skipping this combination."); 722 "Skipping this combination.");
695 } 723 }
696 if (config['ie'] && Platform.operatingSystem != 'windows') { 724 if (config['ie'] && Platform.operatingSystem != 'windows') {
697 isValid = false; 725 isValid = false;
698 print("Warning cannot run Internet Explorer on non-Windows operating" 726 print("Warning cannot run Internet Explorer on non-Windows operating"
699 " system."); 727 " system.");
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 if (runtimes.contains(',')) { 889 if (runtimes.contains(',')) {
862 return _expandHelper('runtime', configuration); 890 return _expandHelper('runtime', configuration);
863 } else { 891 } else {
864 // All runtimes eventually go through this path, after expansion. 892 // All runtimes eventually go through this path, after expansion.
865 var updater = runtimeUpdater(configuration); 893 var updater = runtimeUpdater(configuration);
866 if (updater != null) { 894 if (updater != null) {
867 updater.update(); 895 updater.update();
868 } 896 }
869 } 897 }
870 898
899 if (configuration['compiler'] == 'ir2ir' &&
900 configuration['kernel_transformers'] == '') {
901 throw "Cannot use --compiler=ir2ir without --kernel_transformers=...!";
902 }
903
871 // Adjust default timeout based on mode, compiler, and sometimes runtime. 904 // Adjust default timeout based on mode, compiler, and sometimes runtime.
872 if (configuration['timeout'] == -1) { 905 if (configuration['timeout'] == -1) {
873 var isReload = configuration['hot_reload'] || 906 var isReload = configuration['hot_reload'] ||
874 configuration['hot_reload_rollback']; 907 configuration['hot_reload_rollback'];
875 int compilerMulitiplier = 908 int compilerMulitiplier =
876 new CompilerConfiguration(configuration).computeTimeoutMultiplier(); 909 new CompilerConfiguration(configuration).computeTimeoutMultiplier();
877 int runtimeMultiplier = new RuntimeConfiguration(configuration) 910 int runtimeMultiplier = new RuntimeConfiguration(configuration)
878 .computeTimeoutMultiplier( 911 .computeTimeoutMultiplier(
879 mode: configuration['mode'], 912 mode: configuration['mode'],
880 isChecked: configuration['checked'], 913 isChecked: configuration['checked'],
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 if (option.keys.contains(name)) { 991 if (option.keys.contains(name)) {
959 return option; 992 return option;
960 } 993 }
961 } 994 }
962 print('Unknown test option $name'); 995 print('Unknown test option $name');
963 exit(1); 996 exit(1);
964 } 997 }
965 998
966 List<_TestOptionSpecification> _options; 999 List<_TestOptionSpecification> _options;
967 } 1000 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698