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

Side by Side 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, 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 tempDirPath = new File(tempDirPath).fullPathSync().replaceAll('\\', '/'); 673 TestUtils.mkdirRecursive(tempDirPath,
674 674 Strings.join(generatedTestPath, '/'));
675 for (String subdirectory in generatedTestPath) {
676 tempDirPath = '$tempDirPath/$subdirectory';
677 tempDir = new Directory(tempDirPath);
678 if (!tempDir.existsSync()) {
679 tempDir.createSync();
680 }
681 }
682 return tempDir; 675 return tempDir;
683 } 676 }
684 677
685 String get scriptType() { 678 String get scriptType() {
686 switch (configuration['component']) { 679 switch (configuration['component']) {
687 case 'dartium': 680 case 'dartium':
688 return 'application/dart'; 681 return 'application/dart';
689 case 'chromium': 682 case 'chromium':
690 case 'frogium': 683 case 'frogium':
691 case 'legium': 684 case 'legium':
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 '$dartDir/third_party/hamcrest/v1_3/hamcrest-generator-1.3.0RC2.jar', 1009 '$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', 1010 '$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', 1011 '$dartDir/third_party/hamcrest/v1_3/hamcrest-library-1.3.0RC2.jar',
1019 '$dartDir/third_party/junit/v4_8_2/junit.jar'], 1012 '$dartDir/third_party/junit/v4_8_2/junit.jar'],
1020 ':'); // Path separator. 1013 ':'); // Path separator.
1021 } 1014 }
1022 } 1015 }
1023 1016
1024 1017
1025 class TestUtils { 1018 class TestUtils {
1019
1020 /**
1021 * Creates a directory using a [relativePath] to an existing
1022 * [base] directory if that [relativePath] does not already exist.
1023 */
1024 static void mkdirRecursive(String base, String relativePath) {
1025 Directory baseDir = new Directory(base);
1026 Expect.isTrue(baseDir.existsSync(),
1027 "This method expects ${base} to already exist");
1028 String pathSep = new Platform().pathSeparator();
1029 if (pathSep != '/') {
1030 relativePath = relativePath.replaceAll(pathSep, '/');
1031 }
1032 for (String dir in relativePath.split('/')) {
1033 var tempDir = new Directory('$base/$dir');
1034 if (!tempDir.existsSync()) {
1035 tempDir.createSync();
1036 }
1037 base = "$base/$dir";
1038 }
1039 }
1040
1041 /**
1042 * Copy a [source] file to a new place.
1043 * Assumes that the directory for [dest] already exists.
1044 */
1045 static void copyFile(File source, File dest) {
1046 List contents = source.readAsBytesSync();
1047 RandomAccessFile handle = dest.openSync(FileMode.WRITE);
1048 handle.writeListSync(contents, 0, contents.length);
1049 handle.closeSync();
1050 }
1051
1026 static String executableSuffix(String component) { 1052 static String executableSuffix(String component) {
1027 if (new Platform().operatingSystem() == 'windows') { 1053 if (new Platform().operatingSystem() == 'windows') {
1028 if (component != 'frogium' 1054 if (component != 'frogium'
1029 && component != 'legium' 1055 && component != 'legium'
1030 && component != 'webdriver') { 1056 && component != 'webdriver') {
1031 return '.exe'; 1057 return '.exe';
1032 } else { 1058 } else {
1033 return '.bat'; 1059 return '.bat';
1034 } 1060 }
1035 } 1061 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 * $noCrash tests are expected to be flaky but not crash 1199 * $noCrash tests are expected to be flaky but not crash
1174 * $pass tests are expected to pass 1200 * $pass tests are expected to pass
1175 * $failOk tests are expected to fail that we won't fix 1201 * $failOk tests are expected to fail that we won't fix
1176 * $fail tests are expected to fail that we should fix 1202 * $fail tests are expected to fail that we should fix
1177 * $crash tests are expected to crash that we should fix 1203 * $crash tests are expected to crash that we should fix
1178 * $timeout tests are allowed to timeout 1204 * $timeout tests are allowed to timeout
1179 """; 1205 """;
1180 print(report); 1206 print(report);
1181 } 1207 }
1182 } 1208 }
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