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 "utils.dart"; | 10 import "utils.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 'language', | 15 'language', |
16 'corelib', | 16 'corelib', |
17 'debugger', | 17 'debugger', |
18 'unsorted', | 18 'unsorted', |
19 'isolate', | 19 'isolate', |
20 'coroutine', | 20 'coroutine', |
21 'io', | 21 'io', |
22 'ffi', | 22 'ffi', |
23 'samples', | 23 'samples', |
24 'warnings', | 24 'warnings', |
25 'fletch_tests', | 25 'dartino_tests', |
26 'cc_tests', | 26 'cc_tests', |
27 'lib', | 27 'lib', |
28 'os', | 28 'os', |
29 'pkg', | 29 'pkg', |
30 'typed_data' | 30 'typed_data' |
31 ]; | 31 ]; |
32 | 32 |
33 /** | 33 /** |
34 * Specification of a single test option. | 34 * Specification of a single test option. |
35 * | 35 * |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 dart2js: Compile dart code to JavaScript by running dart2js. | 79 dart2js: Compile dart code to JavaScript by running dart2js. |
80 (only valid with the following runtimes: d8, drt, chrome, | 80 (only valid with the following runtimes: d8, drt, chrome, |
81 safari, ie9, ie10, ie11, firefox, opera, chromeOnAndroid, | 81 safari, ie9, ie10, ie11, firefox, opera, chromeOnAndroid, |
82 none (compile only)), | 82 none (compile only)), |
83 | 83 |
84 dartanalyzer: Perform static analysis on Dart code by running the analyzer on
Java. | 84 dartanalyzer: Perform static analysis on Dart code by running the analyzer on
Java. |
85 dart2analyzer: Perform static analysis on Dart code by running the analyzer o
n Dart. | 85 dart2analyzer: Perform static analysis on Dart code by running the analyzer o
n Dart. |
86 (only valid with the following runtimes: none)''', | 86 (only valid with the following runtimes: none)''', |
87 ['-c', '--compiler'], | 87 ['-c', '--compiler'], |
88 ['none', 'fletchc'], | 88 ['none', 'dartino_compiler'], |
89 'none'), | 89 'none'), |
90 // TODO(antonm): fix the option drt. | 90 // TODO(antonm): fix the option drt. |
91 new _TestOptionSpecification( | 91 new _TestOptionSpecification( |
92 'runtime', | 92 'runtime', |
93 '''Where the tests should be run. | 93 '''Where the tests should be run. |
94 vm: Run Dart code on the standalone dart vm. | 94 vm: Run Dart code on the standalone dart vm. |
95 | 95 |
96 d8: Run JavaScript from the command line using v8. | 96 d8: Run JavaScript from the command line using v8. |
97 | 97 |
98 jsshell: Run JavaScript from the command line using firefox js-shell. | 98 jsshell: Run JavaScript from the command line using firefox js-shell. |
99 | 99 |
100 drt: Run Dart or JavaScript in the headless version of Chrome, | 100 drt: Run Dart or JavaScript in the headless version of Chrome, |
101 Content shell. | 101 Content shell. |
102 | 102 |
103 dartium: Run Dart or JavaScript in Dartium. | 103 dartium: Run Dart or JavaScript in Dartium. |
104 | 104 |
105 ContentShellOnAndroid: Run Dart or JavaScript in Dartium content shell | 105 ContentShellOnAndroid: Run Dart or JavaScript in Dartium content shell |
106 on Android. | 106 on Android. |
107 | 107 |
108 DartiumOnAndroid: Run Dart or Javascript in Dartium on Android. | 108 DartiumOnAndroid: Run Dart or Javascript in Dartium on Android. |
109 | 109 |
110 [ff | chrome | safari | ie9 | ie10 | ie11 | opera | chromeOnAndroid]: | 110 [ff | chrome | safari | ie9 | ie10 | ie11 | opera | chromeOnAndroid]: |
111 Run JavaScript in the specified browser. | 111 Run JavaScript in the specified browser. |
112 | 112 |
113 none: No runtime, compile only (for example, used for dartanalyzer static | 113 none: No runtime, compile only (for example, used for dartanalyzer static |
114 analysis tests).''', | 114 analysis tests).''', |
115 ['-r', '--runtime'], | 115 ['-r', '--runtime'], |
116 ['none', 'fletchc', 'fletchvm', 'fletch_warnings', | 116 ['none', 'dartino_compiler', 'dartinovm', 'dartino_warnings', |
117 'fletch_tests', 'fletch_cc_tests'], | 117 'dartino_tests', 'dartino_cc_tests'], |
118 'fletch_warnings,fletch_tests,fletchc,' | 118 'dartino_warnings,dartino_tests,dartino_compiler,' |
119 'fletch_cc_tests'), | 119 'dartino_cc_tests'), |
120 new _TestOptionSpecification( | 120 new _TestOptionSpecification( |
121 'arch', | 121 'arch', |
122 'The architecture to run tests for', | 122 'The architecture to run tests for', |
123 ['-a', '--arch'], | 123 ['-a', '--arch'], |
124 ['all', 'ia32', 'x64', 'arm', 'arm64', 'mips', | 124 ['all', 'ia32', 'x64', 'arm', 'arm64', 'mips', |
125 'simarm', 'simarm64', 'simmips', 'xarm'], | 125 'simarm', 'simarm64', 'simmips', 'xarm'], |
126 'ia32'), | 126 'ia32'), |
127 new _TestOptionSpecification( | 127 new _TestOptionSpecification( |
128 'system', | 128 'system', |
129 'The operating system to run tests on', | 129 'The operating system to run tests on', |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 'build_directory', | 310 'build_directory', |
311 'The name of the build directory, where products are placed.', | 311 'The name of the build directory, where products are placed.', |
312 ['--build-directory'], | 312 ['--build-directory'], |
313 [], | 313 [], |
314 ''), | 314 ''), |
315 new _TestOptionSpecification( | 315 new _TestOptionSpecification( |
316 'noBatch', | 316 'noBatch', |
317 'Do not run tests in batch mode', | 317 'Do not run tests in batch mode', |
318 ['-n', '--nobatch'], | 318 ['-n', '--nobatch'], |
319 [], | 319 [], |
320 true, // Batch-mode breaks fletch_warnings. | 320 true, // Batch-mode breaks dartino_warnings. |
321 type: 'bool'), | 321 type: 'bool'), |
322 new _TestOptionSpecification( | 322 new _TestOptionSpecification( |
323 'dart2js_batch', | 323 'dart2js_batch', |
324 'Run dart2js tests in batch mode', | 324 'Run dart2js tests in batch mode', |
325 ['--dart2js-batch'], | 325 ['--dart2js-batch'], |
326 [], | 326 [], |
327 false, | 327 false, |
328 type: 'bool'), | 328 type: 'bool'), |
329 new _TestOptionSpecification( | 329 new _TestOptionSpecification( |
330 'append_logs', | 330 'append_logs', |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 type: 'int'), | 489 type: 'int'), |
490 new _TestOptionSpecification( | 490 new _TestOptionSpecification( |
491 'build_before_testing', | 491 'build_before_testing', |
492 "Build before running tests.", | 492 "Build before running tests.", |
493 ['--build-before-testing'], | 493 ['--build-before-testing'], |
494 [], | 494 [], |
495 1, | 495 1, |
496 type: 'int'), | 496 type: 'int'), |
497 new _TestOptionSpecification( | 497 new _TestOptionSpecification( |
498 'settings_file_name', | 498 'settings_file_name', |
499 'The fletch settings file to use for testing', | 499 'The dartino settings file to use for testing', |
500 ['--fletch-settings-file'], | 500 ['--dartino-settings-file'], |
501 [], | 501 [], |
502 '.fletch-settings'), | 502 '.dartino-settings'), |
503 new _TestOptionSpecification( | 503 new _TestOptionSpecification( |
504 'no_java', | 504 'no_java', |
505 "Don't require running java tests", | 505 "Don't require running java tests", |
506 ['--no-java'], | 506 ['--no-java'], |
507 [], | 507 [], |
508 false, | 508 false, |
509 type: 'bool'), | 509 type: 'bool'), |
510 ]; | 510 ]; |
511 } | 511 } |
512 | 512 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 } | 679 } |
680 | 680 |
681 /** | 681 /** |
682 * Determine if a particular configuration has a valid combination of compiler | 682 * Determine if a particular configuration has a valid combination of compiler |
683 * and runtime elements. | 683 * and runtime elements. |
684 */ | 684 */ |
685 bool _isValidConfig(Map config) { | 685 bool _isValidConfig(Map config) { |
686 bool isValid = true; | 686 bool isValid = true; |
687 List<String> validRuntimes; | 687 List<String> validRuntimes; |
688 switch (config['compiler']) { | 688 switch (config['compiler']) { |
689 case 'fletchc': | 689 case 'dartino_compiler': |
690 validRuntimes = const ['none', 'fletchvm']; | 690 validRuntimes = const ['none', 'dartinovm']; |
691 break; | 691 break; |
692 case 'none': | 692 case 'none': |
693 validRuntimes = const [ | 693 validRuntimes = const [ |
694 'fletchc', 'fletch_warnings', 'fletch_tests', 'fletch_cc_tests']; | 694 'dartino_compiler', 'dartino_warnings', 'dartino_tests', 'dartino_cc
_tests']; |
695 break; | 695 break; |
696 } | 696 } |
697 if (!validRuntimes.contains(config['runtime'])) { | 697 if (!validRuntimes.contains(config['runtime'])) { |
698 isValid = false; | 698 isValid = false; |
699 print("Warning: combination of compiler '${config['compiler']}' and " | 699 print("Warning: combination of compiler '${config['compiler']}' and " |
700 "runtime '${config['runtime']}' is invalid. " | 700 "runtime '${config['runtime']}' is invalid. " |
701 "Skipping this combination."); | 701 "Skipping this combination."); |
702 } | 702 } |
703 if ((config['runtime'] == 'ie9' || config['runtime'] == 'ie10') && | 703 if ((config['runtime'] == 'ie9' || config['runtime'] == 'ie10') && |
704 Platform.operatingSystem != 'windows') { | 704 Platform.operatingSystem != 'windows') { |
705 isValid = false; | 705 isValid = false; |
706 print("Warning cannot run Internet Explorer on non-Windows operating" | 706 print("Warning cannot run Internet Explorer on non-Windows operating" |
707 " system."); | 707 " system."); |
708 } | 708 } |
709 if (config['shard'] < 1 || config['shard'] > config['shards']) { | 709 if (config['shard'] < 1 || config['shard'] > config['shards']) { |
710 isValid = false; | 710 isValid = false; |
711 print("Error: shard index is ${config['shard']} out of " | 711 print("Error: shard index is ${config['shard']} out of " |
712 "${config['shards']} shards"); | 712 "${config['shards']} shards"); |
713 } | 713 } |
714 | 714 |
715 if (config['use_repository_packages'] && config['use_public_packages']) { | 715 if (config['use_repository_packages'] && config['use_public_packages']) { |
716 isValid = false; | 716 isValid = false; |
717 print("Cannot have both --use-repository-packages and " | 717 print("Cannot have both --use-repository-packages and " |
718 "--use-public-packages"); | 718 "--use-public-packages"); |
719 } | 719 } |
720 | 720 |
721 if (config['runtime'] == 'fletchc' && !config['host_checked']) { | 721 if (config['runtime'] == 'dartino_compiler' && !config['host_checked']) { |
722 isValid = false; | 722 isValid = false; |
723 // TODO(ahe): Find a way to make this optional. | 723 // TODO(ahe): Find a way to make this optional. |
724 print("fletch requires --host-checked option."); | 724 print("dartino requires --host-checked option."); |
725 } | 725 } |
726 | 726 |
727 if (config['system'] == 'lk' && | 727 if (config['system'] == 'lk' && |
728 (config['compiler'] != 'fletchc' || | 728 (config['compiler'] != 'dartino_compiler' || |
729 config['runtime'] != 'fletchvm')) { | 729 config['runtime'] != 'dartinovm')) { |
730 isValid = false; | 730 isValid = false; |
731 print("Running tests on LK works only in the " | 731 print("Running tests on LK works only in the " |
732 "--compiler=fletchc --runtime=fletchvm configuration."); | 732 "--compiler=dartino_compiler --runtime=dartinovm configuration."); |
733 } | 733 } |
734 | 734 |
735 return isValid; | 735 return isValid; |
736 } | 736 } |
737 | 737 |
738 /** | 738 /** |
739 * Recursively expand a configuration with multiple values per key | 739 * Recursively expand a configuration with multiple values per key |
740 * into a list of configurations with exactly one value per key. | 740 * into a list of configurations with exactly one value per key. |
741 */ | 741 */ |
742 List<Map> _expandConfigurations(Map configuration) { | 742 List<Map> _expandConfigurations(Map configuration) { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 return option; | 945 return option; |
946 } | 946 } |
947 } | 947 } |
948 print('Unknown test option $name'); | 948 print('Unknown test option $name'); |
949 exit(1); | 949 exit(1); |
950 } | 950 } |
951 | 951 |
952 | 952 |
953 List<_TestOptionSpecification> _options; | 953 List<_TestOptionSpecification> _options; |
954 } | 954 } |
OLD | NEW |