aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2020-12-01 22:37:46 +0000
committerKimberly Kreider <kkreider@google.com>2020-12-09 19:40:47 +0000
commit6a421b339ff0a3c3ebadade7471ea792337c1850 (patch)
tree1f7b701d7efc17649a758fa2d41153fb0abb6d07
parent85c57e22c3ae116fab71db8d7e214c42f4f0c636 (diff)
downloadsoong-6a421b339ff0a3c3ebadade7471ea792337c1850.tar.gz
Merge "Add test suite handling to central androidmk code" am: 464e6c71df
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1513215 Change-Id: Ic663483b0a799793e7eac61f796af3c99a204954 Merged-In: Ic663483b0a799793e7eac61f796af3c99a204954
-rw-r--r--android/androidmk.go12
-rw-r--r--android/csuite_config.go2
-rw-r--r--cc/androidmk.go6
-rw-r--r--java/androidmk.go4
-rw-r--r--python/androidmk.go4
-rw-r--r--rust/androidmk.go2
-rw-r--r--sh/sh_binary.go3
7 files changed, 21 insertions, 12 deletions
diff --git a/android/androidmk.go b/android/androidmk.go
index 57908c761..ab193724f 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -176,6 +176,18 @@ func (a *AndroidMkEntries) AddStrings(name string, value ...string) {
a.EntryMap[name] = append(a.EntryMap[name], value...)
}
+// AddCompatibilityTestSuites adds the supplied test suites to the EntryMap, with special handling
+// for partial MTS test suites.
+func (a *AndroidMkEntries) AddCompatibilityTestSuites(suites ...string) {
+ // MTS supports a full test suite and partial per-module MTS test suites, with naming mts-${MODULE}.
+ // To reduce repetition, if we find a partial MTS test suite without an full MTS test suite,
+ // we add the full test suite to our list.
+ if PrefixInList(suites, "mts-") && !InList("mts", suites) {
+ suites = append(suites, "mts")
+ }
+ a.AddStrings("LOCAL_COMPATIBILITY_SUITE", suites...)
+}
+
// Compute the list of Make strings to declare phone goals and dist-for-goals
// calls from the module's dist and dists properties.
func (a *AndroidMkEntries) GetDistForGoals(mod blueprint.Module) []string {
diff --git a/android/csuite_config.go b/android/csuite_config.go
index a5b15331a..bf24d98c7 100644
--- a/android/csuite_config.go
+++ b/android/csuite_config.go
@@ -44,7 +44,7 @@ func (me *CSuiteConfig) AndroidMkEntries() []AndroidMkEntries {
if me.properties.Test_config != nil {
entries.SetString("LOCAL_TEST_CONFIG", *me.properties.Test_config)
}
- entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", "csuite")
+ entries.AddCompatibilityTestSuites("csuite")
},
}
return []AndroidMkEntries{androidMkEntries}
diff --git a/cc/androidmk.go b/cc/androidmk.go
index cb83e7eaa..8208ea3f3 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -338,8 +338,7 @@ func (benchmark *benchmarkDecorator) AndroidMkEntries(ctx AndroidMkContext, entr
entries.Class = "NATIVE_TESTS"
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
if len(benchmark.Properties.Test_suites) > 0 {
- entries.SetString("LOCAL_COMPATIBILITY_SUITE",
- strings.Join(benchmark.Properties.Test_suites, " "))
+ entries.AddCompatibilityTestSuites(benchmark.Properties.Test_suites...)
}
if benchmark.testConfig != nil {
entries.SetString("LOCAL_FULL_TEST_CONFIG", benchmark.testConfig.String())
@@ -361,8 +360,7 @@ func (test *testBinary) AndroidMkEntries(ctx AndroidMkContext, entries *android.
}
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
if len(test.Properties.Test_suites) > 0 {
- entries.SetString("LOCAL_COMPATIBILITY_SUITE",
- strings.Join(test.Properties.Test_suites, " "))
+ entries.AddCompatibilityTestSuites(test.Properties.Test_suites...)
}
if test.testConfig != nil {
entries.SetString("LOCAL_FULL_TEST_CONFIG", test.testConfig.String())
diff --git a/java/androidmk.go b/java/androidmk.go
index 08febcd9f..413988eab 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -151,9 +151,9 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
func testSuiteComponent(entries *android.AndroidMkEntries, test_suites []string) {
entries.SetString("LOCAL_MODULE_TAGS", "tests")
if len(test_suites) > 0 {
- entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", test_suites...)
+ entries.AddCompatibilityTestSuites(test_suites...)
} else {
- entries.SetString("LOCAL_COMPATIBILITY_SUITE", "null-suite")
+ entries.AddCompatibilityTestSuites("null-suite")
}
}
diff --git a/python/androidmk.go b/python/androidmk.go
index 61cde019c..648b14d7f 100644
--- a/python/androidmk.go
+++ b/python/androidmk.go
@@ -48,7 +48,7 @@ func (p *binaryDecorator) AndroidMk(base *Module, entries *android.AndroidMkEntr
entries.Class = "EXECUTABLES"
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
- entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", p.binaryProperties.Test_suites...)
+ entries.AddCompatibilityTestSuites(p.binaryProperties.Test_suites...)
})
base.subAndroidMk(entries, p.pythonInstaller)
}
@@ -57,7 +57,7 @@ func (p *testDecorator) AndroidMk(base *Module, entries *android.AndroidMkEntrie
entries.Class = "NATIVE_TESTS"
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
- entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", p.binaryDecorator.binaryProperties.Test_suites...)
+ entries.AddCompatibilityTestSuites(p.binaryDecorator.binaryProperties.Test_suites...)
if p.testConfig != nil {
entries.SetString("LOCAL_FULL_TEST_CONFIG", p.testConfig.String())
}
diff --git a/rust/androidmk.go b/rust/androidmk.go
index 428e74925..758e63fef 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -82,7 +82,7 @@ func (test *testDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidM
ret.Class = "NATIVE_TESTS"
ret.SubName = test.getMutatedModuleSubName(ctx.Name())
ret.ExtraEntries = append(ret.ExtraEntries, func(entries *android.AndroidMkEntries) {
- entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", test.Properties.Test_suites...)
+ entries.AddCompatibilityTestSuites(test.Properties.Test_suites...)
if test.testConfig != nil {
entries.SetString("LOCAL_FULL_TEST_CONFIG", test.testConfig.String())
}
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index ab0490ac1..d8e324409 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -229,8 +229,7 @@ func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries {
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(entries *android.AndroidMkEntries) {
s.customAndroidMkEntries(entries)
-
- entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", s.testProperties.Test_suites...)
+ entries.AddCompatibilityTestSuites(s.testProperties.Test_suites...)
if s.testConfig != nil {
entries.SetPath("LOCAL_FULL_TEST_CONFIG", s.testConfig)
}