| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * Classes and methods for enumerating and preparing tests. | 6 * Classes and methods for enumerating and preparing tests. |
| 7 * | 7 * |
| 8 * This library includes: | 8 * This library includes: |
| 9 * | 9 * |
| 10 * - Creating tests by listing all the Dart files in certain directories, | 10 * - Creating tests by listing all the Dart files in certain directories, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 * no compiler should be used. | 134 * no compiler should be used. |
| 135 */ | 135 */ |
| 136 String get compilerPath { | 136 String get compilerPath { |
| 137 if (configuration['compiler'] == 'none') { | 137 if (configuration['compiler'] == 'none') { |
| 138 return null; // No separate compiler for dartium tests. | 138 return null; // No separate compiler for dartium tests. |
| 139 } | 139 } |
| 140 var name; | 140 var name; |
| 141 switch (configuration['compiler']) { | 141 switch (configuration['compiler']) { |
| 142 case 'dartc': | 142 case 'dartc': |
| 143 case 'dartanalyzer': | 143 case 'dartanalyzer': |
| 144 case 'dart2analyzer': |
| 144 name = executablePath; | 145 name = executablePath; |
| 145 break; | 146 break; |
| 146 case 'dart2js': | 147 case 'dart2js': |
| 147 case 'dart2dart': | 148 case 'dart2dart': |
| 148 var prefix = 'sdk/bin/'; | 149 var prefix = 'sdk/bin/'; |
| 149 String suffix = getExecutableSuffix(configuration['compiler']); | 150 String suffix = getExecutableSuffix(configuration['compiler']); |
| 150 if (configuration['host_checked']) { | 151 if (configuration['host_checked']) { |
| 151 // The script dart2js_developer is not included in the | 152 // The script dart2js_developer is not included in the |
| 152 // shipped SDK, that is the script is not installed in | 153 // shipped SDK, that is the script is not installed in |
| 153 // "$buildDir/dart-sdk/bin/" | 154 // "$buildDir/dart-sdk/bin/" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 176 switch (configuration['compiler']) { | 177 switch (configuration['compiler']) { |
| 177 case 'none': | 178 case 'none': |
| 178 if (useSdk) { | 179 if (useSdk) { |
| 179 return '$buildDir/dart-sdk/bin/dart$suffix'; | 180 return '$buildDir/dart-sdk/bin/dart$suffix'; |
| 180 } | 181 } |
| 181 return '$buildDir/dart$suffix'; | 182 return '$buildDir/dart$suffix'; |
| 182 case 'dartc': | 183 case 'dartc': |
| 183 return '$buildDir/analyzer/bin/dart_analyzer$suffix'; | 184 return '$buildDir/analyzer/bin/dart_analyzer$suffix'; |
| 184 case 'dartanalyzer': | 185 case 'dartanalyzer': |
| 185 return 'sdk/bin/dartanalyzer_developer$suffix'; | 186 return 'sdk/bin/dartanalyzer_developer$suffix'; |
| 187 case 'dart2analyzer': |
| 188 return 'sdk/bin/dart2analyzer_developer$suffix'; |
| 186 default: | 189 default: |
| 187 throw "Unknown executable for: ${configuration['compiler']}"; | 190 throw "Unknown executable for: ${configuration['compiler']}"; |
| 188 } | 191 } |
| 189 } | 192 } |
| 190 | 193 |
| 191 String get dartShellFileName { | 194 String get dartShellFileName { |
| 192 var name = configuration['dart']; | 195 var name = configuration['dart']; |
| 193 if (name == '') { | 196 if (name == '') { |
| 194 name = executablePath; | 197 name = executablePath; |
| 195 } | 198 } |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 '--ignore-unrecognized-flags', '$tempDir/out.dart']); | 789 '--ignore-unrecognized-flags', '$tempDir/out.dart']); |
| 787 commands.add(new Command(vmFileName, vmArguments)); | 790 commands.add(new Command(vmFileName, vmArguments)); |
| 788 } else { | 791 } else { |
| 789 throw 'Unsupported runtime ${configuration["runtime"]} for dart2dart'; | 792 throw 'Unsupported runtime ${configuration["runtime"]} for dart2dart'; |
| 790 } | 793 } |
| 791 return commands; | 794 return commands; |
| 792 | 795 |
| 793 case 'none': | 796 case 'none': |
| 794 case 'dartc': | 797 case 'dartc': |
| 795 case 'dartanalyzer': | 798 case 'dartanalyzer': |
| 799 case 'dart2analyzer': |
| 796 var arguments = new List.from(vmOptions); | 800 var arguments = new List.from(vmOptions); |
| 797 arguments.addAll(args); | 801 arguments.addAll(args); |
| 798 return <Command>[new Command(dartShellFileName, arguments)]; | 802 return <Command>[new Command(dartShellFileName, arguments)]; |
| 799 | 803 |
| 800 default: | 804 default: |
| 801 throw 'Unknown compiler ${configuration["compiler"]}'; | 805 throw 'Unknown compiler ${configuration["compiler"]}'; |
| 802 } | 806 } |
| 803 } | 807 } |
| 804 | 808 |
| 805 CreateTest makeTestCaseCreator(Map optionsFromFile) { | 809 CreateTest makeTestCaseCreator(Map optionsFromFile) { |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 .replaceAll('\\', '/'); | 1166 .replaceAll('\\', '/'); |
| 1163 } | 1167 } |
| 1164 | 1168 |
| 1165 String get scriptType { | 1169 String get scriptType { |
| 1166 switch (configuration['compiler']) { | 1170 switch (configuration['compiler']) { |
| 1167 case 'none': | 1171 case 'none': |
| 1168 case 'dart2dart': | 1172 case 'dart2dart': |
| 1169 return 'application/dart'; | 1173 return 'application/dart'; |
| 1170 case 'dart2js': | 1174 case 'dart2js': |
| 1171 case 'dartanalyzer': | 1175 case 'dartanalyzer': |
| 1176 case 'dart2analyzer': |
| 1172 case 'dartc': | 1177 case 'dartc': |
| 1173 return 'text/javascript'; | 1178 return 'text/javascript'; |
| 1174 default: | 1179 default: |
| 1175 print('Non-web runtime, so no scriptType for: ' | 1180 print('Non-web runtime, so no scriptType for: ' |
| 1176 '${configuration["compiler"]}'); | 1181 '${configuration["compiler"]}'); |
| 1177 exit(1); | 1182 exit(1); |
| 1178 return null; | 1183 return null; |
| 1179 } | 1184 } |
| 1180 } | 1185 } |
| 1181 | 1186 |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 return BROWSERS.contains(runtime); | 1843 return BROWSERS.contains(runtime); |
| 1839 } | 1844 } |
| 1840 | 1845 |
| 1841 static bool isBrowserRuntime(String runtime) => | 1846 static bool isBrowserRuntime(String runtime) => |
| 1842 runtime == 'drt' || TestUtils.usesWebDriver(runtime); | 1847 runtime == 'drt' || TestUtils.usesWebDriver(runtime); |
| 1843 | 1848 |
| 1844 static bool isJsCommandLineRuntime(String runtime) => | 1849 static bool isJsCommandLineRuntime(String runtime) => |
| 1845 const ['d8', 'jsshell'].contains(runtime); | 1850 const ['d8', 'jsshell'].contains(runtime); |
| 1846 | 1851 |
| 1847 static bool isCommandLineAnalyzer(String compiler) => | 1852 static bool isCommandLineAnalyzer(String compiler) => |
| 1848 compiler == 'dartc' || compiler == 'dartanalyzer'; | 1853 compiler == 'dartc' || compiler == 'dartanalyzer' || compiler == 'dart2ana
lyzer'; |
| 1849 | 1854 |
| 1850 static String buildDir(Map configuration) { | 1855 static String buildDir(Map configuration) { |
| 1851 // FIXME(kustermann,ricow): Our code assumes that the returned 'buildDir' | 1856 // FIXME(kustermann,ricow): Our code assumes that the returned 'buildDir' |
| 1852 // is relative to the current working directory. | 1857 // is relative to the current working directory. |
| 1853 // Thus, if we pass in an absolute path (e.g. '--build-directory=/tmp/out') | 1858 // Thus, if we pass in an absolute path (e.g. '--build-directory=/tmp/out') |
| 1854 // we get into trouble. | 1859 // we get into trouble. |
| 1855 if (configuration['build_directory'] != '') { | 1860 if (configuration['build_directory'] != '') { |
| 1856 return configuration['build_directory']; | 1861 return configuration['build_directory']; |
| 1857 } | 1862 } |
| 1858 var outputDir = ''; | 1863 var outputDir = ''; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1946 * $pass tests are expected to pass | 1951 * $pass tests are expected to pass |
| 1947 * $failOk tests are expected to fail that we won't fix | 1952 * $failOk tests are expected to fail that we won't fix |
| 1948 * $fail tests are expected to fail that we should fix | 1953 * $fail tests are expected to fail that we should fix |
| 1949 * $crash tests are expected to crash that we should fix | 1954 * $crash tests are expected to crash that we should fix |
| 1950 * $timeout tests are allowed to timeout | 1955 * $timeout tests are allowed to timeout |
| 1951 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1956 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 1952 """; | 1957 """; |
| 1953 print(report); | 1958 print(report); |
| 1954 } | 1959 } |
| 1955 } | 1960 } |
| OLD | NEW |