| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 * This test makes sure that the "skipping Dart2Js compilations if the output is | 6 * This test makes sure that the "skipping Dart2Js compilations if the output is |
| 7 * already up to date" feature does work as it should. | 7 * already up to date" feature does work as it should. |
| 8 * Therefore this test ensures that compilations are only skipped if the last | 8 * Therefore this test ensures that compilations are only skipped if the last |
| 9 * modified date of the output of a dart2js compilation is newer than | 9 * modified date of the output of a dart2js compilation is newer than |
| 10 * - the the dart application to compile (including it's dependencies) | 10 * - the the dart application to compile (including it's dependencies) |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 class CommandCompletedHandler { | 128 class CommandCompletedHandler { |
| 129 FileUtils fileUtils; | 129 FileUtils fileUtils; |
| 130 DateTime _expectedTimestamp; | 130 DateTime _expectedTimestamp; |
| 131 bool _shouldHaveRun; | 131 bool _shouldHaveRun; |
| 132 | 132 |
| 133 CommandCompletedHandler(FileUtils this.fileUtils, bool this._shouldHaveRun); | 133 CommandCompletedHandler(FileUtils this.fileUtils, bool this._shouldHaveRun); |
| 134 | 134 |
| 135 void processCompletedTest(CommandOutput output) { | 135 void processCompletedTest(runner.CommandOutput output) { |
| 136 Expect.isTrue(output.exitCode == 0); | 136 Expect.isTrue(output.exitCode == 0); |
| 137 Expect.isTrue(output.stderr.length == 0); | 137 Expect.isTrue(output.stderr.length == 0); |
| 138 if (_shouldHaveRun) { | 138 if (_shouldHaveRun) { |
| 139 Expect.isTrue(output.stdout.length == 0); | 139 Expect.isTrue(output.stdout.length == 0); |
| 140 Expect.isTrue(new File(fileUtils.scriptOutputPath.toNativePath()) | 140 Expect.isTrue(new File(fileUtils.scriptOutputPath.toNativePath()) |
| 141 .existsSync()); | 141 .existsSync()); |
| 142 } else { | 142 } else { |
| 143 Expect.isFalse(new File(fileUtils.scriptOutputPath.toNativePath()) | 143 Expect.isFalse(new File(fileUtils.scriptOutputPath.toNativePath()) |
| 144 .existsSync()); | 144 .existsSync()); |
| 145 } | 145 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 void touchFilesAndRunTests() { | 206 void touchFilesAndRunTests() { |
| 207 fs_notUpToDate_snapshot.touchFile(fs_notUpToDate_snapshot.testSnapshot); | 207 fs_notUpToDate_snapshot.touchFile(fs_notUpToDate_snapshot.testSnapshot); |
| 208 fs_notUpToDate_dart.touchFile(fs_notUpToDate_dart.testDart); | 208 fs_notUpToDate_dart.touchFile(fs_notUpToDate_dart.testDart); |
| 209 fs_upToDate.touchFile(fs_upToDate.testJs); | 209 fs_upToDate.touchFile(fs_upToDate.testJs); |
| 210 | 210 |
| 211 Future runTest(String name, FileUtils fileUtils, bool shouldRun) { | 211 Future runTest(String name, FileUtils fileUtils, bool shouldRun) { |
| 212 var completedHandler = new CommandCompletedHandler(fileUtils, shouldRun); | 212 var completedHandler = new CommandCompletedHandler(fileUtils, shouldRun); |
| 213 var command = makeCompilationCommand(name, fileUtils); | 213 var command = makeCompilationCommand(name, fileUtils); |
| 214 var process = new runner.RunningProcess(command, 60); | 214 var process = new runner.RunningProcess(command, 60); |
| 215 return process.run().then((CommandOutput output) { | 215 return process.run().then((runner.CommandOutput output) { |
| 216 completedHandler.processCompletedTest(output); | 216 completedHandler.processCompletedTest(output); |
| 217 }); | 217 }); |
| 218 } | 218 } |
| 219 // We run the tests in sequence, so that if one of them failes we clean up | 219 // We run the tests in sequence, so that if one of them failes we clean up |
| 220 // everything and throw. | 220 // everything and throw. |
| 221 runTest("fs_noTestJs", fs_noTestJs, true).then((_) { | 221 runTest("fs_noTestJs", fs_noTestJs, true).then((_) { |
| 222 return runTest("fs_noTestJsDeps", fs_noTestJsDeps, true); | 222 return runTest("fs_noTestJsDeps", fs_noTestJsDeps, true); |
| 223 }).then((_) { | 223 }).then((_) { |
| 224 return runTest("fs_noTestDart", fs_noTestDart, true); | 224 return runTest("fs_noTestDart", fs_noTestDart, true); |
| 225 }).then((_) { | 225 }).then((_) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 237 cleanup(); | 237 cleanup(); |
| 238 throw error; | 238 throw error; |
| 239 }).then((_) { | 239 }).then((_) { |
| 240 cleanup(); | 240 cleanup(); |
| 241 }); | 241 }); |
| 242 } | 242 } |
| 243 // We need to wait some time to make sure that the files we 'touch' get a | 243 // We need to wait some time to make sure that the files we 'touch' get a |
| 244 // bigger timestamp than the old ones | 244 // bigger timestamp than the old ones |
| 245 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); | 245 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); |
| 246 } | 246 } |
| OLD | NEW |