Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: tests/standalone/precompilation_test.dart

Issue 1844233002: Add diagnostic printing to standalone/precompilation_test. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/standalone/precompilation_dart2js_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 print("Creating precompiled snapshot...");
46 var dart_executable = 47 var dart_executable =
47 Directory.current.path + Platform.pathSeparator + Platform.executable; 48 Directory.current.path + Platform.pathSeparator + Platform.executable;
48 Directory tmp; 49 Directory tmp;
49 try { 50 try {
50 tmp = Directory.current.createTempSync("temp_precompilation_test"); 51 tmp = Directory.current.createTempSync("temp_precompilation_test");
51 var result = Process.runSync( 52 var result = Process.runSync(
52 "${dart_executable}_bootstrap", 53 "${dart_executable}_bootstrap",
53 ["--gen-precompiled-snapshot", Platform.script.path], 54 ["--gen-precompiled-snapshot", Platform.script.path],
54 workingDirectory: tmp.path); 55 workingDirectory: tmp.path);
55 if (result.exitCode != 0) { 56 if (result.exitCode != 0) {
56 print(result.stdout); 57 print(result.stdout);
57 print(result.stderr); 58 print(result.stderr);
58 throw "Snapshot generation failed."; 59 throw "Snapshot generation failed.";
59 } 60 }
60 61
61 // Check if gcc is present, and skip test if it is not. 62 // Check if gcc is present, and skip test if it is not.
63 print("Creating shared library...");
62 try { 64 try {
63 result = Process.runSync( 65 result = Process.runSync(
64 cc, 66 cc,
65 ["--version"], 67 ["--version"],
66 workingDirectory: tmp.path); 68 workingDirectory: tmp.path);
67 if (result.exitCode != 0) { 69 if (result.exitCode != 0) {
68 throw "$cc --version failed."; 70 throw "$cc --version failed.";
69 } 71 }
70 } catch(e) { 72 } catch(e) {
71 print("Skipping test because $cc is not present: $e"); 73 print("Skipping test because $cc is not present: $e");
72 return; 74 return;
73 } 75 }
74 76
75 result = Process.runSync( 77 result = Process.runSync(
76 cc, 78 cc,
77 [shared, cc_flags, "-nostartfiles", "-o", libname, "precompiled.S"], 79 [shared, cc_flags, "-nostartfiles", "-o", libname, "precompiled.S"],
78 workingDirectory: tmp.path); 80 workingDirectory: tmp.path);
79 if (result.exitCode != 0) { 81 if (result.exitCode != 0) {
80 print(result.stdout); 82 print(result.stdout);
81 print(result.stderr); 83 print(result.stderr);
82 throw "Shared library creation failed!"; 84 throw "Shared library creation failed!";
83 } 85 }
84 86
87 print("Running test program...");
85 var ld_library_path = new String.fromEnvironment("LD_LIBRARY_PATH"); 88 var ld_library_path = new String.fromEnvironment("LD_LIBRARY_PATH");
86 ld_library_path = "${ld_library_path}:${tmp.path}"; 89 ld_library_path = "${ld_library_path}:${tmp.path}";
87 90
88 result = Process.runSync( 91 result = Process.runSync(
89 "${dart_executable}_precompiled_runtime", 92 "${dart_executable}_precompiled_runtime",
90 ["--run-precompiled-snapshot", "ignored_script", "--hello"], 93 ["--run-precompiled-snapshot", "ignored_script", "--hello"],
91 workingDirectory: tmp.path, 94 workingDirectory: tmp.path,
92 environment: {"LD_LIBRARY_PATH": ld_library_path}); 95 environment: {"LD_LIBRARY_PATH": ld_library_path});
93 if (result.exitCode != 0) { 96 if (result.exitCode != 0) {
94 print(result.stdout); 97 print(result.stdout);
95 print(result.stderr); 98 print(result.stderr);
96 throw "Precompiled binary failed."; 99 throw "Precompiled binary failed.";
97 } 100 }
98 print(result.stdout); 101 print(result.stdout);
99 if (result.stdout != "Hello\n") { 102 if (result.stdout != "Hello\n") {
100 throw "Precompiled binary output mismatch."; 103 throw "Precompiled binary output mismatch.";
101 } 104 }
102 } finally { 105 } finally {
103 tmp?.deleteSync(recursive: true); 106 tmp?.deleteSync(recursive: true);
104 } 107 }
105 } 108 }
OLDNEW
« no previous file with comments | « tests/standalone/precompilation_dart2js_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698