| 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),
|
|
|