summaryrefslogtreecommitdiff
path: root/rust/rust_test.go
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2021-02-04 11:29:41 -0500
committerIvan Lozano <ivanlozano@google.com>2021-02-04 16:29:02 -0500
commit3dfa12db6c643672b1c41e577c95ef527ebdb0af (patch)
treedf5033090649a20666d70c7cfc51d0b8df01b889 /rust/rust_test.go
parent632f080f8830e2ded22d2e65fdf69cbbe6df40d8 (diff)
rust: Pass cc static libs to rustc.
Pass static libraries to rustc via the "-lstatic" flag so that rustc can reason how to handle these libraries. This means that these static libraries get bundled into rlibs, reducing the need to redeclare these dependencies in dependent modules. Additionally, exported depFlags were never used anywhere, so remove this from flagExporter. Bug: 175886967 Bug: 179122837 Test: m Test: Checked that static symbols aren't duplicated in a resulting binary when it appears in a dependency graph more than once. Change-Id: Ifeb3c384e4fad8704206997242a0156ddcb87d2c
Diffstat (limited to 'rust/rust_test.go')
-rw-r--r--rust/rust_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/rust/rust_test.go b/rust/rust_test.go
index abc9af9b1..a32c6a7f8 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -230,6 +230,7 @@ func TestDepsTracking(t *testing.T) {
}
`)
module := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Module().(*Module)
+ rustc := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Rule("rustc")
// Since dependencies are added to AndroidMk* properties, we can check these to see if they've been picked up.
if !android.InList("libdylib", module.Properties.AndroidMkDylibs) {
@@ -251,6 +252,11 @@ func TestDepsTracking(t *testing.T) {
if !android.InList("libstatic", module.Properties.AndroidMkStaticLibs) {
t.Errorf("Static library dependency not detected (dependency missing from AndroidMkStaticLibs)")
}
+
+ if !strings.Contains(rustc.Args["rustcFlags"], "-lstatic=static") {
+ t.Errorf("-lstatic flag not being passed to rustc for static library")
+ }
+
}
func TestSourceProviderDeps(t *testing.T) {