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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 * The path to the compiler for this suite's configuration. Returns `null` if | 133 * The path to the compiler for this suite's configuration. Returns `null` if |
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 'new_analyzer': | 143 case 'dartanalyzer': |
144 name = executablePath; | 144 name = executablePath; |
145 break; | 145 break; |
146 case 'dart2js': | 146 case 'dart2js': |
147 case 'dart2dart': | 147 case 'dart2dart': |
148 var prefix = 'sdk/bin/'; | 148 var prefix = 'sdk/bin/'; |
149 String suffix = getExecutableSuffix(configuration['compiler']); | 149 String suffix = getExecutableSuffix(configuration['compiler']); |
150 if (configuration['host_checked']) { | 150 if (configuration['host_checked']) { |
151 // The script dart2js_developer is not included in the | 151 // The script dart2js_developer is not included in the |
152 // shipped SDK, that is the script is not installed in | 152 // shipped SDK, that is the script is not installed in |
153 // "$buildDir/dart-sdk/bin/" | 153 // "$buildDir/dart-sdk/bin/" |
(...skipping 20 matching lines...) Expand all Loading... |
174 String get executablePath { | 174 String get executablePath { |
175 var suffix = getExecutableSuffix(configuration['compiler']); | 175 var suffix = getExecutableSuffix(configuration['compiler']); |
176 switch (configuration['compiler']) { | 176 switch (configuration['compiler']) { |
177 case 'none': | 177 case 'none': |
178 if (useSdk) { | 178 if (useSdk) { |
179 return '$buildDir/dart-sdk/bin/dart$suffix'; | 179 return '$buildDir/dart-sdk/bin/dart$suffix'; |
180 } | 180 } |
181 return '$buildDir/dart$suffix'; | 181 return '$buildDir/dart$suffix'; |
182 case 'dartc': | 182 case 'dartc': |
183 return '$buildDir/analyzer/bin/dart_analyzer$suffix'; | 183 return '$buildDir/analyzer/bin/dart_analyzer$suffix'; |
184 case 'new_analyzer': | 184 case 'dartanalyzer': |
185 return 'sdk/bin/analyzer$suffix'; | 185 return 'sdk/bin/dartanalyzer$suffix'; |
186 default: | 186 default: |
187 throw "Unknown executable for: ${configuration['compiler']}"; | 187 throw "Unknown executable for: ${configuration['compiler']}"; |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 /** | 191 /** |
192 * The file name of the d8 executable. | 192 * The file name of the d8 executable. |
193 */ | 193 */ |
194 String get d8FileName { | 194 String get d8FileName { |
195 var suffix = getExecutableSuffix('d8'); | 195 var suffix = getExecutableSuffix('d8'); |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 vmArguments.addAll([ | 774 vmArguments.addAll([ |
775 '--ignore-unrecognized-flags', '$tempDir/out.dart']); | 775 '--ignore-unrecognized-flags', '$tempDir/out.dart']); |
776 commands.add(new Command(vmFileName, vmArguments)); | 776 commands.add(new Command(vmFileName, vmArguments)); |
777 } else { | 777 } else { |
778 throw 'Unsupported runtime ${configuration["runtime"]} for dart2dart'; | 778 throw 'Unsupported runtime ${configuration["runtime"]} for dart2dart'; |
779 } | 779 } |
780 return commands; | 780 return commands; |
781 | 781 |
782 case 'none': | 782 case 'none': |
783 case 'dartc': | 783 case 'dartc': |
784 case 'new_analyzer': | 784 case 'dartanalyzer': |
785 var arguments = new List.from(vmOptions); | 785 var arguments = new List.from(vmOptions); |
786 arguments.addAll(args); | 786 arguments.addAll(args); |
787 return <Command>[new Command(dartShellFileName, arguments)]; | 787 return <Command>[new Command(dartShellFileName, arguments)]; |
788 | 788 |
789 default: | 789 default: |
790 throw 'Unknown compiler ${configuration["compiler"]}'; | 790 throw 'Unknown compiler ${configuration["compiler"]}'; |
791 } | 791 } |
792 } | 792 } |
793 | 793 |
794 CreateTest makeTestCaseCreator(Map optionsFromFile) { | 794 CreateTest makeTestCaseCreator(Map optionsFromFile) { |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 return new File.fromPath(generatedTestPath).fullPathSync() | 1163 return new File.fromPath(generatedTestPath).fullPathSync() |
1164 .replaceAll('\\', '/'); | 1164 .replaceAll('\\', '/'); |
1165 } | 1165 } |
1166 | 1166 |
1167 String get scriptType { | 1167 String get scriptType { |
1168 switch (configuration['compiler']) { | 1168 switch (configuration['compiler']) { |
1169 case 'none': | 1169 case 'none': |
1170 case 'dart2dart': | 1170 case 'dart2dart': |
1171 return 'application/dart'; | 1171 return 'application/dart'; |
1172 case 'dart2js': | 1172 case 'dart2js': |
1173 case 'new_analyzer': | 1173 case 'dartanalyzer': |
1174 case 'dartc': | 1174 case 'dartc': |
1175 return 'text/javascript'; | 1175 return 'text/javascript'; |
1176 default: | 1176 default: |
1177 Expect.fail('Non-web runtime, so no scriptType for: ' | 1177 Expect.fail('Non-web runtime, so no scriptType for: ' |
1178 '${configuration["compiler"]}'); | 1178 '${configuration["compiler"]}'); |
1179 return null; | 1179 return null; |
1180 } | 1180 } |
1181 } | 1181 } |
1182 | 1182 |
1183 bool get hasRuntime { | 1183 bool get hasRuntime { |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 return BROWSERS.contains(runtime); | 1857 return BROWSERS.contains(runtime); |
1858 } | 1858 } |
1859 | 1859 |
1860 static bool isBrowserRuntime(String runtime) => | 1860 static bool isBrowserRuntime(String runtime) => |
1861 runtime == 'drt' || TestUtils.usesWebDriver(runtime); | 1861 runtime == 'drt' || TestUtils.usesWebDriver(runtime); |
1862 | 1862 |
1863 static bool isJsCommandLineRuntime(String runtime) => | 1863 static bool isJsCommandLineRuntime(String runtime) => |
1864 const ['d8', 'jsshell'].contains(runtime); | 1864 const ['d8', 'jsshell'].contains(runtime); |
1865 | 1865 |
1866 static bool isCommandLineAnalyzer(String compiler) => | 1866 static bool isCommandLineAnalyzer(String compiler) => |
1867 compiler == 'dartc' || compiler == 'new_analyzer'; | 1867 compiler == 'dartc' || compiler == 'dartanalyzer'; |
1868 | 1868 |
1869 static String buildDir(Map configuration) { | 1869 static String buildDir(Map configuration) { |
1870 // FIXME(kustermann,ricow): Our code assumes that the returned 'buildDir' | 1870 // FIXME(kustermann,ricow): Our code assumes that the returned 'buildDir' |
1871 // is relative to the current working directory. | 1871 // is relative to the current working directory. |
1872 // Thus, if we pass in an absolute path (e.g. '--build-directory=/tmp/out') | 1872 // Thus, if we pass in an absolute path (e.g. '--build-directory=/tmp/out') |
1873 // we get into trouble. | 1873 // we get into trouble. |
1874 if (configuration['build_directory'] != '') { | 1874 if (configuration['build_directory'] != '') { |
1875 return configuration['build_directory']; | 1875 return configuration['build_directory']; |
1876 } | 1876 } |
1877 var outputDir = ''; | 1877 var outputDir = ''; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1965 * $pass tests are expected to pass | 1965 * $pass tests are expected to pass |
1966 * $failOk tests are expected to fail that we won't fix | 1966 * $failOk tests are expected to fail that we won't fix |
1967 * $fail tests are expected to fail that we should fix | 1967 * $fail tests are expected to fail that we should fix |
1968 * $crash tests are expected to crash that we should fix | 1968 * $crash tests are expected to crash that we should fix |
1969 * $timeout tests are allowed to timeout | 1969 * $timeout tests are allowed to timeout |
1970 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 1970 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
1971 """; | 1971 """; |
1972 print(report); | 1972 print(report); |
1973 } | 1973 } |
1974 } | 1974 } |
OLD | NEW |