| 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:io"); | 7 #import("dart:io"); |
| 8 #import("test_suite.dart"); | 8 #import("test_suite.dart"); |
| 9 | 9 |
| 10 // Multitests are Dart test scripts containing lines of the form | 10 // Multitests are Dart test scripts containing lines of the form |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 Path sourceDir = filePath.directoryPath; | 208 Path sourceDir = filePath.directoryPath; |
| 209 Path targetDir = CreateMultitestDirectory(outputDir, suiteDir); | 209 Path targetDir = CreateMultitestDirectory(outputDir, suiteDir); |
| 210 Expect.isNotNull(targetDir); | 210 Expect.isNotNull(targetDir); |
| 211 | 211 |
| 212 // Copy all the relative imports of the multitest. | 212 // Copy all the relative imports of the multitest. |
| 213 Set<Path> importsToCopy = _findAllRelativeImports(filePath); | 213 Set<Path> importsToCopy = _findAllRelativeImports(filePath); |
| 214 List<Future> futureCopies = []; | 214 List<Future> futureCopies = []; |
| 215 for (Path importPath in importsToCopy) { | 215 for (Path importPath in importsToCopy) { |
| 216 // Make sure the target directory exists. | 216 // Make sure the target directory exists. |
| 217 Path importDir = importPath.directoryPath; | 217 Path importDir = importPath.directoryPath; |
| 218 TestUtils.mkdirRecursive(targetDir, importDir); | 218 if (!importDir.isEmpty) { |
| 219 TestUtils.mkdirRecursive(targetDir, importDir); |
| 220 } |
| 219 // Copy file. | 221 // Copy file. |
| 220 futureCopies.add(TestUtils.copyFile(sourceDir.join(importPath), | 222 futureCopies.add(TestUtils.copyFile(sourceDir.join(importPath), |
| 221 targetDir.join(importPath))); | 223 targetDir.join(importPath))); |
| 222 } | 224 } |
| 223 | 225 |
| 224 // Wait until all imports are copied before scheduling test cases. | 226 // Wait until all imports are copied before scheduling test cases. |
| 225 Futures.wait(futureCopies).then((ignored) { | 227 Futures.wait(futureCopies).then((ignored) { |
| 226 String baseFilename = filePath.filenameWithoutExtension; | 228 String baseFilename = filePath.filenameWithoutExtension; |
| 227 for (String key in tests.getKeys()) { | 229 for (String key in tests.getKeys()) { |
| 228 final Path multitestFilename = | 230 final Path multitestFilename = |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // TestSuite.forDirectory. | 269 // TestSuite.forDirectory. |
| 268 split.removeLast(); | 270 split.removeLast(); |
| 269 } | 271 } |
| 270 String path = '${generatedTestDir.path}/${split.last()}'; | 272 String path = '${generatedTestDir.path}/${split.last()}'; |
| 271 Directory dir = new Directory(path); | 273 Directory dir = new Directory(path); |
| 272 if (!dir.existsSync()) { | 274 if (!dir.existsSync()) { |
| 273 dir.createSync(); | 275 dir.createSync(); |
| 274 } | 276 } |
| 275 return new Path.fromNative(new File(path).fullPathSync()); | 277 return new Path.fromNative(new File(path).fullPathSync()); |
| 276 } | 278 } |
| OLD | NEW |