Build test_module_config modules' module_info_json in soong
To be able to run these tests in soong-only builds.
This cl produces the following diff:
https://paste.googleplex.com/4917659043627008
The diff is enitrely additional host dependencies. Without the line
adding the ExtraHostRequired modules it becomes a diff of missing
host dependencies. Of the two I chose the extras. It's difficult to get
the required list exactly matching make.
Fixes: 400731860
Test: The diff + atest CtsWifiTestCases_NoNonMainlineTest
Change-Id: Idbbfbf7f74eb2eeaf68d64c0bcfbc97ddae3e2ea
diff --git a/android/module.go b/android/module.go
index 7786f13..713751a 100644
--- a/android/module.go
+++ b/android/module.go
@@ -2167,6 +2167,7 @@
} else {
hostRequired = m.baseProperties.Host_required
}
+ hostRequired = append(hostRequired, moduleInfoJSON.ExtraHostRequired...)
var data []string
for _, d := range ctx.testData {
diff --git a/android/module_info_json.go b/android/module_info_json.go
index bb309ff..50c961a 100644
--- a/android/module_info_json.go
+++ b/android/module_info_json.go
@@ -40,10 +40,12 @@
StaticDependencies []string `json:"static_dependencies,omitempty"` // $(sort $(ALL_MODULES.$(m).LOCAL_STATIC_LIBRARIES))
DataDependencies []string `json:"data_dependencies,omitempty"` // $(sort $(ALL_MODULES.$(m).TEST_DATA_BINS))
- CompatibilitySuites []string `json:"compatibility_suites,omitempty"` // $(sort $(ALL_MODULES.$(m).COMPATIBILITY_SUITES))
- AutoTestConfig []string `json:"auto_test_config,omitempty"` // $(ALL_MODULES.$(m).auto_test_config)
- TestConfig []string `json:"test_config,omitempty"` // $(strip $(ALL_MODULES.$(m).TEST_CONFIG) $(ALL_MODULES.$(m).EXTRA_TEST_CONFIGS)
- ExtraRequired []string `json:"-"`
+ CompatibilitySuites []string `json:"compatibility_suites,omitempty"` // $(sort $(ALL_MODULES.$(m).COMPATIBILITY_SUITES))
+ AutoTestConfig []string `json:"auto_test_config,omitempty"` // $(ALL_MODULES.$(m).auto_test_config)
+ TestConfig []string `json:"test_config,omitempty"` // $(strip $(ALL_MODULES.$(m).TEST_CONFIG) $(ALL_MODULES.$(m).EXTRA_TEST_CONFIGS)
+ TestModuleConfigBase string `json:"test_module_config_base,omitempty"`
+ ExtraRequired []string `json:"-"`
+ ExtraHostRequired []string `json:"-"`
SupportedVariantsOverride []string `json:"-"`
Disabled bool `json:"-"`
diff --git a/tradefed_modules/test_module_config.go b/tradefed_modules/test_module_config.go
index 988352c..6dd48eb 100644
--- a/tradefed_modules/test_module_config.go
+++ b/tradefed_modules/test_module_config.go
@@ -162,6 +162,22 @@
m.validateBase(ctx, &testModuleConfigTag, "android_test", false)
m.generateManifestAndConfig(ctx)
+ moduleInfoJSON := ctx.ModuleInfoJSON()
+ moduleInfoJSON.Class = []string{m.provider.MkAppClass}
+ if m.provider.MkAppClass != "NATIVE_TESTS" {
+ moduleInfoJSON.Tags = append(moduleInfoJSON.Tags, "tests")
+ }
+ if m.provider.IsUnitTest {
+ moduleInfoJSON.IsUnitTest = "true"
+ }
+ moduleInfoJSON.CompatibilitySuites = append(moduleInfoJSON.CompatibilitySuites, m.tradefedProperties.Test_suites...)
+ moduleInfoJSON.SystemSharedLibs = []string{"none"}
+ moduleInfoJSON.ExtraRequired = append(moduleInfoJSON.ExtraRequired, m.provider.RequiredModuleNames...)
+ moduleInfoJSON.ExtraRequired = append(moduleInfoJSON.ExtraRequired, *m.Base)
+ moduleInfoJSON.ExtraHostRequired = append(moduleInfoJSON.ExtraRequired, m.provider.HostRequiredModuleNames...)
+ moduleInfoJSON.TestConfig = []string{m.testConfig.String()}
+ moduleInfoJSON.AutoTestConfig = []string{"true"}
+ moduleInfoJSON.TestModuleConfigBase = proptools.String(m.Base)
}
// Ensure at least one test_suite is listed. Ideally it should be general-tests