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 * Furtheremore it ensure that a compilations 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 'package:path/path.dart'; | 20 import 'package:path/path.dart'; |
21 import 'dart:async'; | 21 import 'dart:async'; |
22 import 'dart:io'; | 22 import 'dart:io'; |
| 23 import '../../../tools/testing/dart/options.dart' as options; |
23 import '../../../tools/testing/dart/path.dart'; | 24 import '../../../tools/testing/dart/path.dart'; |
24 import '../../../tools/testing/dart/test_suite.dart' as suite; | 25 import '../../../tools/testing/dart/test_suite.dart' as suite; |
25 import '../../../tools/testing/dart/test_runner.dart' as runner; | 26 import '../../../tools/testing/dart/test_runner.dart' as runner; |
26 import '../../../tools/testing/dart/test_options.dart' as options; | |
27 import '../../../tools/testing/dart/utils.dart'; | 27 import '../../../tools/testing/dart/utils.dart'; |
28 | 28 |
29 /** | 29 /** |
30 * This class is reponsible for setting up the files necessary for this test | 30 * This class is reponsible for setting up the files necessary for this test |
31 * as well as touching a file. | 31 * as well as touching a file. |
32 */ | 32 */ |
33 class FileUtils { | 33 class FileUtils { |
34 Directory tempDir; | 34 Directory tempDir; |
35 File testJs; | 35 File testJs; |
36 File testJsDeps; | 36 File testJsDeps; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 Expect.isTrue( | 144 Expect.isTrue( |
145 new File(fileUtils.scriptOutputPath.toNativePath()).existsSync()); | 145 new File(fileUtils.scriptOutputPath.toNativePath()).existsSync()); |
146 } else { | 146 } else { |
147 Expect.isFalse( | 147 Expect.isFalse( |
148 new File(fileUtils.scriptOutputPath.toNativePath()).existsSync()); | 148 new File(fileUtils.scriptOutputPath.toNativePath()).existsSync()); |
149 } | 149 } |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 runner.Command makeCompilationCommand(String testName, FileUtils fileUtils) { | 153 runner.Command makeCompilationCommand(String testName, FileUtils fileUtils) { |
154 var config = new options.TestOptionsParser().parse(['--timeout', '2'])[0]; | 154 var config = new options.OptionsParser().parse(['--timeout', '2'])[0]; |
155 var createFileScript = Platform.script | 155 var createFileScript = Platform.script |
156 .resolve('skipping_dart2js_compilations_helper.dart') | 156 .resolve('skipping_dart2js_compilations_helper.dart') |
157 .toFilePath(); | 157 .toFilePath(); |
158 var executable = Platform.executable; | 158 var executable = Platform.executable; |
159 var arguments = [createFileScript, fileUtils.scriptOutputPath.toNativePath()]; | 159 var arguments = [createFileScript, fileUtils.scriptOutputPath.toNativePath()]; |
160 var bootstrapDeps = [Uri.parse("file://${fileUtils.testSnapshotFilePath}")]; | 160 var bootstrapDeps = [Uri.parse("file://${fileUtils.testSnapshotFilePath}")]; |
161 return runner.CommandBuilder.instance.getCompilationCommand( | 161 return runner.CommandBuilder.instance.getCompilationCommand( |
162 'dart2js', | 162 'dart2js', |
163 fileUtils.testJsFilePath.toNativePath(), | 163 fileUtils.testJsFilePath.toNativePath(), |
164 false, | 164 false, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 throw error; | 252 throw error; |
253 }).then((_) { | 253 }).then((_) { |
254 cleanup(); | 254 cleanup(); |
255 }); | 255 }); |
256 } | 256 } |
257 | 257 |
258 // We need to wait some time to make sure that the files we 'touch' get a | 258 // We need to wait some time to make sure that the files we 'touch' get a |
259 // bigger timestamp than the old ones | 259 // bigger timestamp than the old ones |
260 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); | 260 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); |
261 } | 261 } |
OLD | NEW |