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

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

Issue 17570018: Do not compile tests for different browsers separately (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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
Index: tools/testing/dart/test_runner.dart
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index 73c9cba04c25affcc6683ff3a7c55354d7866597..4c76ab34879df6085be798f210e75a7a622775fa 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -123,6 +123,8 @@ class Command {
String toString() => commandLine;
+ Future postProcessCommand() => new Future.immediate(null);
+
Future<bool> get outputIsUpToDate => new Future.immediate(false);
io.Path get expectedOutputFile => null;
bool get isPixelTest => false;
@@ -130,10 +132,12 @@ class Command {
class CompilationCommand extends Command {
String _outputFile;
+ String _shadowFile;
bool _neverSkipCompilation;
List<Uri> _bootstrapDependencies;
CompilationCommand(this._outputFile,
+ this._shadowFile,
this._neverSkipCompilation,
this._bootstrapDependencies,
String executable,
@@ -160,11 +164,11 @@ class CompilationCommand extends Command {
});
}
- return readDepsFile("$_outputFile.deps").then((dependencies) {
+ return readDepsFile("${_shadowFile}.deps").then((dependencies) {
if (dependencies != null) {
dependencies.addAll(_bootstrapDependencies);
var jsOutputLastModified = TestUtils.lastModifiedCache.getLastModified(
- new Uri.fromComponents(scheme: 'file', path: _outputFile));
+ new Uri.fromComponents(scheme: 'file', path: _shadowFile));
if (jsOutputLastModified != null) {
for (var dependency in dependencies) {
var dependencyLastModified =
@@ -174,12 +178,29 @@ class CompilationCommand extends Command {
return false;
}
}
+ // Shadow files are up to date, so copy them.
+ _copyFilesSync(_shadowFile, _outputFile);
return true;
}
}
return false;
});
}
+
+ Future postProcessCommand() {
+ // After the actual compile, we synchronously copy the compiled output files
+ // to shadow files.
+ _copyFilesSync(_outputFile, _shadowFile);
+ return new Future.immediate(null);
+ }
+
+ _copyFilesSync(String from, String to) {
+ for (var ending in ['', '.deps', '.map']) {
+ var fromFile = new io.File("${from}${ending}");
+ var toFile = new io.File("${to}${ending}");
+ toFile.writeAsBytesSync(fromFile.readAsBytesSync());
ricow1 2013/06/25 13:10:48 add small comment stating why we do this sync
kustermann 2013/06/25 13:20:11 Done.
+ }
+ }
}
class ContentShellCommand extends Command {
@@ -1044,7 +1065,15 @@ class RunningProcess {
process.kill();
}
}
- process.exitCode.then(_commandComplete);
+ process.exitCode.then((exitCode) {
+ if (exitCode == 0) {
+ command.postProcessCommand().then((_) {
+ _commandComplete(exitCode);
+ });
+ } else {
+ _commandComplete(exitCode);
+ }
+ });
_drainStream(process.stdout, stdout);
_drainStream(process.stderr, stderr);
timeoutTimer = new Timer(new Duration(seconds: testCase.timeout),

Powered by Google App Engine
This is Rietveld 408576698