| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 [shared, cc_flags, "-o", libname, "precompiled.S"], | 80 [shared, cc_flags, "-o", libname, "precompiled.S"], |
| 81 workingDirectory: tmp.path); | 81 workingDirectory: tmp.path); |
| 82 if (result.exitCode != 0) { | 82 if (result.exitCode != 0) { |
| 83 print(result.stdout); | 83 print(result.stdout); |
| 84 print(result.stderr); | 84 print(result.stderr); |
| 85 throw "Shared library creation failed!"; | 85 throw "Shared library creation failed!"; |
| 86 } | 86 } |
| 87 | 87 |
| 88 var ld_library_path = new String.fromEnvironment("LD_LIBRARY_PATH"); | 88 var ld_library_path = new String.fromEnvironment("LD_LIBRARY_PATH"); |
| 89 ld_library_path = "${ld_library_path}:${tmp.path}"; | 89 ld_library_path = "${ld_library_path}:${tmp.path}"; |
| 90 exec = "${dart_executable}"; | 90 exec = "${dart_executable}_precompiled"; |
| 91 args = ["--run-precompiled-snapshot", "ignored_script", "--version"]; | 91 args = ["--run-precompiled-snapshot", "ignored_script", "--version"]; |
| 92 print("LD_LIBRARY_PATH=$ld_library_path $exec ${args.join(' ')}"); | 92 print("LD_LIBRARY_PATH=$ld_library_path $exec ${args.join(' ')}"); |
| 93 result = Process.runSync(exec, args, | 93 result = Process.runSync(exec, args, |
| 94 workingDirectory: tmp.path, | 94 workingDirectory: tmp.path, |
| 95 environment: {"LD_LIBRARY_PATH": ld_library_path}); | 95 environment: {"LD_LIBRARY_PATH": ld_library_path}); |
| 96 if (result.exitCode != 0) { | 96 if (result.exitCode != 0) { |
| 97 print(result.stdout); | 97 print(result.stdout); |
| 98 print(result.stderr); | 98 print(result.stderr); |
| 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 |