Move autogenerated test config into Soong
Move autogenerating the test config for Soong modules into Soong
for java_test and android_test modules.
Bug: 70770641
Test: m checkbuild
Test: atest CtsUiRenderingTestCases
Change-Id: I02593add0407ef694b91c14cf27411a4f3cc4745
diff --git a/cc/test.go b/cc/test.go
index 49fc57b..b67341e 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -20,6 +20,7 @@
"strings"
"android/soong/android"
+ "android/soong/tradefed"
)
type TestProperties struct {
@@ -202,6 +203,7 @@
*baseCompiler
Properties TestBinaryProperties
data android.Paths
+ testConfig android.Path
}
func (test *testBinary) linkerProps() []interface{} {
@@ -217,6 +219,7 @@
func (test *testBinary) linkerDeps(ctx DepsContext, deps Deps) Deps {
android.ExtractSourcesDeps(ctx, test.Properties.Data)
+ android.ExtractSourceDeps(ctx, test.Properties.Test_config)
deps = test.testDecorator.linkerDeps(ctx, deps)
deps = test.binaryDecorator.linkerDeps(ctx, deps)
@@ -231,6 +234,7 @@
func (test *testBinary) install(ctx ModuleContext, file android.Path) {
test.data = ctx.ExpandSources(test.Properties.Data, nil)
+ test.testConfig = tradefed.AutoGenNativeTestConfig(ctx, test.Properties.Test_config)
test.binaryDecorator.baseInstaller.dir = "nativetest"
test.binaryDecorator.baseInstaller.dir64 = "nativetest64"
@@ -319,6 +323,7 @@
*binaryDecorator
Properties BenchmarkProperties
data android.Paths
+ testConfig android.Path
}
func (benchmark *benchmarkDecorator) linkerInit(ctx BaseModuleContext) {
@@ -338,6 +343,8 @@
func (benchmark *benchmarkDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
android.ExtractSourcesDeps(ctx, benchmark.Properties.Data)
+ android.ExtractSourceDeps(ctx, benchmark.Properties.Test_config)
+
deps = benchmark.binaryDecorator.linkerDeps(ctx, deps)
deps.StaticLibs = append(deps.StaticLibs, "libgoogle-benchmark")
return deps
@@ -345,6 +352,8 @@
func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Path) {
benchmark.data = ctx.ExpandSources(benchmark.Properties.Data, nil)
+ benchmark.testConfig = tradefed.AutoGenNativeBenchmarkTestConfig(ctx, benchmark.Properties.Test_config)
+
benchmark.binaryDecorator.baseInstaller.dir = filepath.Join("benchmarktest", ctx.ModuleName())
benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("benchmarktest64", ctx.ModuleName())
benchmark.binaryDecorator.baseInstaller.install(ctx, file)