OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 // Test generating and running a simple precompiled snapshot of this script. | |
6 | |
7 import 'dart:io'; | |
8 | |
9 main(List args) { | |
10 if (!Platform.isLinux) { | |
11 print("Linux only test"); | |
12 return; | |
13 } | |
14 if (args.length > 0 && args[0] == "--hello") { | |
15 print("Hello"); | |
16 return; | |
17 } | |
18 String dart_executable = | |
19 Directory.current.path + Platform.pathSeparator + Platform.executable; | |
20 Directory tmp; | |
21 try { | |
22 tmp = Directory.current.createTempSync("temp_precompilation_test"); | |
23 var result = Process.runSync( | |
24 "${dart_executable}_no_snapshot", | |
25 ["--gen-precompiled-snapshot", Platform.script.path], | |
26 workingDirectory: tmp.path); | |
27 if (result.exitCode != 0) { | |
28 print(result.stdout); | |
29 print(result.stderr); | |
30 throw "Snapshot generation failed."; | |
31 } | |
Bill Hesse
2015/09/23 17:17:37
Maybe try and run gcc --version, and if it fails,
Florian Schneider
2015/09/24 09:36:36
Done.
| |
32 result = Process.runSync( | |
33 "gcc", | |
rmacnak
2015/09/23 17:34:59
The ARM bots download a cross-compiled build inste
Florian Schneider
2015/09/24 09:36:36
Bill said they have gcc. But I'll add the check li
| |
34 ["-shared", "-o", "libprecompiled.so", "precompiled.S"], | |
rmacnak
2015/09/23 17:34:59
If enabled for the simulators, should explicitly p
Florian Schneider
2015/09/24 09:36:36
Done. I didn't find a generic way to check for 32-
| |
35 workingDirectory: tmp.path); | |
36 if (result.exitCode != 0) { | |
37 print(result.stdout); | |
38 print(result.stderr); | |
39 throw "Shared library creation failed!"; | |
40 } | |
41 result = Process.runSync( | |
42 "${dart_executable}", | |
43 ["--run-precompiled-snapshot", "ignored_script", "--hello"], | |
44 workingDirectory: tmp.path); | |
45 if (result.exitCode != 0) { | |
46 print(result.stdout); | |
47 print(result.stderr); | |
48 throw "Precompiled binary failed."; | |
49 } | |
50 print(result.stdout); | |
51 if (result.stdout != "Hello\n") { | |
52 throw "Precompiled binary output mismatch."; | |
53 } | |
54 } finally { | |
55 tmp?.deleteSync(recursive: true); | |
56 } | |
57 } | |
OLD | NEW |