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

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
« no previous file with comments | « tests/standalone/io/skipping_dart2js_compilations_test.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..012f1daf5eed9d8f2476eafd5ae75c8f173354e2 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,33 @@ 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}");
+ // We copy the dart2js results synchronously to make it atomic.
+ // This ensures that the shadow files are always in a consistent state (no
+ // other code in the testing scripts will see a half-written shadow
+ // file).
+ toFile.writeAsBytesSync(fromFile.readAsBytesSync());
+ }
+ }
}
class ContentShellCommand extends Command {
@@ -1044,7 +1069,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),
« no previous file with comments | « tests/standalone/io/skipping_dart2js_compilations_test.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698