Chromium Code Reviews| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 */ | 57 */ |
| 58 TestOptionsParser() { | 58 TestOptionsParser() { |
| 59 _options = [ | 59 _options = [ |
| 60 new _TestOptionSpecification('mode', 'Mode in which to run the tests', | 60 new _TestOptionSpecification('mode', 'Mode in which to run the tests', |
| 61 ['-m', '--mode'], ['all', 'debug', 'release', 'product'], 'debug'), | 61 ['-m', '--mode'], ['all', 'debug', 'release', 'product'], 'debug'), |
| 62 new _TestOptionSpecification( | 62 new _TestOptionSpecification( |
| 63 'compiler', | 63 'compiler', |
| 64 '''Specify any compilation step (if needed). | 64 '''Specify any compilation step (if needed). |
| 65 | 65 |
| 66 none: Do not compile the Dart code (run native Dart code on the VM). | 66 none: Do not compile the Dart code (run native Dart code on the VM). |
| 67 (only valid with the following runtimes: vm, drt) | 67 (only valid with the following runtimes: vm, flutter_engine, drt) |
| 68 | 68 |
| 69 dart2js: Compile dart code to JavaScript by running dart2js. | 69 dart2js: Compile dart code to JavaScript by running dart2js. |
| 70 (only valid with the following runtimes: d8, drt, chrome, | 70 (only valid with the following runtimes: d8, drt, chrome, |
| 71 safari, ie9, ie10, ie11, firefox, opera, chromeOnAndroid, | 71 safari, ie9, ie10, ie11, firefox, opera, chromeOnAndroid, |
| 72 none (compile only)), | 72 none (compile only)), |
| 73 | 73 |
| 74 dart2analyzer: Perform static analysis on Dart code by running the analyzer | 74 dart2analyzer: Perform static analysis on Dart code by running the analyzer |
| 75 (only valid with the following runtimes: none) | 75 (only valid with the following runtimes: none) |
| 76 | 76 |
| 77 dart2app: | 77 dart2app: |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 92 'dartk', | 92 'dartk', |
| 93 'dartkp' | 93 'dartkp' |
| 94 ], | 94 ], |
| 95 'none'), | 95 'none'), |
| 96 // TODO(antonm): fix the option drt. | 96 // TODO(antonm): fix the option drt. |
| 97 new _TestOptionSpecification( | 97 new _TestOptionSpecification( |
| 98 'runtime', | 98 'runtime', |
| 99 '''Where the tests should be run. | 99 '''Where the tests should be run. |
| 100 vm: Run Dart code on the standalone dart vm. | 100 vm: Run Dart code on the standalone dart vm. |
| 101 | 101 |
| 102 flutter_engine: Run Dart code on the flutter engine. | |
| 103 | |
| 102 dart_precompiled: Run a precompiled snapshot on a variant of the standalone | 104 dart_precompiled: Run a precompiled snapshot on a variant of the standalone |
| 103 dart vm lacking a JIT. | 105 dart vm lacking a JIT. |
| 104 | 106 |
| 105 d8: Run JavaScript from the command line using v8. | 107 d8: Run JavaScript from the command line using v8. |
| 106 | 108 |
| 107 jsshell: Run JavaScript from the command line using firefox js-shell. | 109 jsshell: Run JavaScript from the command line using firefox js-shell. |
| 108 | 110 |
| 109 drt: Run Dart or JavaScript in the headless version of Chrome, | 111 drt: Run Dart or JavaScript in the headless version of Chrome, |
| 110 Content shell. | 112 Content shell. |
| 111 | 113 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 122 self_check: Pass each test or its compiled output to every file under | 124 self_check: Pass each test or its compiled output to every file under |
| 123 `pkg` whose name ends with `_self_check.dart`. | 125 `pkg` whose name ends with `_self_check.dart`. |
| 124 Each test is given to the self_check tester as a filename on stdin using | 126 Each test is given to the self_check tester as a filename on stdin using |
| 125 the batch-mode protocol. | 127 the batch-mode protocol. |
| 126 | 128 |
| 127 none: No runtime, compile only (for example, used for dart2analyzer static | 129 none: No runtime, compile only (for example, used for dart2analyzer static |
| 128 analysis tests).''', | 130 analysis tests).''', |
| 129 ['-r', '--runtime'], | 131 ['-r', '--runtime'], |
| 130 [ | 132 [ |
| 131 'vm', | 133 'vm', |
| 134 'flutter_engine', | |
| 132 'dart_precompiled', | 135 'dart_precompiled', |
| 133 'd8', | 136 'd8', |
| 134 'jsshell', | 137 'jsshell', |
| 135 'drt', | 138 'drt', |
| 136 'dartium', | 139 'dartium', |
| 137 'ff', | 140 'ff', |
| 138 'firefox', | 141 'firefox', |
| 139 'chrome', | 142 'chrome', |
| 140 'safari', | 143 'safari', |
| 141 'ie9', | 144 'ie9', |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 ['--report-in-json'], | 303 ['--report-in-json'], |
| 301 [], | 304 [], |
| 302 false, | 305 false, |
| 303 type: 'bool'), | 306 type: 'bool'), |
| 304 new _TestOptionSpecification('time', | 307 new _TestOptionSpecification('time', |
| 305 'Print timing information after running tests', ['--time'], [], false, | 308 'Print timing information after running tests', ['--time'], [], false, |
| 306 type: 'bool'), | 309 type: 'bool'), |
| 307 new _TestOptionSpecification( | 310 new _TestOptionSpecification( |
| 308 'dart', 'Path to dart executable', ['--dart'], [], ''), | 311 'dart', 'Path to dart executable', ['--dart'], [], ''), |
| 309 new _TestOptionSpecification( | 312 new _TestOptionSpecification( |
| 313 'engine', 'Path to flutter engine executable', ['--engine'], [], ''), | |
| 314 new _TestOptionSpecification( | |
| 310 'drt', // TODO(antonm): fix the option name. | 315 'drt', // TODO(antonm): fix the option name. |
| 311 'Path to content shell executable', | 316 'Path to content shell executable', |
| 312 ['--drt'], | 317 ['--drt'], |
| 313 [], | 318 [], |
| 314 ''), | 319 ''), |
| 315 new _TestOptionSpecification('dartium', | 320 new _TestOptionSpecification('dartium', |
| 316 'Path to Dartium Chrome executable', ['--dartium'], [], ''), | 321 'Path to Dartium Chrome executable', ['--dartium'], [], ''), |
| 317 new _TestOptionSpecification('firefox', | 322 new _TestOptionSpecification('firefox', |
| 318 'Path to firefox browser executable', ['--firefox'], [], ''), | 323 'Path to firefox browser executable', ['--firefox'], [], ''), |
| 319 new _TestOptionSpecification( | 324 new _TestOptionSpecification( |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 } | 624 } |
| 620 | 625 |
| 621 // For printing out reproducing command lines, we don't want to add these | 626 // For printing out reproducing command lines, we don't want to add these |
| 622 // options. | 627 // options. |
| 623 Set<String> _blacklistedOptions = new Set<String>.from([ | 628 Set<String> _blacklistedOptions = new Set<String>.from([ |
| 624 'append_logs', | 629 'append_logs', |
| 625 'build_directory', | 630 'build_directory', |
| 626 'chrome', | 631 'chrome', |
| 627 'copy_coredumps', | 632 'copy_coredumps', |
| 628 'dart', | 633 'dart', |
| 634 'engine', | |
| 629 'dartium', | 635 'dartium', |
| 630 'drt', | 636 'drt', |
| 631 'exclude_suite', | 637 'exclude_suite', |
| 632 'failure-summary', | 638 'failure-summary', |
| 633 'firefox', | 639 'firefox', |
| 634 'local_ip', | 640 'local_ip', |
| 635 'progress', | 641 'progress', |
| 636 'report', | 642 'report', |
| 637 'safari', | 643 'safari', |
| 638 'shard', | 644 'shard', |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 713 case 'dartk': | 719 case 'dartk': |
| 714 validRuntimes = const ['vm', 'self_check', 'none']; | 720 validRuntimes = const ['vm', 'self_check', 'none']; |
| 715 break; | 721 break; |
| 716 case 'precompiler': | 722 case 'precompiler': |
| 717 case 'dartkp': | 723 case 'dartkp': |
| 718 validRuntimes = const ['dart_precompiled']; | 724 validRuntimes = const ['dart_precompiled']; |
| 719 break; | 725 break; |
| 720 case 'none': | 726 case 'none': |
| 721 validRuntimes = const [ | 727 validRuntimes = const [ |
| 722 'vm', | 728 'vm', |
| 729 'flutter_engine', | |
| 723 'drt', | 730 'drt', |
| 724 'dartium', | 731 'dartium', |
| 725 'ContentShellOnAndroid', | 732 'ContentShellOnAndroid', |
| 726 'DartiumOnAndroid' | 733 'DartiumOnAndroid' |
| 727 ]; | 734 ]; |
| 728 break; | 735 break; |
| 729 } | 736 } |
| 730 if (!validRuntimes.contains(config['runtime'])) { | 737 if (!validRuntimes.contains(config['runtime'])) { |
| 731 isValid = false; | 738 isValid = false; |
| 732 print("Warning: combination of compiler '${config['compiler']}' and " | 739 print("Warning: combination of compiler '${config['compiler']}' and " |
| 733 "runtime '${config['runtime']}' is invalid. " | 740 "runtime '${config['runtime']}' is invalid. " |
| 734 "Skipping this combination."); | 741 "Skipping this combination."); |
| 735 } | 742 } |
| 736 if (config['ie'] && Platform.operatingSystem != 'windows') { | 743 if (config['ie'] && Platform.operatingSystem != 'windows') { |
| 737 isValid = false; | 744 isValid = false; |
| 738 print("Warning cannot run Internet Explorer on non-Windows operating" | 745 print("Warning cannot run Internet Explorer on non-Windows operating" |
| 739 " system."); | 746 " system."); |
| 740 } | 747 } |
| 741 if (config['shard'] < 1 || config['shard'] > config['shards']) { | 748 if (config['shard'] < 1 || config['shard'] > config['shards']) { |
| 742 isValid = false; | 749 isValid = false; |
| 743 print("Error: shard index is ${config['shard']} out of " | 750 print("Error: shard index is ${config['shard']} out of " |
| 744 "${config['shards']} shards"); | 751 "${config['shards']} shards"); |
| 745 } | 752 } |
| 746 | 753 |
| 747 if (config['use_repository_packages'] && config['use_public_packages']) { | 754 if (config['use_repository_packages'] && config['use_public_packages']) { |
| 748 isValid = false; | 755 isValid = false; |
| 749 print("Cannot have both --use-repository-packages and " | 756 print("Cannot have both --use-repository-packages and " |
| 750 "--use-public-packages"); | 757 "--use-public-packages"); |
| 751 } | 758 } |
| 759 if ((config['runtime'] == 'flutter_engine') && (config['engine'] == '')) { | |
| 760 isValid = false; | |
| 761 print("-rflutter_engine requires the flutter engine executable to " | |
|
Bill Hesse
2017/01/05 17:48:33
This code seems contradictory to the code in test_
siva
2017/01/05 20:38:45
Good point, I have taken out the default setting a
| |
| 762 "be specified using --engine="); | |
| 763 } | |
| 764 if ((config['runtime'] == 'flutter_engine') && (config['arch'] != 'x64')) { | |
| 765 isValid = false; | |
| 766 print("-rflutter_engine is applicable only for --arch=x64"); | |
| 767 } | |
| 752 | 768 |
| 753 return isValid; | 769 return isValid; |
| 754 } | 770 } |
| 755 | 771 |
| 756 /** | 772 /** |
| 757 * Recursively expand a configuration with multiple values per key | 773 * Recursively expand a configuration with multiple values per key |
| 758 * into a list of configurations with exactly one value per key. | 774 * into a list of configurations with exactly one value per key. |
| 759 */ | 775 */ |
| 760 List<Map> _expandConfigurations(Map configuration) { | 776 List<Map> _expandConfigurations(Map configuration) { |
| 761 // Expand the pseudo-values such as 'all'. | 777 // Expand the pseudo-values such as 'all'. |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1001 if (option.keys.contains(name)) { | 1017 if (option.keys.contains(name)) { |
| 1002 return option; | 1018 return option; |
| 1003 } | 1019 } |
| 1004 } | 1020 } |
| 1005 print('Unknown test option $name'); | 1021 print('Unknown test option $name'); |
| 1006 exit(1); | 1022 exit(1); |
| 1007 } | 1023 } |
| 1008 | 1024 |
| 1009 List<_TestOptionSpecification> _options; | 1025 List<_TestOptionSpecification> _options; |
| 1010 } | 1026 } |
| OLD | NEW |