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) |
11 * - the dart2js snapshot | 11 * - the dart2js snapshot |
12 * Furtheremore it ensure that a compilations is not skipped if any of the | 12 * Furtheremore it ensure that a compilations is not skipped if any of the |
13 * necessary files could not be found (dart2js snapshots, previous dart2js | 13 * necessary files could not be found (dart2js snapshots, previous dart2js |
14 * output (+deps file), dart application) | 14 * output (+deps file), dart application) |
15 */ | 15 */ |
16 | 16 |
17 import 'package:expect/expect.dart'; | 17 import 'package:expect/expect.dart'; |
18 import 'dart:async'; | 18 import 'dart:async'; |
19 import 'dart:io'; | 19 import 'dart:io'; |
20 import 'dart:uri'; | |
21 import '../../../tools/testing/dart/test_suite.dart' as suite; | 20 import '../../../tools/testing/dart/test_suite.dart' as suite; |
22 import '../../../tools/testing/dart/test_runner.dart' as runner; | 21 import '../../../tools/testing/dart/test_runner.dart' as runner; |
23 import '../../../tools/testing/dart/test_options.dart' as options; | 22 import '../../../tools/testing/dart/test_options.dart' as options; |
24 import '../../../tools/testing/dart/status_file_parser.dart' as status; | 23 import '../../../tools/testing/dart/status_file_parser.dart' as status; |
25 | 24 |
26 /** | 25 /** |
27 * This class is reponsible for setting up the files necessary for this test | 26 * This class is reponsible for setting up the files necessary for this test |
28 * as well as touching a file. | 27 * as well as touching a file. |
29 */ | 28 */ |
30 class FileUtils { | 29 class FileUtils { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 145 } |
147 | 146 |
148 runner.TestCase makeTestCase(String testName, FileUtils fileUtils) { | 147 runner.TestCase makeTestCase(String testName, FileUtils fileUtils) { |
149 var config = new options.TestOptionsParser().parse(['--timeout', '2'])[0]; | 148 var config = new options.TestOptionsParser().parse(['--timeout', '2'])[0]; |
150 var scriptDirPath = new Path(new Options().script).directoryPath; | 149 var scriptDirPath = new Path(new Options().script).directoryPath; |
151 var createFileScript = scriptDirPath. | 150 var createFileScript = scriptDirPath. |
152 append('skipping_dart2js_compilations_helper.dart').toNativePath(); | 151 append('skipping_dart2js_compilations_helper.dart').toNativePath(); |
153 var executable = new Options().executable; | 152 var executable = new Options().executable; |
154 var arguments = [createFileScript, fileUtils.scriptOutputPath.toNativePath()]; | 153 var arguments = [createFileScript, fileUtils.scriptOutputPath.toNativePath()]; |
155 var bootstrapDeps = [ | 154 var bootstrapDeps = [ |
156 new Uri("file://${fileUtils.testSnapshotFilePath}")]; | 155 Uri.parse("file://${fileUtils.testSnapshotFilePath}")]; |
157 var commands = [new runner.CompilationCommand( | 156 var commands = [new runner.CompilationCommand( |
158 fileUtils.testJsFilePath.toNativePath(), | 157 fileUtils.testJsFilePath.toNativePath(), |
159 false, | 158 false, |
160 bootstrapDeps, | 159 bootstrapDeps, |
161 executable, | 160 executable, |
162 arguments)]; | 161 arguments)]; |
163 return new runner.TestCase( | 162 return new runner.TestCase( |
164 testName, | 163 testName, |
165 commands, | 164 commands, |
166 config, | 165 config, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 cleanup(); | 240 cleanup(); |
242 throw error; | 241 throw error; |
243 }).then((_) { | 242 }).then((_) { |
244 cleanup(); | 243 cleanup(); |
245 }); | 244 }); |
246 } | 245 } |
247 // We need to wait some time to make sure that the files we 'touch' get a | 246 // We need to wait some time to make sure that the files we 'touch' get a |
248 // bigger timestamp than the old ones | 247 // bigger timestamp than the old ones |
249 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); | 248 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); |
250 } | 249 } |
OLD | NEW |