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
This commit is contained in:
Colin Cross
2018-08-07 16:49:25 -07:00
parent bd1cef5618
commit 303e21f695
9 changed files with 249 additions and 12 deletions

View File

@@ -20,6 +20,7 @@ import (
"strings"
"android/soong/android"
"android/soong/tradefed"
)
type TestProperties struct {
@@ -202,6 +203,7 @@ type testBinary struct {
*baseCompiler
Properties TestBinaryProperties
data android.Paths
testConfig android.Path
}
func (test *testBinary) linkerProps() []interface{} {
@@ -217,6 +219,7 @@ func (test *testBinary) linkerInit(ctx BaseModuleContext) {
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) linkerFlags(ctx ModuleContext, flags Flags) Flags {
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 @@ type benchmarkDecorator struct {
*binaryDecorator
Properties BenchmarkProperties
data android.Paths
testConfig android.Path
}
func (benchmark *benchmarkDecorator) linkerInit(ctx BaseModuleContext) {
@@ -338,6 +343,8 @@ func (benchmark *benchmarkDecorator) linkerProps() []interface{} {
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) linkerDeps(ctx DepsContext, deps Deps) Deps
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)