Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Unified Diff: tools/testing/dart/test_suite.dart

Issue 9565001: Enable use of #import stmts containing relative paths in Dart multitests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed relative path exclusion. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/testing/dart/multitest.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/test_suite.dart
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index c1286c8b60a64cf1072a2377e9cab0b311c150e3..b83c2acf64b1c1c2843a7c8cc5f7730d44f9bf48 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -670,15 +670,8 @@ class StandardTestSuite implements TestSuite {
tempDir.createSync();
}
}
- tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/');
-
- for (String subdirectory in generatedTestPath) {
- tempDirPath = '$tempDirPath/$subdirectory';
- tempDir = new Directory(tempDirPath);
- if (!tempDir.existsSync()) {
- tempDir.createSync();
- }
- }
+ TestUtils.mkdirRecursive(tempDirPath,
+ Strings.join(generatedTestPath, '/'));
return tempDir;
}
@@ -1023,6 +1016,39 @@ class JUnitTestSuite implements TestSuite {
class TestUtils {
+
+ /**
+ * Creates a directory using a [relativePath] to an existing
+ * [base] directory if that [relativePath] does not already exist.
+ */
+ static void mkdirRecursive(String base, String relativePath) {
+ Directory baseDir = new Directory(base);
+ Expect.isTrue(baseDir.existsSync(),
+ "This method expects ${base} to already exist");
+ String pathSep = new Platform().pathSeparator();
+ if (pathSep != '/') {
+ relativePath = relativePath.replaceAll(pathSep, '/');
+ }
+ for (String dir in relativePath.split('/')) {
+ var tempDir = new Directory('$base/$dir');
+ if (!tempDir.existsSync()) {
+ tempDir.createSync();
+ }
+ base = "$base/$dir";
+ }
+ }
+
+ /**
+ * Copy a [source] file to a new place.
+ * Assumes that the directory for [dest] already exists.
+ */
+ static void copyFile(File source, File dest) {
+ List contents = source.readAsBytesSync();
+ RandomAccessFile handle = dest.openSync(FileMode.WRITE);
+ handle.writeListSync(contents, 0, contents.length);
+ handle.closeSync();
+ }
+
static String executableSuffix(String component) {
if (new Platform().operatingSystem() == 'windows') {
if (component != 'frogium'
« no previous file with comments | « tools/testing/dart/multitest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698