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

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

Issue 9240011: Add temporary directory for dartc compilation of tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use the correct version of DeMorgan's law when rearranging if statements. Created 8 years, 11 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
« tools/testing/dart/test_runner.dart ('K') | « tools/testing/dart/test_runner.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 ba2e03d99e87c364aca21886fec2474835297d45..ff3ab044d1559522303ba0ef4bc6596231a1330f 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -11,7 +11,8 @@
#source("browser_test.dart");
interface TestSuite {
- void forEachTest(Function onTest, Map testCache, [Function onDone]);
+ void forEachTest(Function onTest, Map testCache, String tempDir,
+ [Function onDone]);
}
@@ -102,7 +103,8 @@ class CCTestSuite implements TestSuite {
}
}
- void forEachTest(Function onTest, Map testCache, [Function onDone]) {
+ void forEachTest(Function onTest, Map testCache, String tempDir,
+ [Function onDone]) {
doTest = onTest;
doDone = (ignore) => (onDone != null) ? onDone() : null;
@@ -156,13 +158,14 @@ class StandardTestSuite implements TestSuite {
bool listingDone = false;
TestExpectations testExpectations;
List<TestInformation> cachedTests;
- final String pathSeparator;
+ final String dartDir;
+ String globalTemporaryDirectory;
StandardTestSuite(Map this.configuration,
String this.suiteName,
String this.directoryPath,
List<String> this.statusFilePaths)
- : pathSeparator = new Platform().pathSeparator();
+ : dartDir = TestUtils.dartDir();
bool isTestFile(String filename) => filename.endsWith("Test.dart");
@@ -172,11 +175,13 @@ class StandardTestSuite implements TestSuite {
String shellPath() => TestUtils.dartShellFileName(configuration);
- List<String> additionalOptions() => [];
+ List<String> additionalOptions(String filename) => [];
- void forEachTest(Function onTest, Map testCache, [Function onDone = null]) {
+ void forEachTest(Function onTest, Map testCache, String tempDir,
+ [Function onDone = null]) {
doTest = onTest;
doDone = (onDone != null) ? onDone : (() => null);
+ globalTemporaryDirectory = tempDir;
var filesRead = 0;
void statusFileRead() {
@@ -357,16 +362,6 @@ class StandardTestSuite implements TestSuite {
final String component = configuration['component'];
final String testPath = new File(filename).fullPathSync();
- String dartDir = new File('.').fullPathSync();
- if (!testPath.startsWith(dartDir) ||
- dartDir.endsWith('/frog')) {
- dartDir = new File('..').fullPathSync();
- if (!testPath.startsWith(dartDir)) {
- print('Run test.dart from the dart directory or' +
- ' an immediate subdirectory only.');
- Expect.fail('Could not find top level dart directory.');
- }
- }
for (var vmOptions in optionsFromFile['vmOptions']) {
// Create a unique temporary directory for each set of vmOptions.
@@ -379,7 +374,7 @@ class StandardTestSuite implements TestSuite {
.replaceAll('/','');
}
Directory tempDir =
- createTemporaryDirectory(testPath, dartDir, optionsName);
+ createTemporaryDirectory(testPath, optionsName);
String dartWrapperFilename = '${tempDir.path}/test.dart';
String compiledDartWrapperFilename = '${tempDir.path}/test.js';
@@ -496,7 +491,6 @@ class StandardTestSuite implements TestSuite {
* all path separators with underscores.
*/
Directory createTemporaryDirectory(String testPath,
- String dartDir,
String optionsName) {
String testUniqueName =
testPath.substring(dartDir.length + 1, testPath.length - 5);
@@ -509,6 +503,14 @@ class StandardTestSuite implements TestSuite {
testUniqueName];
String tempDirPath = TestUtils.buildDir(configuration);
+ if (configuration['component'] == 'dartc' ||
+ configuration['component'] == 'chromium') {
+ // We don't create a temporary directory for dartc and chromium
+ // tests on Windows, since they aren't supported on it.
+ Expect.isTrue(new Platform().operatingSystem() != 'windows',
Mads Ager (chromium) 2012/01/18 06:57:17 I would move this assert to where we actually crea
Bill Hesse 2012/01/18 11:52:38 We can drop the assert, or change it to Expect.isT
+ 'dartc and chromium components not supported on windows');
+ tempDirPath = globalTemporaryDirectory;
+ }
Directory tempDir = new Directory(tempDirPath);
if (!tempDir.existsSync()) {
// Dartium tests can be run with no build step, with no output directory.
@@ -591,7 +593,7 @@ class StandardTestSuite implements TestSuite {
Map optionsFromFile,
bool enableFatalTypeErrors) {
List args = TestUtils.standardOptions(configuration);
- args.addAll(additionalOptions());
+ args.addAll(additionalOptions(filename));
if (enableFatalTypeErrors && configuration['component'] == 'dartc') {
args.add('--fatal-type-errors');
}
@@ -726,11 +728,9 @@ class DartcCompilationTestSuite extends StandardTestSuite {
String shellPath() => TestUtils.compilerPath(configuration);
- List<String> additionalOptions() {
- // TODO(ager): potentially register cleanup action to delete the temporary
- // directories?
- var tempDir = new Directory('');
- tempDir.createTempSync();
+ List<String> additionalOptions(String filename) {
+ filename = new File(filename).fullPathSync();
+ Directory tempDir = createTemporaryDirectory(filename, 'dartc-test');
return
[ '--fatal-warnings', '--fatal-type-errors',
'-check-only', '-out', tempDir.path];
@@ -763,7 +763,7 @@ class JUnitTestSuite implements TestSuite {
String suiteName;
String directoryPath;
String statusFilePath;
- String dartDir;
+ final String dartDir;
String buildDir;
String classPath;
List<String> testClasses;
@@ -774,7 +774,8 @@ class JUnitTestSuite implements TestSuite {
JUnitTestSuite(Map this.configuration,
String this.suiteName,
String this.directoryPath,
- String this.statusFilePath);
+ String this.statusFilePath)
+ : dartDir = TestUtils.dartDir();
bool isTestFile(String filename) => filename.endsWith("Tests.java") &&
!filename.contains('com/google/dart/compiler/vm') &&
@@ -782,6 +783,7 @@ class JUnitTestSuite implements TestSuite {
void forEachTest(Function onTest,
Map testCacheIgnored,
+ String tempDir,
[Function onDone = null]) {
doTest = onTest;
doDone = (onDone != null) ? onDone : (() => null);
@@ -797,13 +799,6 @@ class JUnitTestSuite implements TestSuite {
return;
}
- dartDir = new File('.').fullPathSync();
- if (dartDir.endsWith('compiler')) {
- dartDir = new File('..').fullPathSync();
- if (!new File('$dartDir/tools/test.dart').existsSync()) {
- throw new Exception('Cannot find client checkout $dartDir');
- }
- }
buildDir = TestUtils.buildDir(configuration);
computeClassPath();
testClasses = <String>[];
@@ -953,6 +948,19 @@ class TestUtils {
return buildDir;
}
+ static String dartDir() {
+ Directory dart;
+ if (new File('tools/testing/dart/test_suite.dart').existsSync()) {
+ return new File('.').fullPathSync();
+ } else if (new File('../tools/testing/dart/test_suite.dart').existsSync()) {
+ return new File('..').fullPathSync();
+ } else {
+ print('Run test.dart from the dart directory or' +
+ ' an immediate subdirectory only.');
+ Expect.fail('Could not find top level dart directory.');
+ }
+ }
+
static List<String> standardOptions(Map configuration) {
List args = ["--ignore-unrecognized-flags"];
if (configuration["checked"]) {
« tools/testing/dart/test_runner.dart ('K') | « tools/testing/dart/test_runner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698