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 // OtherResources=skipping_dart2js_compilations_helper.dart | 5 // OtherResources=skipping_dart2js_compilations_helper.dart |
6 | 6 |
7 /* | 7 /* |
8 * This test makes sure that the "skipping Dart2Js compilations if the output is | 8 * This test makes sure that the "skipping Dart2Js compilations if the output is |
9 * already up to date" feature does work as it should. | 9 * already up to date" feature does work as it should. |
10 * Therefore this test ensures that compilations are only skipped if the last | 10 * Therefore this test ensures that compilations are only skipped if the last |
11 * modified date of the output of a dart2js compilation is newer than | 11 * modified date of the output of a dart2js compilation is newer than |
12 * - the dart application to compile (including it's dependencies) | 12 * - the dart application to compile (including it's dependencies) |
13 * - the dart2js snapshot | 13 * - the dart2js snapshot |
14 * Furtheremore it ensure that a compilations is not skipped if any of the | 14 * Furthermore it ensures that a compilation is not skipped if any of the |
15 * necessary files could not be found (dart2js snapshots, previous dart2js | 15 * necessary files could not be found (dart2js snapshots, previous dart2js |
16 * output (+deps file), dart application) | 16 * output (+deps file), dart application) |
17 */ | 17 */ |
18 | 18 |
19 import 'package:expect/expect.dart'; | 19 import 'package:expect/expect.dart'; |
20 import 'dart:async'; | 20 import 'dart:async'; |
21 import 'dart:io'; | 21 import 'dart:io'; |
22 import '../../../tools/testing/dart/command.dart'; | 22 import '../../../tools/testing/dart/command.dart'; |
23 import '../../../tools/testing/dart/command_output.dart'; | 23 import '../../../tools/testing/dart/command_output.dart'; |
24 import '../../../tools/testing/dart/path.dart'; | 24 import '../../../tools/testing/dart/path.dart'; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 Future runTest(String name, FileUtils fileUtils, bool shouldRun) { | 214 Future runTest(String name, FileUtils fileUtils, bool shouldRun) { |
215 var completedHandler = new CommandCompletedHandler(fileUtils, shouldRun); | 215 var completedHandler = new CommandCompletedHandler(fileUtils, shouldRun); |
216 var command = makeCompilationCommand(name, fileUtils); | 216 var command = makeCompilationCommand(name, fileUtils); |
217 var process = new runner.RunningProcess(command, 60); | 217 var process = new runner.RunningProcess(command, 60); |
218 return process.run().then((CommandOutput output) { | 218 return process.run().then((CommandOutput output) { |
219 completedHandler.processCompletedTest(output); | 219 completedHandler.processCompletedTest(output); |
220 }); | 220 }); |
221 } | 221 } |
222 | 222 |
223 // We run the tests in sequence, so that if one of them failes we clean up | 223 // We run the tests in sequence, so that if one of them fails we clean up |
224 // everything and throw. | 224 // everything and throw. |
225 runTest("fs_noTestJs", fs_noTestJs, true).then((_) { | 225 runTest("fs_noTestJs", fs_noTestJs, true).then((_) { |
226 return runTest("fs_noTestJsDeps", fs_noTestJsDeps, true); | 226 return runTest("fs_noTestJsDeps", fs_noTestJsDeps, true); |
227 }).then((_) { | 227 }).then((_) { |
228 return runTest("fs_noTestDart", fs_noTestDart, true); | 228 return runTest("fs_noTestDart", fs_noTestDart, true); |
229 }).then((_) { | 229 }).then((_) { |
230 return runTest("fs_noTestSnapshot", fs_noTestSnapshot, true); | 230 return runTest("fs_noTestSnapshot", fs_noTestSnapshot, true); |
231 }).then((_) { | 231 }).then((_) { |
232 return runTest("fs_notUpToDate_snapshot", fs_notUpToDate_snapshot, true); | 232 return runTest("fs_notUpToDate_snapshot", fs_notUpToDate_snapshot, true); |
233 }).then((_) { | 233 }).then((_) { |
234 return runTest("fs_notUpToDate_dart", fs_notUpToDate_dart, true); | 234 return runTest("fs_notUpToDate_dart", fs_notUpToDate_dart, true); |
235 }).then((_) { | 235 }).then((_) { |
236 // This is the only test where all dependencies are present and the | 236 // This is the only test where all dependencies are present and the |
237 // test.js file is newer than all the others. So we pass 'false' for | 237 // test.js file is newer than all the others. So we pass 'false' for |
238 // shouldRun. | 238 // shouldRun. |
239 return runTest("fs_upToDate", fs_upToDate, false); | 239 return runTest("fs_upToDate", fs_upToDate, false); |
240 }).catchError((error) { | 240 }).catchError((error) { |
241 cleanup(); | 241 cleanup(); |
242 throw error; | 242 throw error; |
243 }).then((_) { | 243 }).then((_) { |
244 cleanup(); | 244 cleanup(); |
245 }); | 245 }); |
246 } | 246 } |
247 | 247 |
248 // We need to wait some time to make sure that the files we 'touch' get a | 248 // We need to wait some time to make sure that the files we 'touch' get a |
249 // bigger timestamp than the old ones | 249 // bigger timestamp than the old ones |
250 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); | 250 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); |
251 } | 251 } |
OLD | NEW |