| 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 library multitest; | 5 library multitest; |
| 6 | 6 |
| 7 import "dart:async"; | 7 import "dart:async"; |
| 8 import "dart:io"; | 8 import "dart:io"; |
| 9 import "test_suite.dart"; | 9 import "test_suite.dart"; |
| 10 import "utils.dart"; | 10 import "utils.dart"; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // Copy all the relative imports of the multitest. | 241 // Copy all the relative imports of the multitest. |
| 242 Set<String> importsToCopy = _findAllRelativeImports(filePath); | 242 Set<String> importsToCopy = _findAllRelativeImports(filePath); |
| 243 List<Future> futureCopies = []; | 243 List<Future> futureCopies = []; |
| 244 for (String relativeImport in importsToCopy) { | 244 for (String relativeImport in importsToCopy) { |
| 245 Path importPath = new Path(relativeImport); | 245 Path importPath = new Path(relativeImport); |
| 246 // Make sure the target directory exists. | 246 // Make sure the target directory exists. |
| 247 Path importDir = importPath.directoryPath; | 247 Path importDir = importPath.directoryPath; |
| 248 if (!importDir.isEmpty) { | 248 if (!importDir.isEmpty) { |
| 249 TestUtils.mkdirRecursive(targetDir, importDir); | 249 TestUtils.mkdirRecursive(targetDir, importDir); |
| 250 } | 250 } |
| 251 Path srcPath = sourceDir.join(importPath); | |
| 252 Path targetPath = targetDir.join(importPath); | |
| 253 // Copy file. | 251 // Copy file. |
| 254 futureCopies.add(TestUtils.copyIfDifferent(srcPath, targetPath)); | 252 futureCopies.add(TestUtils.copyFile(sourceDir.join(importPath), |
| 253 targetDir.join(importPath))); |
| 255 } | 254 } |
| 256 | 255 |
| 257 // Wait until all imports are copied before scheduling test cases. | 256 // Wait until all imports are copied before scheduling test cases. |
| 258 return Future.wait(futureCopies).then((_) { | 257 return Future.wait(futureCopies).then((_) { |
| 259 String baseFilename = filePath.filenameWithoutExtension; | 258 String baseFilename = filePath.filenameWithoutExtension; |
| 260 for (String key in tests.keys) { | 259 for (String key in tests.keys) { |
| 261 final Path multitestFilename = | 260 final Path multitestFilename = |
| 262 targetDir.append('${baseFilename}_$key.dart'); | 261 targetDir.append('${baseFilename}_$key.dart'); |
| 263 writeFile(multitestFilename.toNativePath(), tests[key]); | 262 writeFile(multitestFilename.toNativePath(), tests[key]); |
| 264 Set<String> outcome = outcomes[key]; | 263 Set<String> outcome = outcomes[key]; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // TestSuite.forDirectory. | 296 // TestSuite.forDirectory. |
| 298 split.removeLast(); | 297 split.removeLast(); |
| 299 } | 298 } |
| 300 String path = '${generatedTestDir.path}/${split.last}'; | 299 String path = '${generatedTestDir.path}/${split.last}'; |
| 301 Directory dir = new Directory(path); | 300 Directory dir = new Directory(path); |
| 302 if (!dir.existsSync()) { | 301 if (!dir.existsSync()) { |
| 303 dir.createSync(); | 302 dir.createSync(); |
| 304 } | 303 } |
| 305 return new Path(new File(path).absolute.path); | 304 return new Path(new File(path).absolute.path); |
| 306 } | 305 } |
| OLD | NEW |