| 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 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2212 } | 2212 } |
| 2213 | 2213 |
| 2214 static String testOutcomeFileName() { | 2214 static String testOutcomeFileName() { |
| 2215 // If test.py was invoked with '--write-test-outcome-log it will write | 2215 // If test.py was invoked with '--write-test-outcome-log it will write |
| 2216 // test outcomes to this file. | 2216 // test outcomes to this file. |
| 2217 return ".test-outcome.log"; | 2217 return ".test-outcome.log"; |
| 2218 } | 2218 } |
| 2219 | 2219 |
| 2220 static void ensureExists(String filename, Map configuration) { | 2220 static void ensureExists(String filename, Map configuration) { |
| 2221 if (!configuration['list'] && !existsCache.doesFileExist(filename)) { | 2221 if (!configuration['list'] && !existsCache.doesFileExist(filename)) { |
| 2222 try { |
| 2222 throw "'$filename' does not exist"; | 2223 throw "'$filename' does not exist"; |
| 2224 }catch (e,s) { |
| 2225 print(s); |
| 2226 rethrow; |
| 2227 } |
| 2223 } | 2228 } |
| 2224 } | 2229 } |
| 2225 | 2230 |
| 2226 static Path absolutePath(Path path) { | 2231 static Path absolutePath(Path path) { |
| 2227 if (!path.isAbsolute) { | 2232 if (!path.isAbsolute) { |
| 2228 return currentWorkingDirectory.join(path); | 2233 return currentWorkingDirectory.join(path); |
| 2229 } | 2234 } |
| 2230 return path; | 2235 return path; |
| 2231 } | 2236 } |
| 2232 | 2237 |
| 2233 static String outputDir(Map configuration) { | 2238 static String outputDir(Map configuration) { |
| 2234 var result = ''; | 2239 var result = ''; |
| 2235 var system = configuration['system']; | 2240 var system = configuration['system']; |
| 2236 if (system == 'linux') { | 2241 if (system == 'linux' || system == 'android') { |
| 2237 result = 'out/'; | 2242 result = 'out/'; |
| 2238 } else if (system == 'macos') { | 2243 } else if (system == 'macos') { |
| 2239 result = 'xcodebuild/'; | 2244 result = 'xcodebuild/'; |
| 2240 } else if (system == 'windows') { | 2245 } else if (system == 'windows') { |
| 2241 result = 'build/'; | 2246 result = 'build/'; |
| 2247 } else { |
| 2248 throw new Exception('Unknown operating system: "$system"'); |
| 2242 } | 2249 } |
| 2243 return result; | 2250 return result; |
| 2244 } | 2251 } |
| 2245 | 2252 |
| 2246 static List<String> standardOptions(Map configuration) { | 2253 static List<String> standardOptions(Map configuration) { |
| 2247 List args = ["--ignore-unrecognized-flags"]; | 2254 List args = ["--ignore-unrecognized-flags"]; |
| 2248 String compiler = configuration["compiler"]; | 2255 String compiler = configuration["compiler"]; |
| 2249 if (compiler == "dart2js") { | 2256 if (compiler == "dart2js") { |
| 2250 args = ['--generate-code-with-compile-time-errors', '--test-mode']; | 2257 args = ['--generate-code-with-compile-time-errors', '--test-mode']; |
| 2251 if (configuration["checked"]) { | 2258 if (configuration["checked"]) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2328 break; | 2335 break; |
| 2329 case 'release': | 2336 case 'release': |
| 2330 mode = 'Release'; | 2337 mode = 'Release'; |
| 2331 break; | 2338 break; |
| 2332 case 'product': | 2339 case 'product': |
| 2333 mode = 'Product'; | 2340 mode = 'Product'; |
| 2334 break; | 2341 break; |
| 2335 default: | 2342 default: |
| 2336 throw 'Unrecognized mode configuration: ${configuration['mode']}'; | 2343 throw 'Unrecognized mode configuration: ${configuration['mode']}'; |
| 2337 } | 2344 } |
| 2345 var os; |
| 2346 switch (configuration['system']) { |
| 2347 case 'android': |
| 2348 os = 'Android'; |
| 2349 break; |
| 2350 case 'linux': |
| 2351 case 'macos': |
| 2352 case 'windows': |
| 2353 os = ''; |
| 2354 break; |
| 2355 default: |
| 2356 throw 'Unrecognized operating system: ${configuration['system']}'; |
| 2357 } |
| 2338 var arch = configuration['arch'].toUpperCase(); | 2358 var arch = configuration['arch'].toUpperCase(); |
| 2339 var normal = '$mode$arch'; | 2359 var normal = '$mode$os$arch'; |
| 2340 var cross = '${mode}X$arch'; | 2360 var cross = '$mode${os}X$arch'; |
| 2341 var outDir = outputDir(configuration); | 2361 var outDir = outputDir(configuration); |
| 2342 var normalDir = new Directory(new Path('$outDir$normal').toNativePath()); | 2362 var normalDir = new Directory(new Path('$outDir$normal').toNativePath()); |
| 2343 var crossDir = new Directory(new Path('$outDir$cross').toNativePath()); | 2363 var crossDir = new Directory(new Path('$outDir$cross').toNativePath()); |
| 2344 if (normalDir.existsSync() && crossDir.existsSync()) { | 2364 if (normalDir.existsSync() && crossDir.existsSync()) { |
| 2345 throw "You can't have both $normalDir and $crossDir, we don't know which" | 2365 throw "You can't have both $normalDir and $crossDir, we don't know which" |
| 2346 " binary to use"; | 2366 " binary to use"; |
| 2347 } | 2367 } |
| 2348 if (crossDir.existsSync()) { | 2368 if (crossDir.existsSync()) { |
| 2349 return cross; | 2369 return cross; |
| 2350 } | 2370 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 for (var key in PATH_REPLACEMENTS.keys) { | 2457 for (var key in PATH_REPLACEMENTS.keys) { |
| 2438 if (path.startsWith(key)) { | 2458 if (path.startsWith(key)) { |
| 2439 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); | 2459 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); |
| 2440 break; | 2460 break; |
| 2441 } | 2461 } |
| 2442 } | 2462 } |
| 2443 } | 2463 } |
| 2444 return path; | 2464 return path; |
| 2445 } | 2465 } |
| 2446 } | 2466 } |
| OLD | NEW |