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

Unified Diff: tests/standalone/precompilation_test.dart

Issue 1370833003: Extend precompilation test to Mac. Attempt to fix for host MIPS. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/extensions_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/precompilation_test.dart
diff --git a/tests/standalone/precompilation_test.dart b/tests/standalone/precompilation_test.dart
index 4e8d491d6767516f0347d1be149debae271eed02..047ac0d5c6ba00c765ba178e92a21587c0e2d889 100644
--- a/tests/standalone/precompilation_test.dart
+++ b/tests/standalone/precompilation_test.dart
@@ -7,14 +7,42 @@
import 'dart:io';
main(List args) {
- if (!Platform.isLinux) {
- print("Linux only test");
- return;
- }
if (args.length > 0 && args[0] == "--hello") {
print("Hello");
return;
}
+
+ var cc, cc_flags, shared, libname;
+ if (Platform.isLinux) {
+ cc = 'gcc';
+ shared = '-shared';
+ libname = 'libprecompiled.so';
+ } else if (Platform.isMacOS) {
+ cc = 'clang';
+ shared = '-dynamiclib';
+ libname = 'libprecompiled.dylib';
+ } else {
+ print("Test only supports Linux and Mac");
+ return;
+ }
+
+ if (Platform.version.contains("x64")) {
+ cc_flags = "-m64";
+ } else if (Platform.version.contains("simarm64")) {
+ cc_flags = "-m64";
+ } else if (Platform.version.contains("simarm")) {
+ cc_flags = "-m32";
+ } else if (Platform.version.contains("simmips")) {
+ cc_flags = "-m32";
+ } else if (Platform.version.contains("arm")) {
+ cc_flags = "";
+ } else if (Platform.version.contains("mips")) {
+ cc_flags = "-EL";
+ } else {
+ print("Architecture not supported: ${Platform.version}");
+ return;
+ }
+
var dart_executable =
Directory.current.path + Platform.pathSeparator + Platform.executable;
Directory tmp;
@@ -33,39 +61,35 @@ main(List args) {
// Check if gcc is present, and skip test if it is not.
try {
result = Process.runSync(
- "gcc",
+ cc,
["--version"],
workingDirectory: tmp.path);
if (result.exitCode != 0) {
- throw "gcc --version failed.";
+ throw "$cc --version failed.";
}
} catch(e) {
- print("Skipping test because gcc is not present: $e");
+ print("Skipping test because $cc is not present: $e");
return;
}
- // Detect if we're running a 32- or 64-bit VM.
- result = Process.runSync( "file", [dart_executable]);
- if (result.exitCode != 0) {
- print(result.stdout);
- print(result.stderr);
- throw "'file $dart_executable' failed.";
- }
- var m_option = result.stdout.contains("32-bit") ? "-m32" : "-m64";
-
result = Process.runSync(
- "gcc",
- ["-shared", m_option, "-o", "libprecompiled.so", "precompiled.S"],
+ cc,
+ [shared, cc_flags, "-o", libname, "precompiled.S"],
workingDirectory: tmp.path);
if (result.exitCode != 0) {
print(result.stdout);
print(result.stderr);
throw "Shared library creation failed!";
}
+
+ var ld_library_path = new String.fromEnvironment("LD_LIBRARY_PATH");
+ ld_library_path = "${ld_library_path}:${tmp.path}";
+
result = Process.runSync(
"${dart_executable}",
["--run-precompiled-snapshot", "ignored_script", "--hello"],
- workingDirectory: tmp.path);
+ workingDirectory: tmp.path,
+ environment: {"LD_LIBRARY_PATH": ld_library_path});
if (result.exitCode != 0) {
print(result.stdout);
print(result.stderr);
« no previous file with comments | « runtime/bin/extensions_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698