summaryrefslogtreecommitdiff
path: root/rust/rust_test.go
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2019-09-24 13:23:50 -0700
committerIvan Lozano <ivanlozano@google.com>2019-09-25 00:23:54 +0000
commitb9040d6b76185811f221ce2bed7e29036b7dc209 (patch)
tree292a379e809566db3b7c6fb37c3faaf92ba9aed5 /rust/rust_test.go
parentf23f6d20f040b9dbbaba5536a2dcf6604c70b373 (diff)
Add Soong test for device proc-macro deps.
Ensure that devices can include proc_macros, which are host-only and may include host-only dependencies. Bug: 141491501 Test: Soong tests pass. Test: Test fails as expected when removing CL 1126496 Change-Id: I3ae7ab80283cd1fd4b800a533cb3205b3c108d45
Diffstat (limited to 'rust/rust_test.go')
-rw-r--r--rust/rust_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/rust/rust_test.go b/rust/rust_test.go
index a54615d68..0c8d35586 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -18,6 +18,7 @@ import (
"io/ioutil"
"os"
"runtime"
+ "strings"
"testing"
"android/soong/android"
@@ -175,3 +176,28 @@ func TestDepsTracking(t *testing.T) {
}
}
+
+// Test to make sure proc_macros use host variants when building device modules.
+func TestProcMacroDeviceDeps(t *testing.T) {
+ ctx := testRust(t, `
+ rust_library_host_rlib {
+ name: "libbar",
+ srcs: ["foo.rs"],
+ }
+ rust_proc_macro {
+ name: "libpm",
+ rlibs: ["libbar"],
+ srcs: ["foo.rs"],
+ }
+ rust_binary {
+ name: "fizz-buzz",
+ proc_macros: ["libpm"],
+ srcs: ["foo.rs"],
+ }
+ `)
+ rustc := ctx.ModuleForTests("libpm", "linux_glibc_x86_64").Rule("rustc")
+
+ if !strings.Contains(rustc.Args["libFlags"], "libbar/linux_glibc_x86_64") {
+ t.Errorf("Proc_macro is not using host variant of dependent modules.")
+ }
+}