| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // Test generating and running a simple precompiled snapshot of this script. | 5 // Test generating and running a simple precompiled snapshot of this script. |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 main(List args) { | 9 main(List args) { |
| 10 if (args.length > 0 && args[0] == "--hello") { | 10 if (args.length > 0 && args[0] == "--hello") { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 print("Architecture not supported: ${Platform.version}"); | 42 print("Architecture not supported: ${Platform.version}"); |
| 43 return; | 43 return; |
| 44 } | 44 } |
| 45 | 45 |
| 46 var abs_package_root = Uri.parse(Platform.packageRoot).toFilePath(); | 46 var abs_package_root = Uri.parse(Platform.packageRoot).toFilePath(); |
| 47 var dart_executable = | 47 var dart_executable = |
| 48 Directory.current.path + Platform.pathSeparator + Platform.executable; | 48 Directory.current.path + Platform.pathSeparator + Platform.executable; |
| 49 Directory tmp; | 49 Directory tmp; |
| 50 try { | 50 try { |
| 51 tmp = Directory.current.createTempSync("temp_precompilation_test"); | 51 tmp = Directory.current.createTempSync("temp_precompilation_test"); |
| 52 var exec = "${dart_executable}_no_snapshot"; | 52 var exec = "${dart_executable}_bootstrap"; |
| 53 var args = ["--package-root=$abs_package_root", | 53 var args = ["--package-root=$abs_package_root", |
| 54 "--gen-precompiled-snapshot", | 54 "--gen-precompiled-snapshot", |
| 55 "${abs_package_root}compiler/src/dart2js.dart"]; | 55 "${abs_package_root}compiler/src/dart2js.dart"]; |
| 56 print("$exec ${args.join(' ')}"); | 56 print("$exec ${args.join(' ')}"); |
| 57 var result = Process.runSync(exec, args, workingDirectory: tmp.path); | 57 var result = Process.runSync(exec, args, workingDirectory: tmp.path); |
| 58 if (result.exitCode != 0) { | 58 if (result.exitCode != 0) { |
| 59 print(result.stdout); | 59 print(result.stdout); |
| 60 print(result.stderr); | 60 print(result.stderr); |
| 61 throw "Snapshot generation failed."; | 61 throw "Snapshot generation failed."; |
| 62 } | 62 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 throw "Precompiled binary failed."; | 99 throw "Precompiled binary failed."; |
| 100 } | 100 } |
| 101 print(result.stdout); | 101 print(result.stdout); |
| 102 if (!result.stdout.contains("Dart-to-JavaScript compiler")) { | 102 if (!result.stdout.contains("Dart-to-JavaScript compiler")) { |
| 103 throw "Precompiled binary output mismatch."; | 103 throw "Precompiled binary output mismatch."; |
| 104 } | 104 } |
| 105 } finally { | 105 } finally { |
| 106 tmp?.deleteSync(recursive: true); | 106 tmp?.deleteSync(recursive: true); |
| 107 } | 107 } |
| 108 } | 108 } |
| OLD | NEW |