summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author yangbill <yangbill@google.com> 2022-02-11 18:06:07 +0800
committer Bill Yang <yangbill@google.com> 2022-02-17 04:06:34 +0000
commit22bafec0425313fb49b6f64a609537ee1b60a76e (patch)
tree059f74219e4199d8b83d441e2f9c189119ff0e06
parentd1072724366e0f719c8dffca5505a4913c91344b (diff)
Propagate data_bins from Soong to Make
Write the list of a test module's data_bins value to the `LOCAL_TEST_DATA_BINS` Makefile variable defined for each module. This enables downstream tools to correctly set up the runtime environment for execution. And currently only sh_test, cc_tests, and rust_tests has this attribute in Android.bp. Bug: 215234071 Test: m out/soong/Android-aosp_cf_x86_64_phone.mk Change-Id: I8d47f5f9b25afdc5975c6b414405badb38dbde4b
-rw-r--r--cc/androidmk.go3
-rw-r--r--rust/androidmk.go3
-rw-r--r--sh/sh_binary.go3
3 files changed, 9 insertions, 0 deletions
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 715490572..92902729c 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -399,6 +399,9 @@ func (test *testBinary) AndroidMkEntries(ctx AndroidMkContext, entries *android.
}
entries.SetBoolIfTrue("LOCAL_COMPATIBILITY_PER_TESTCASE_DIRECTORY", Bool(test.Properties.Per_testcase_directory))
+ if len(test.Properties.Data_bins) > 0 {
+ entries.AddStrings("LOCAL_TEST_DATA_BINS", test.Properties.Data_bins...)
+ }
})
AndroidMkWriteTestData(test.data, entries)
diff --git a/rust/androidmk.go b/rust/androidmk.go
index 4e5863215..2361e0377 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -106,6 +106,9 @@ func (test *testDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidM
}
entries.SetBoolIfTrue("LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG", !BoolDefault(test.Properties.Auto_gen_config, true))
entries.SetBoolIfTrue("LOCAL_IS_UNIT_TEST", Bool(test.Properties.Test_options.Unit_test))
+ if test.Properties.Data_bins != nil {
+ entries.AddStrings("LOCAL_TEST_DATA_BINS", test.Properties.Data_bins...)
+ }
})
cc.AndroidMkWriteTestData(test.data, ret)
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index 2ab784d52..4190e84b8 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -458,6 +458,9 @@ func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries {
dir := strings.TrimSuffix(s.dataModules[relPath].String(), relPath)
entries.AddStrings("LOCAL_TEST_DATA", dir+":"+relPath)
}
+ if s.testProperties.Data_bins != nil {
+ entries.AddStrings("LOCAL_TEST_DATA_BINS", s.testProperties.Data_bins...)
+ }
if Bool(s.testProperties.Test_options.Unit_test) {
entries.SetBool("LOCAL_IS_UNIT_TEST", true)
}