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

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

Issue 9583016: Re-apply "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: 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..0d1ab42a80381e4d2174bd27bcb66c9868e61f92 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -670,6 +670,10 @@ class StandardTestSuite implements TestSuite {
tempDir.createSync();
}
}
+ // TODO(zundel): this actually creates and returns a path like
+ // 'out/Debug_ia32/Debug_ia32/generated-tests/...'
Bill Hesse 2012/03/05 09:41:02 The level of the directory that a generated test i
zundel 2012/03/05 11:34:36 Run this command in an unaltered version of test.d
+ // I think the extra mode/architecture label redundant, but after
+ // removing it I had lots of problems with browser tests.
zundel 2012/03/02 18:25:03 in my previous patch, I replaced all of the below
Bill Hesse 2012/03/05 09:41:02 So now that mkdirRecursive returns the resulting D
zundel 2012/03/05 11:34:36 Yes (updated patch)
tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/');
for (String subdirectory in generatedTestPath) {
@@ -1023,6 +1027,41 @@ 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 Directory mkdirRecursive(String base, String relativePath) {
Bill Hesse 2012/03/05 09:41:02 I don't see a way in which you will ever get relat
+ Directory baseDir = new Directory(base);
+ Expect.isTrue(baseDir.existsSync(),
+ "This method expects ${base} to already exist");
Bill Hesse 2012/03/05 09:41:02 "This method" is not really informative to a user
zundel 2012/03/05 11:34:36 Are you saying to add the method name in? I just
+ String pathSep = new Platform().pathSeparator();
+ if (pathSep != '/') {
+ relativePath = relativePath.replaceAll(pathSep, '/');
+ }
+ for (String dir in relativePath.split('/')) {
+ base = "$base/$dir";
+ tempDir = new Directory(base);
Bill Hesse 2012/03/05 09:41:02 tempDir is never declared. How does this compile
zundel 2012/03/05 11:34:36 !!! Fixed.
+ if (!tempDir.existsSync()) {
+ tempDir.createSync();
+ }
+ }
+ Expect.isTrue(tempDir.existsSync(), "Failed to create ${tempDir.path}");
Bill Hesse 2012/03/05 09:41:02 I would move the check into the loop.
zundel 2012/03/05 11:34:36 Done.
+ return tempDir;
zundel 2012/03/02 18:25:03 returning the directory is new.
zundel 2012/03/05 11:34:36 Done.
+ }
+
+ /**
+ * 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