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 dart_executable = | 46 var dart_executable = |
47 Directory.current.path + Platform.pathSeparator + Platform.executable; | 47 Directory.current.path + Platform.pathSeparator + Platform.executable; |
48 Directory tmp; | 48 Directory tmp; |
49 try { | 49 try { |
50 tmp = Directory.current.createTempSync("temp_precompilation_test"); | 50 tmp = Directory.current.createTempSync("temp_precompilation_test"); |
51 var result = Process.runSync( | 51 var result = Process.runSync( |
52 "${dart_executable}_no_snapshot", | 52 "${dart_executable}_bootstrap", |
53 ["--gen-precompiled-snapshot", Platform.script.path], | 53 ["--gen-precompiled-snapshot", Platform.script.path], |
54 workingDirectory: tmp.path); | 54 workingDirectory: tmp.path); |
55 if (result.exitCode != 0) { | 55 if (result.exitCode != 0) { |
56 print(result.stdout); | 56 print(result.stdout); |
57 print(result.stderr); | 57 print(result.stderr); |
58 throw "Snapshot generation failed."; | 58 throw "Snapshot generation failed."; |
59 } | 59 } |
60 | 60 |
61 // Check if gcc is present, and skip test if it is not. | 61 // Check if gcc is present, and skip test if it is not. |
62 try { | 62 try { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 throw "Precompiled binary failed."; | 96 throw "Precompiled binary failed."; |
97 } | 97 } |
98 print(result.stdout); | 98 print(result.stdout); |
99 if (result.stdout != "Hello\n") { | 99 if (result.stdout != "Hello\n") { |
100 throw "Precompiled binary output mismatch."; | 100 throw "Precompiled binary output mismatch."; |
101 } | 101 } |
102 } finally { | 102 } finally { |
103 tmp?.deleteSync(recursive: true); | 103 tmp?.deleteSync(recursive: true); |
104 } | 104 } |
105 } | 105 } |
OLD | NEW |