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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/multitest.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * Classes and methods for enumerating and preparing tests. 6 * Classes and methods for enumerating and preparing tests.
7 * 7 *
8 * This library includes: 8 * This library includes:
9 * 9 *
10 * - Creating tests by listing all the Dart files in certain directories, 10 * - Creating tests by listing all the Dart files in certain directories,
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 } 663 }
664 buildPath.removeRange(0, 1); 664 buildPath.removeRange(0, 1);
665 if (buildPath.last() == '') buildPath.removeLast(); 665 if (buildPath.last() == '') buildPath.removeLast();
666 buildPath.addAll(generatedTestPath); 666 buildPath.addAll(generatedTestPath);
667 generatedTestPath = buildPath; 667 generatedTestPath = buildPath;
668 tempDir = new Directory(tempDirPath); 668 tempDir = new Directory(tempDirPath);
669 if (!tempDir.existsSync()) { 669 if (!tempDir.existsSync()) {
670 tempDir.createSync(); 670 tempDir.createSync();
671 } 671 }
672 } 672 }
673 // TODO(zundel): this actually creates and returns a path like
674 // '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
675 // I think the extra mode/architecture label redundant, but after
676 // 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)
673 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); 677 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/');
674 678
675 for (String subdirectory in generatedTestPath) { 679 for (String subdirectory in generatedTestPath) {
676 tempDirPath = '$tempDirPath/$subdirectory'; 680 tempDirPath = '$tempDirPath/$subdirectory';
677 tempDir = new Directory(tempDirPath); 681 tempDir = new Directory(tempDirPath);
678 if (!tempDir.existsSync()) { 682 if (!tempDir.existsSync()) {
679 tempDir.createSync(); 683 tempDir.createSync();
680 } 684 }
681 } 685 }
682 return tempDir; 686 return tempDir;
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 '$dartDir/third_party/hamcrest/v1_3/hamcrest-generator-1.3.0RC2.jar', 1020 '$dartDir/third_party/hamcrest/v1_3/hamcrest-generator-1.3.0RC2.jar',
1017 '$dartDir/third_party/hamcrest/v1_3/hamcrest-integration-1.3.0RC2.jar', 1021 '$dartDir/third_party/hamcrest/v1_3/hamcrest-integration-1.3.0RC2.jar',
1018 '$dartDir/third_party/hamcrest/v1_3/hamcrest-library-1.3.0RC2.jar', 1022 '$dartDir/third_party/hamcrest/v1_3/hamcrest-library-1.3.0RC2.jar',
1019 '$dartDir/third_party/junit/v4_8_2/junit.jar'], 1023 '$dartDir/third_party/junit/v4_8_2/junit.jar'],
1020 ':'); // Path separator. 1024 ':'); // Path separator.
1021 } 1025 }
1022 } 1026 }
1023 1027
1024 1028
1025 class TestUtils { 1029 class TestUtils {
1030
1031 /**
1032 * Creates a directory using a [relativePath] to an existing
1033 * [base] directory if that [relativePath] does not already exist.
1034 */
1035 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
1036 Directory baseDir = new Directory(base);
1037 Expect.isTrue(baseDir.existsSync(),
1038 "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
1039 String pathSep = new Platform().pathSeparator();
1040 if (pathSep != '/') {
1041 relativePath = relativePath.replaceAll(pathSep, '/');
1042 }
1043 for (String dir in relativePath.split('/')) {
1044 base = "$base/$dir";
1045 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.
1046 if (!tempDir.existsSync()) {
1047 tempDir.createSync();
1048 }
1049 }
1050 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.
1051 return tempDir;
zundel 2012/03/02 18:25:03 returning the directory is new.
zundel 2012/03/05 11:34:36 Done.
1052 }
1053
1054 /**
1055 * Copy a [source] file to a new place.
1056 * Assumes that the directory for [dest] already exists.
1057 */
1058 static void copyFile(File source, File dest) {
1059 List contents = source.readAsBytesSync();
1060 RandomAccessFile handle = dest.openSync(FileMode.WRITE);
1061 handle.writeListSync(contents, 0, contents.length);
1062 handle.closeSync();
1063 }
1064
1026 static String executableSuffix(String component) { 1065 static String executableSuffix(String component) {
1027 if (new Platform().operatingSystem() == 'windows') { 1066 if (new Platform().operatingSystem() == 'windows') {
1028 if (component != 'frogium' 1067 if (component != 'frogium'
1029 && component != 'legium' 1068 && component != 'legium'
1030 && component != 'webdriver') { 1069 && component != 'webdriver') {
1031 return '.exe'; 1070 return '.exe';
1032 } else { 1071 } else {
1033 return '.bat'; 1072 return '.bat';
1034 } 1073 }
1035 } 1074 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 * $noCrash tests are expected to be flaky but not crash 1212 * $noCrash tests are expected to be flaky but not crash
1174 * $pass tests are expected to pass 1213 * $pass tests are expected to pass
1175 * $failOk tests are expected to fail that we won't fix 1214 * $failOk tests are expected to fail that we won't fix
1176 * $fail tests are expected to fail that we should fix 1215 * $fail tests are expected to fail that we should fix
1177 * $crash tests are expected to crash that we should fix 1216 * $crash tests are expected to crash that we should fix
1178 * $timeout tests are allowed to timeout 1217 * $timeout tests are allowed to timeout
1179 """; 1218 """;
1180 print(report); 1219 print(report);
1181 } 1220 }
1182 } 1221 }
OLDNEW
« 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