summaryrefslogtreecommitdiff
path: root/rust/library_test.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2020-06-19 12:32:30 -0400
committer Ivan Lozano <ivanlozano@google.com> 2020-06-19 13:54:26 -0400
commit7e741cca301006b5e5801e14a180a8b346b2aa83 (patch)
treeea77805d5b47624b8510089606c3ded1dbbdd743 /rust/library_test.go
parent2752d926a9aa78f68c0713af6ecda11b5b02b583 (diff)
[Rust] cdylibs can now link against dylibs.
Bug: 144861059 Test: cd external/rust/crates; mma Test: Manual verification through ldd that libstd is a dependency Change-Id: I603cf519215317aa8c400cd0f6ebb1b58f5bcf15
Diffstat (limited to 'rust/library_test.go')
-rw-r--r--rust/library_test.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/rust/library_test.go b/rust/library_test.go
index 37dd5414c..9d2f6c00a 100644
--- a/rust/library_test.go
+++ b/rust/library_test.go
@@ -17,6 +17,8 @@ package rust
import (
"strings"
"testing"
+
+ "android/soong/android"
)
// Test that variants are being generated correctly, and that crate-types are correct.
@@ -115,16 +117,24 @@ func TestValidateLibraryStem(t *testing.T) {
}
-func TestSharedLibraryFlags(t *testing.T) {
+func TestSharedLibrary(t *testing.T) {
ctx := testRust(t, `
- rust_library_host {
+ rust_library {
name: "libfoo",
srcs: ["foo.rs"],
crate_name: "foo",
}`)
- libfooShared := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_shared").Output("libfoo.so")
- if !strings.Contains(libfooShared.Args["linkFlags"], "-Wl,-soname=libfoo.so") {
- t.Errorf("missing expected -Wl,-soname linker flag for libfoo shared lib, linkFlags: %#v", libfooShared.Args["linkFlags"])
+ libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared")
+
+ libfooOutput := libfoo.Output("libfoo.so")
+ if !strings.Contains(libfooOutput.Args["linkFlags"], "-Wl,-soname=libfoo.so") {
+ t.Errorf("missing expected -Wl,-soname linker flag for libfoo shared lib, linkFlags: %#v",
+ libfooOutput.Args["linkFlags"])
+ }
+
+ if !android.InList("libstd", libfoo.Module().(*Module).Properties.AndroidMkDylibs) {
+ t.Errorf("Non-static libstd dylib expected to be a dependency of Rust shared libraries. Dylib deps are: %#v",
+ libfoo.Module().(*Module).Properties.AndroidMkDylibs)
}
}