dart-sdk/tests/ffi/dylib_utils.dart
Daco Harkes 550d580d5e [vm/ffi] Fuchsia FFI testing package
This does not include enabling the FFI on Fuchsia. So these tests will
fail without the dependent CL.

This CL adds an `all_positive.dart` test file to be packaged in the
.far file, such that it is easier to run all FFI tests in one go.

We don't run tests on the bots, but we do build this test package on
the bots.

To build the .far files locally:
```
tools/build.py --os=fuchsia -m debug fuchsia_ffi_test_package
tools/build.py --os=fuchsia -m debug -a arm64 fuchsia_ffi_test_package
```

Issue: https://github.com/dart-lang/sdk/issues/44434

Change-Id: Iec418e0c10d77afbf811fb83151664bcc2710b99
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175484
Reviewed-by: Liam Appelbe <liama@google.com>
2020-12-10 12:15:17 +00:00

21 lines
807 B
Dart

// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:ffi' as ffi;
import 'dart:io' show Platform;
String _platformPath(String name, {String? path}) {
if (path == null) path = "";
if (Platform.isLinux || Platform.isAndroid || Platform.isFuchsia)
return path + "lib" + name + ".so";
if (Platform.isMacOS) return path + "lib" + name + ".dylib";
if (Platform.isWindows) return path + name + ".dll";
throw Exception("Platform not implemented");
}
ffi.DynamicLibrary dlopenPlatformSpecific(String name, {String? path}) {
String fullPath = _platformPath(name, path: path);
return ffi.DynamicLibrary.open(fullPath);
}