summaryrefslogtreecommitdiff
path: root/rust/test.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2021-12-07 10:17:00 -0500
committer Ivan Lozano <ivanlozano@google.com> 2021-12-07 10:19:48 -0500
commitf5c98a2fe5905cf3ee8487906f7ba1f88f3b3ab2 (patch)
tree119ed673d51ae512317d66b3823bbc1a0416133f /rust/test.go
parent8c64fa9a8efafadb787143296750b32a0119f23b (diff)
rust: Fix Host multilib prop for rust_test modules.
NewRustTest will set MultilibBoth true for modules which target devices, however modules which target both device and host incorrectly sets MultilibBoth for the host variant. Host tests can only produce the primary arch target. Therefore, add the rustTestHostMultilib load hook to set MultilibFirst for the host variant. Test: m rust_test module with host_supported: true, check if x86 test produced. Change-Id: I5b04b2a2d898823bcf326336d1d28c46945d47f5
Diffstat (limited to 'rust/test.go')
-rw-r--r--rust/test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/rust/test.go b/rust/test.go
index 3eea0ada4..250b7657e 100644
--- a/rust/test.go
+++ b/rust/test.go
@@ -210,6 +210,12 @@ func init() {
func RustTestFactory() android.Module {
module, _ := NewRustTest(android.HostAndDeviceSupported)
+
+ // NewRustTest will set MultilibBoth true, however the host variant
+ // cannot produce the non-primary target. Therefore, add the
+ // rustTestHostMultilib load hook to set MultilibFirst for the
+ // host target.
+ android.AddLoadHook(module, rustTestHostMultilib)
return module.Init()
}
@@ -236,3 +242,16 @@ func (test *testDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps {
func (test *testDecorator) testBinary() bool {
return true
}
+
+func rustTestHostMultilib(ctx android.LoadHookContext) {
+ type props struct {
+ Target struct {
+ Host struct {
+ Compile_multilib *string
+ }
+ }
+ }
+ p := &props{}
+ p.Target.Host.Compile_multilib = proptools.StringPtr("first")
+ ctx.AppendProperties(p)
+}