| 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/command.dart'; |
| 23 import '../../../tools/testing/dart/options.dart' as options; | 24 import '../../../tools/testing/dart/options.dart' as options; |
| 24 import '../../../tools/testing/dart/path.dart'; | 25 import '../../../tools/testing/dart/path.dart'; |
| 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/utils.dart'; | 27 import '../../../tools/testing/dart/utils.dart'; |
| 27 | 28 |
| 28 /** | 29 /** |
| 29 * 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 |
| 30 * as well as touching a file. | 31 * as well as touching a file. |
| 31 */ | 32 */ |
| 32 class FileUtils { | 33 class FileUtils { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 148 } |
| 148 | 149 |
| 149 runner.Command makeCompilationCommand(String testName, FileUtils fileUtils) { | 150 runner.Command makeCompilationCommand(String testName, FileUtils fileUtils) { |
| 150 var config = new options.OptionsParser().parse(['--timeout', '2'])[0]; | 151 var config = new options.OptionsParser().parse(['--timeout', '2'])[0]; |
| 151 var createFileScript = Platform.script | 152 var createFileScript = Platform.script |
| 152 .resolve('skipping_dart2js_compilations_helper.dart') | 153 .resolve('skipping_dart2js_compilations_helper.dart') |
| 153 .toFilePath(); | 154 .toFilePath(); |
| 154 var executable = Platform.executable; | 155 var executable = Platform.executable; |
| 155 var arguments = [createFileScript, fileUtils.scriptOutputPath.toNativePath()]; | 156 var arguments = [createFileScript, fileUtils.scriptOutputPath.toNativePath()]; |
| 156 var bootstrapDeps = [Uri.parse("file://${fileUtils.testSnapshotFilePath}")]; | 157 var bootstrapDeps = [Uri.parse("file://${fileUtils.testSnapshotFilePath}")]; |
| 157 return runner.CommandBuilder.instance.getCompilationCommand( | 158 return Command.compilation('dart2js', fileUtils.testJsFilePath.toNativePath(), |
| 158 'dart2js', | 159 false, bootstrapDeps, executable, arguments, {}); |
| 159 fileUtils.testJsFilePath.toNativePath(), | |
| 160 false, | |
| 161 bootstrapDeps, | |
| 162 executable, | |
| 163 arguments, {}); | |
| 164 } | 160 } |
| 165 | 161 |
| 166 void main() { | 162 void main() { |
| 167 // This script is in [sdk]/tests/standalone/io. | 163 // This script is in [sdk]/tests/standalone/io. |
| 168 TestUtils.setDartDirUri(Platform.script.resolve('../../..')); | 164 TestUtils.setDartDirUri(Platform.script.resolve('../../..')); |
| 169 | 165 |
| 170 var fs_noTestJs = new FileUtils( | 166 var fs_noTestJs = new FileUtils( |
| 171 createJs: false, | 167 createJs: false, |
| 172 createJsDeps: true, | 168 createJsDeps: true, |
| 173 createDart: true, | 169 createDart: true, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 throw error; | 244 throw error; |
| 249 }).then((_) { | 245 }).then((_) { |
| 250 cleanup(); | 246 cleanup(); |
| 251 }); | 247 }); |
| 252 } | 248 } |
| 253 | 249 |
| 254 // We need to wait some time to make sure that the files we 'touch' get a | 250 // We need to wait some time to make sure that the files we 'touch' get a |
| 255 // bigger timestamp than the old ones | 251 // bigger timestamp than the old ones |
| 256 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); | 252 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); |
| 257 } | 253 } |
| OLD | NEW |