Index: tools/testing/dart/multitest.dart |
diff --git a/tools/testing/dart/multitest.dart b/tools/testing/dart/multitest.dart |
index eb85c1a0d86f58626bd7f4991f92f1ce699fb12a..b714e718e84412fefbadc5c2110b410677346906 100644 |
--- a/tools/testing/dart/multitest.dart |
+++ b/tools/testing/dart/multitest.dart |
@@ -245,7 +245,7 @@ Future doMultitest( |
ExtractTestsFromMultitest(filePath, tests, outcomes); |
Path sourceDir = filePath.directoryPath; |
- Path targetDir = CreateMultitestDirectory(outputDir, suiteDir); |
+ Path targetDir = createMultitestDirectory(outputDir, suiteDir, sourceDir); |
assert(targetDir != null); |
// Copy all the relative imports of the multitest. |
@@ -295,24 +295,19 @@ Future doMultitest( |
}); |
} |
-Path CreateMultitestDirectory(String outputDir, Path suiteDir) { |
- Directory generatedTestDir = new Directory('$outputDir/generated_tests'); |
- if (!new Directory(outputDir).existsSync()) { |
- new Directory(outputDir).createSync(); |
- } |
- if (!generatedTestDir.existsSync()) { |
- generatedTestDir.createSync(); |
- } |
+String suiteNameFromPath(Path suiteDir) { |
var split = suiteDir.segments(); |
+ // co19 test suite is at tests/co19/src. |
if (split.last == 'src') { |
- // TODO(sigmund): remove this once all tests are migrated to use |
- // TestSuite.forDirectory. |
split.removeLast(); |
} |
- String path = '${generatedTestDir.path}/${split.last}'; |
- Directory dir = new Directory(path); |
- if (!dir.existsSync()) { |
- dir.createSync(); |
- } |
- return new Path(new File(path).absolute.path); |
+ return split.last; |
+} |
+ |
+Path createMultitestDirectory(String outputDir, Path suiteDir, Path sourceDir) { |
+ Path relative = sourceDir.relativeTo(suiteDir); |
+ Path path = new Path(outputDir).append('generated_tests') |
+ .append(suiteNameFromPath(suiteDir)).join(relative); |
+ TestUtils.mkdirRecursive(TestUtils.currentWorkingDirectory, path); |
+ return new Path(new File(path.toNativePath()).absolute.path); |
} |