| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 * and a status file containing the expected results when these tests are run. | 124 * and a status file containing the expected results when these tests are run. |
| 125 */ | 125 */ |
| 126 abstract class TestSuite { | 126 abstract class TestSuite { |
| 127 final Map configuration; | 127 final Map configuration; |
| 128 final String suiteName; | 128 final String suiteName; |
| 129 // This function is set by subclasses before enqueueing starts. | 129 // This function is set by subclasses before enqueueing starts. |
| 130 Function doTest; | 130 Function doTest; |
| 131 Map<String, String> _environmentOverrides; | 131 Map<String, String> _environmentOverrides; |
| 132 | 132 |
| 133 TestSuite(this.configuration, this.suiteName) { | 133 TestSuite(this.configuration, this.suiteName) { |
| 134 if (configuration['build_directory'] == '') { | 134 TestUtils.buildDir(configuration); // Sets configuration_directory. |
| 135 if (configuration['configuration_directory'] != null) { |
| 135 _environmentOverrides = { | 136 _environmentOverrides = { |
| 136 'DART_CONFIGURATION' : TestUtils.configurationDir(configuration) | 137 'DART_CONFIGURATION' : configuration['configuration_directory'] |
| 137 }; | 138 }; |
| 138 } | 139 } |
| 139 } | 140 } |
| 140 | 141 |
| 141 Map<String, String> get environmentOverrides => _environmentOverrides; | 142 Map<String, String> get environmentOverrides => _environmentOverrides; |
| 142 | 143 |
| 143 /** | 144 /** |
| 144 * Whether or not binaries should be found in the root build directory or | 145 * Whether or not binaries should be found in the root build directory or |
| 145 * in the built SDK. | 146 * in the built SDK. |
| 146 */ | 147 */ |
| (...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2253 const ['d8', 'jsshell'].contains(runtime); | 2254 const ['d8', 'jsshell'].contains(runtime); |
| 2254 | 2255 |
| 2255 static bool isCommandLineAnalyzer(String compiler) => | 2256 static bool isCommandLineAnalyzer(String compiler) => |
| 2256 compiler == 'dartanalyzer' || compiler == 'dart2analyzer'; | 2257 compiler == 'dartanalyzer' || compiler == 'dart2analyzer'; |
| 2257 | 2258 |
| 2258 static String buildDir(Map configuration) { | 2259 static String buildDir(Map configuration) { |
| 2259 // FIXME(kustermann,ricow): Our code assumes that the returned 'buildDir' | 2260 // FIXME(kustermann,ricow): Our code assumes that the returned 'buildDir' |
| 2260 // is relative to the current working directory. | 2261 // is relative to the current working directory. |
| 2261 // Thus, if we pass in an absolute path (e.g. '--build-directory=/tmp/out') | 2262 // Thus, if we pass in an absolute path (e.g. '--build-directory=/tmp/out') |
| 2262 // we get into trouble. | 2263 // we get into trouble. |
| 2263 if (configuration['build_directory'] != '') { | 2264 if (configuration['build_directory'] == '') { |
| 2264 return configuration['build_directory']; | 2265 configuration['configuration_directory'] = |
| 2266 configurationDir(configuration); |
| 2267 configuration['build_directory'] = |
| 2268 outputDir(configuration) + configuration['configuration_directory']; |
| 2265 } | 2269 } |
| 2266 | 2270 return configuration['build_directory']; |
| 2267 return "${outputDir(configuration)}${configurationDir(configuration)}"; | |
| 2268 } | 2271 } |
| 2269 | 2272 |
| 2270 static String configurationDir(Map configuration) { | 2273 static String configurationDir(Map configuration) { |
| 2271 // This returns the correct configuration directory (the last component | 2274 // This returns the correct configuration directory (the last component |
| 2272 // of the output directory path) for regular dart checkouts. | 2275 // of the output directory path) for regular dart checkouts. |
| 2273 // Do not call this function if the --build-directory option is used. | |
| 2274 // Dartium checkouts use the --build-directory option to pass in the | 2276 // Dartium checkouts use the --build-directory option to pass in the |
| 2275 // correct build directory explicitly. | 2277 // correct build directory explicitly. |
| 2276 // We allow our code to have been cross compiled, i.e., that there | 2278 // We allow our code to have been cross compiled, i.e., that there |
| 2277 // is an X in front of the arch. We don't allow both a cross compiled | 2279 // is an X in front of the arch. We don't allow both a cross compiled |
| 2278 // and a normal version to be present (except if you specifically pass | 2280 // and a normal version to be present (except if you specifically pass |
| 2279 // in the build_directory). | 2281 // in the build_directory). |
| 2280 if (configuration['build_directory'] != '') { | |
| 2281 throw "Internal test.dart error: Don't call TestUtils.configurationDir " | |
| 2282 "if the --build-directory option is used."; | |
| 2283 } | |
| 2284 var mode = (configuration['mode'] == 'debug') ? 'Debug' : 'Release'; | 2282 var mode = (configuration['mode'] == 'debug') ? 'Debug' : 'Release'; |
| 2285 var arch = configuration['arch'].toUpperCase(); | 2283 var arch = configuration['arch'].toUpperCase(); |
| 2286 var normal = '$mode$arch'; | 2284 var normal = '$mode$arch'; |
| 2287 var cross = '${mode}X$arch'; | 2285 var cross = '${mode}X$arch'; |
| 2288 var outDir = outputDir(configuration); | 2286 var outDir = outputDir(configuration); |
| 2289 var normalDir = new Directory(new Path('$outDir$normal').toNativePath()); | 2287 var normalDir = new Directory(new Path('$outDir$normal').toNativePath()); |
| 2290 var crossDir = new Directory(new Path('$outDir$cross').toNativePath()); | 2288 var crossDir = new Directory(new Path('$outDir$cross').toNativePath()); |
| 2291 if (normalDir.existsSync() && crossDir.existsSync()) { | 2289 if (normalDir.existsSync() && crossDir.existsSync()) { |
| 2292 throw "You can't have both $normalDir and $crossDir, we don't know which" | 2290 throw "You can't have both $normalDir and $crossDir, we don't know which" |
| 2293 " binary to use"; | 2291 " binary to use"; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2399 for (var key in PATH_REPLACEMENTS.keys) { | 2397 for (var key in PATH_REPLACEMENTS.keys) { |
| 2400 if (path.startsWith(key)) { | 2398 if (path.startsWith(key)) { |
| 2401 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); | 2399 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); |
| 2402 break; | 2400 break; |
| 2403 } | 2401 } |
| 2404 } | 2402 } |
| 2405 } | 2403 } |
| 2406 return path; | 2404 return path; |
| 2407 } | 2405 } |
| 2408 } | 2406 } |
| OLD | NEW |