Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 36 cc_flags = "-m32"; | 36 cc_flags = "-m32"; |
| 37 } else if (Platform.version.contains("arm")) { | 37 } else if (Platform.version.contains("arm")) { |
| 38 cc_flags = ""; | 38 cc_flags = ""; |
| 39 } else if (Platform.version.contains("mips")) { | 39 } else if (Platform.version.contains("mips")) { |
| 40 cc_flags = "-EL"; | 40 cc_flags = "-EL"; |
| 41 } else { | 41 } else { |
| 42 print("Architecture not supported: ${Platform.version}"); | 42 print("Architecture not supported: ${Platform.version}"); |
| 43 return; | 43 return; |
| 44 } | 44 } |
| 45 | 45 |
| 46 var pkgRoot = Uri.parse(Platform.packageRoot); | 46 var abs_package_root = Uri.parse(Platform.packageRoot).toFilePath(); |
|
Lasse Reichstein Nielsen
2015/12/18 16:17:51
This code will still fail if Platform.packageRoot
| |
| 47 var abs_package_root = new File.fromUri(pkgRoot).absolute.path; | |
| 48 var dart_executable = | 47 var dart_executable = |
| 49 Directory.current.path + Platform.pathSeparator + Platform.executable; | 48 Directory.current.path + Platform.pathSeparator + Platform.executable; |
| 50 Directory tmp; | 49 Directory tmp; |
| 51 try { | 50 try { |
| 52 tmp = Directory.current.createTempSync("temp_precompilation_test"); | 51 tmp = Directory.current.createTempSync("temp_precompilation_test"); |
| 53 var exec = "${dart_executable}_no_snapshot"; | 52 var exec = "${dart_executable}_no_snapshot"; |
| 54 var args = ["--package-root=$abs_package_root", | 53 var args = ["--package-root=$abs_package_root", |
| 55 "--gen-precompiled-snapshot", | 54 "--gen-precompiled-snapshot", |
| 56 "${abs_package_root}compiler/src/dart2js.dart"]; | 55 "${abs_package_root}compiler/src/dart2js.dart"]; |
| 57 print("$exec ${args.join(' ')}"); | 56 print("$exec ${args.join(' ')}"); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 throw "Precompiled binary failed."; | 99 throw "Precompiled binary failed."; |
| 101 } | 100 } |
| 102 print(result.stdout); | 101 print(result.stdout); |
| 103 if (!result.stdout.contains("Dart-to-JavaScript compiler")) { | 102 if (!result.stdout.contains("Dart-to-JavaScript compiler")) { |
| 104 throw "Precompiled binary output mismatch."; | 103 throw "Precompiled binary output mismatch."; |
| 105 } | 104 } |
| 106 } finally { | 105 } finally { |
| 107 tmp?.deleteSync(recursive: true); | 106 tmp?.deleteSync(recursive: true); |
| 108 } | 107 } |
| 109 } | 108 } |
| OLD | NEW |