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

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

Issue 2522513002: Update test script short reproduction command to not print --packages flag. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 dart2app: 77 dart2app:
78 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
79 (only valid with dart_app runtime) 79 (only valid with dart_app runtime)
80 80
81 dartk: Compile the Dart source into Kernel before running test. 81 dartk: Compile the Dart source into Kernel before running test.
82 82
83 dartkp: Compiler the Dart source into Kernel and then Kernel into AOT 83 dartkp: Compiler the Dart source into Kernel and then Kernel into AOT
84 snapshot before running the test.''', 84 snapshot before running the test.''',
85 ['-c', '--compiler'], 85 ['-c', '--compiler'],
86 ['none', 'precompiler', 'dart2js', 'dart2analyzer', 'dart2app', 86 [
87 'dart2appjit', 'dartk', 'dartkp'], 87 'none',
88 'precompiler',
89 'dart2js',
90 'dart2analyzer',
91 'dart2app',
92 'dart2appjit',
93 'dartk',
94 'dartkp'
95 ],
88 'none'), 96 'none'),
89 // TODO(antonm): fix the option drt. 97 // TODO(antonm): fix the option drt.
90 new _TestOptionSpecification( 98 new _TestOptionSpecification(
91 'runtime', 99 'runtime',
92 '''Where the tests should be run. 100 '''Where the tests should be run.
93 vm: Run Dart code on the standalone dart vm. 101 vm: Run Dart code on the standalone dart vm.
94 102
95 dart_precompiled: Run a precompiled snapshot on a variant of the standalone 103 dart_precompiled: Run a precompiled snapshot on a variant of the standalone
96 dart vm lacking a JIT. 104 dart vm lacking a JIT.
97 105
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 'cps_ir', 199 'cps_ir',
192 'Run the compiler with the cps based backend', 200 'Run the compiler with the cps based backend',
193 ['--cps-ir'], 201 ['--cps-ir'],
194 [], 202 [],
195 false, 203 false,
196 type: 'bool'), 204 type: 'bool'),
197 new _TestOptionSpecification( 205 new _TestOptionSpecification(
198 'noopt', 'Run an in-place precompilation', ['--noopt'], [], false, 206 'noopt', 'Run an in-place precompilation', ['--noopt'], [], false,
199 type: 'bool'), 207 type: 'bool'),
200 new _TestOptionSpecification( 208 new _TestOptionSpecification(
201 'fast_startup', 'Pass the --fast-startup flag to dart2js', 209 'fast_startup',
202 ['--fast-startup'], [], false, 210 'Pass the --fast-startup flag to dart2js',
211 ['--fast-startup'],
212 [],
213 false,
214 type: 'bool'),
215 new _TestOptionSpecification('hot_reload', 'Run hot reload stress tests',
216 ['--hot-reload'], [], false,
203 type: 'bool'), 217 type: 'bool'),
204 new _TestOptionSpecification( 218 new _TestOptionSpecification(
205 'hot_reload', 'Run hot reload stress tests', ['--hot-reload'], [],
206 false, type: 'bool'),
207 new _TestOptionSpecification(
208 'hot_reload_rollback', 219 'hot_reload_rollback',
209 'Run hot reload rollback stress tests', ['--hot-reload-rollback'], 220 'Run hot reload rollback stress tests',
221 ['--hot-reload-rollback'],
210 [], 222 [],
211 false, type: 'bool'), 223 false,
224 type: 'bool'),
eernst 2016/11/21 16:41:50 Confusing! Just to check that my understanding mat
212 new _TestOptionSpecification( 225 new _TestOptionSpecification(
213 'use_blobs', 226 'use_blobs',
214 'Use mmap instead of shared libraries for precompilation', 227 'Use mmap instead of shared libraries for precompilation',
215 ['--use-blobs'], [], false, type: 'bool'), 228 ['--use-blobs'],
229 [],
230 false,
231 type: 'bool'),
216 new _TestOptionSpecification( 232 new _TestOptionSpecification(
217 'timeout', 'Timeout in seconds', ['-t', '--timeout'], [], -1, 233 'timeout', 'Timeout in seconds', ['-t', '--timeout'], [], -1,
218 type: 'int'), 234 type: 'int'),
219 new _TestOptionSpecification( 235 new _TestOptionSpecification(
220 'progress', 236 'progress',
221 'Progress indication mode', 237 'Progress indication mode',
222 ['-p', '--progress'], 238 ['-p', '--progress'],
223 [ 239 [
224 'compact', 240 'compact',
225 'color', 241 'color',
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 'safari', 620 'safari',
605 'build_directory', 621 'build_directory',
606 'append_logs', 622 'append_logs',
607 'local_ip', 623 'local_ip',
608 'shard', 624 'shard',
609 'shards', 625 'shards',
610 ]); 626 ]);
611 627
612 List<String> _constructReproducingCommandArguments(Map config) { 628 List<String> _constructReproducingCommandArguments(Map config) {
613 var arguments = new List<String>(); 629 var arguments = new List<String>();
614 for (var configKey in config.keys) { 630 for (var option in _options) {
615 if (!_blacklistedOptions.contains(configKey)) { 631 var name = option.name;
616 for (var option in _options) { 632 if (!config.containsKey(name) || _blacklistedOptions.contains(name)) {
617 var configValue = config[configKey]; 633 continue;
618 // We only include entries of [conf] if we find an option for it. 634 }
619 if (configKey == option.name && configValue != option.defaultValue) { 635 var value = config[name];
620 var isBooleanOption = option.type == 'bool'; 636 if (config[name] == option.defaultValue ||
621 // Sort by length, so we get the shortest variant. 637 (name == 'packages' &&
622 var possibleOptions = new List.from(option.keys); 638 value ==
623 possibleOptions.sort((a, b) => (a.length < b.length ? -1 : 1)); 639 TestUtils.dartDirUri.resolve('.packages').toFilePath())) {
624 var key = possibleOptions[0]; 640 continue;
625 if (key.startsWith('--')) { 641 }
626 // long version 642 shortest(String a, String b) => a.length <= b.length ? a : b;
627 arguments.add(key); 643 var key = option.keys.reduce(shortest);
628 if (!isBooleanOption) { 644 if (option.type == 'bool') {
629 arguments.add("$configValue"); 645 arguments.add(key);
630 } 646 } else if (key.startsWith('--')) {
631 } else { 647 // long version
632 // short version 648 arguments.add(key);
633 assert(key.startsWith('-')); 649 arguments.add("$value");
634 if (!isBooleanOption) { 650 } else {
635 arguments.add("$key$configValue"); 651 // short version
636 } else { 652 assert(key.startsWith('-'));
637 arguments.add(key); 653 arguments.add("$key$value");
638 }
639 }
640 }
641 }
642 } 654 }
643 } 655 }
644 return arguments; 656 return arguments;
645 } 657 }
646 658
647 /** 659 /**
648 * Determine if a particular configuration has a valid combination of compiler 660 * Determine if a particular configuration has a valid combination of compiler
649 * and runtime elements. 661 * and runtime elements.
650 */ 662 */
651 bool _isValidConfig(Map config) { 663 bool _isValidConfig(Map config) {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 } 831 }
820 configuration['selectors'] = selectorMap; 832 configuration['selectors'] = selectorMap;
821 } 833 }
822 834
823 // Put observatory_ui in a configuration with its own packages override. 835 // Put observatory_ui in a configuration with its own packages override.
824 // Only one value in the configuration map is mutable: 836 // Only one value in the configuration map is mutable:
825 selectors = configuration['selectors']; 837 selectors = configuration['selectors'];
826 if (selectors.containsKey('observatory_ui')) { 838 if (selectors.containsKey('observatory_ui')) {
827 if (selectors.length == 1) { 839 if (selectors.length == 1) {
828 configuration['packages'] = TestUtils.dartDirUri 840 configuration['packages'] = TestUtils.dartDirUri
829 .resolve('runtime/observatory/.packages').toFilePath(); 841 .resolve('runtime/observatory/.packages')
842 .toFilePath();
830 } else { 843 } else {
831 // Make a new configuration whose selectors map only contains 844 // Make a new configuration whose selectors map only contains
832 // observatory_ui, and remove the key from the original selectors. 845 // observatory_ui, and remove the key from the original selectors.
833 // The only mutable value in the map is the selectors, so a 846 // The only mutable value in the map is the selectors, so a
834 // shallow copy is safe. 847 // shallow copy is safe.
835 var observatoryConfiguration = new Map.from(configuration); 848 var observatoryConfiguration = new Map.from(configuration);
836 observatoryConfiguration['selectors'] = 849 observatoryConfiguration['selectors'] = {
837 {'observatory_ui': selectors['observatory_ui']}; 850 'observatory_ui': selectors['observatory_ui']
851 };
838 selectors.remove('observatory_ui'); 852 selectors.remove('observatory_ui');
839 853
840 // Set the packages flag. 854 // Set the packages flag.
841 observatoryConfiguration['packages'] = TestUtils.dartDirUri 855 observatoryConfiguration['packages'] = TestUtils.dartDirUri
842 .resolve('runtime/observatory/.packages').toFilePath(); 856 .resolve('runtime/observatory/.packages')
857 .toFilePath();
843 858
844 // Return the expansions of both configurations. Neither will reach 859 // Return the expansions of both configurations. Neither will reach
845 // this line in the recursive call to _expandConfigurations. 860 // this line in the recursive call to _expandConfigurations.
846 return _expandConfigurations(configuration) 861 return _expandConfigurations(configuration)
847 ..addAll(_expandConfigurations(observatoryConfiguration)); 862 ..addAll(_expandConfigurations(observatoryConfiguration));
848 } 863 }
849 } 864 }
850 // Set the default package spec explicitly. 865 // Set the default package spec explicitly.
851 if (configuration['package_root'] == null && 866 if (configuration['package_root'] == null &&
852 configuration['packages'] == null) { 867 configuration['packages'] == null) {
853 configuration['packages'] = 868 configuration['packages'] =
854 TestUtils.dartDirUri.resolve('.packages').toFilePath(); 869 TestUtils.dartDirUri.resolve('.packages').toFilePath();
855 } 870 }
856 871
857 // Expand the architectures. 872 // Expand the architectures.
858 if (configuration['arch'].contains(',')) { 873 if (configuration['arch'].contains(',')) {
859 return _expandHelper('arch', configuration); 874 return _expandHelper('arch', configuration);
860 } 875 }
861 876
862 // Expand modes. 877 // Expand modes.
863 if (configuration['mode'].contains(',')) { 878 if (configuration['mode'].contains(',')) {
864 return _expandHelper('mode', configuration); 879 return _expandHelper('mode', configuration);
(...skipping 11 matching lines...) Expand all
876 } else { 891 } else {
877 // All runtimes eventually go through this path, after expansion. 892 // All runtimes eventually go through this path, after expansion.
878 var updater = runtimeUpdater(configuration); 893 var updater = runtimeUpdater(configuration);
879 if (updater != null) { 894 if (updater != null) {
880 updater.update(); 895 updater.update();
881 } 896 }
882 } 897 }
883 898
884 // Adjust default timeout based on mode, compiler, and sometimes runtime. 899 // Adjust default timeout based on mode, compiler, and sometimes runtime.
885 if (configuration['timeout'] == -1) { 900 if (configuration['timeout'] == -1) {
886 var isReload = configuration['hot_reload'] || 901 var isReload =
887 configuration['hot_reload_rollback']; 902 configuration['hot_reload'] || configuration['hot_reload_rollback'];
888 int compilerMulitiplier = 903 int compilerMulitiplier =
889 new CompilerConfiguration(configuration).computeTimeoutMultiplier(); 904 new CompilerConfiguration(configuration).computeTimeoutMultiplier();
890 int runtimeMultiplier = new RuntimeConfiguration(configuration) 905 int runtimeMultiplier = new RuntimeConfiguration(configuration)
891 .computeTimeoutMultiplier( 906 .computeTimeoutMultiplier(
892 mode: configuration['mode'], 907 mode: configuration['mode'],
893 isChecked: configuration['checked'], 908 isChecked: configuration['checked'],
894 isReload: isReload, 909 isReload: isReload,
895 arch: configuration['arch']); 910 arch: configuration['arch']);
896 configuration['timeout'] = 60 * compilerMulitiplier * runtimeMultiplier; 911 configuration['timeout'] = 60 * compilerMulitiplier * runtimeMultiplier;
897 } 912 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 if (option.keys.contains(name)) { 986 if (option.keys.contains(name)) {
972 return option; 987 return option;
973 } 988 }
974 } 989 }
975 print('Unknown test option $name'); 990 print('Unknown test option $name');
976 exit(1); 991 exit(1);
977 } 992 }
978 993
979 List<_TestOptionSpecification> _options; 994 List<_TestOptionSpecification> _options;
980 } 995 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698