Expand TestSuiteInfoProvider to all test modules
Test suites have been historically only defined in the AndroidMk
functions. But in soong-only builds, we don't run AndroidMk. It appears
Colin already started making a TestSuiteInfo provider, but hadn't
set it on all test modules yet. Expand it to all the test modules,
and add export it to make so that make can check that it matches
LOCAL_COMPATIBILITY_SUITES.
Bug: 388850000
Test: m nothing
Change-Id: Iee8959742117604fd560c95be60f3cb7cf3d9ae4
diff --git a/cc/binary.go b/cc/binary.go
index 627d5e5..608251a 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -551,6 +551,10 @@
binary.baseLinker.moduleInfoJSON(ctx, moduleInfoJSON)
}
+func (binary *binaryDecorator) testSuiteInfo(ctx ModuleContext) {
+ // not a test
+}
+
var _ overridable = (*binaryDecorator)(nil)
func init() {
diff --git a/cc/cc.go b/cc/cc.go
index 16e8df7..ae6f3b0 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -797,6 +797,8 @@
defaultDistFiles() []android.Path
moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *android.ModuleInfoJSON)
+
+ testSuiteInfo(ctx ModuleContext)
}
// specifiedDeps is a tuple struct representing dependencies of a linked binary owned by the linker.
@@ -2408,6 +2410,8 @@
name := v.ImplementationModuleName(ctx.OtherModuleName(c))
ccInfo.LinkerInfo.ImplementationModuleName = &name
}
+
+ c.linker.testSuiteInfo(ctx)
}
if c.library != nil {
ccInfo.LibraryInfo = &LibraryInfo{
diff --git a/cc/library.go b/cc/library.go
index b248224..5299771 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1078,6 +1078,10 @@
library.baseLinker.moduleInfoJSON(ctx, moduleInfoJSON)
}
+func (library *libraryDecorator) testSuiteInfo(ctx ModuleContext) {
+ // not a test
+}
+
func (library *libraryDecorator) linkStatic(ctx ModuleContext,
flags Flags, deps PathDeps, objs Objects) android.Path {
diff --git a/cc/object.go b/cc/object.go
index 95a8beb..ea3ed61 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -250,3 +250,7 @@
object.baseLinker.moduleInfoJSON(ctx, moduleInfoJSON)
moduleInfoJSON.Class = []string{"STATIC_LIBRARIES"}
}
+
+func (object *objectLinker) testSuiteInfo(ctx ModuleContext) {
+ // not a test
+}
diff --git a/cc/test.go b/cc/test.go
index 8b68c55..9c276b8 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -274,6 +274,12 @@
}
}
+func (test *testDecorator) testSuiteInfo(ctx ModuleContext) {
+ android.SetProvider(ctx, android.TestSuiteInfoProvider, android.TestSuiteInfo{
+ TestSuites: test.InstallerProperties.Test_suites,
+ })
+}
+
func NewTestInstaller() *baseInstaller {
return NewBaseInstaller("nativetest", "nativetest64", InstallInData)
}
@@ -342,6 +348,10 @@
}
+func (test *testBinary) testSuiteInfo(ctx ModuleContext) {
+ test.testDecorator.testSuiteInfo(ctx)
+}
+
func (test *testBinary) installerProps() []interface{} {
return append(test.baseInstaller.installerProps(), test.testDecorator.installerProps()...)
}
@@ -578,6 +588,10 @@
test.testDecorator.moduleInfoJSON(ctx, moduleInfoJSON)
}
+func (test *testLibrary) testSuiteInfo(ctx ModuleContext) {
+ test.testDecorator.testSuiteInfo(ctx)
+}
+
func (test *testLibrary) installerProps() []interface{} {
return append(test.baseInstaller.installerProps(), test.testDecorator.installerProps()...)
}
@@ -695,6 +709,12 @@
}
}
+func (benchmark *benchmarkDecorator) testSuiteInfo(ctx ModuleContext) {
+ android.SetProvider(ctx, android.TestSuiteInfoProvider, android.TestSuiteInfo{
+ TestSuites: benchmark.Properties.Test_suites,
+ })
+}
+
func NewBenchmark(hod android.HostOrDeviceSupported) *Module {
module, binary := newBinary(hod)
module.multilib = android.MultilibBoth