build device binary for java_test_host

This commit adds support for a java_host_test that requires a target
binary to run. If the binary has host and target variants and is added
as a dependency in the `data` attribute, then the host variant is used.
Instead, we need a way to force the use of the target variant.

Bug: 182919153
Test: add code from aosp/1647282/1 && atest AuthFsHostTest
Change-Id: I68a6259b41a5e6809e1b82eec3122ffdf5067f56
This commit is contained in:
Sam Delmerico
2022-01-20 21:10:28 +00:00
parent 1e698865b5
commit b3342ce580
4 changed files with 140 additions and 7 deletions

View File

@@ -188,20 +188,20 @@ func AutoGenNativeBenchmarkTestConfig(ctx android.ModuleContext, testConfigProp
}
func AutoGenJavaTestConfig(ctx android.ModuleContext, testConfigProp *string, testConfigTemplateProp *string,
testSuites []string, autoGenConfig *bool, unitTest *bool) android.Path {
testSuites []string, config []Config, autoGenConfig *bool, unitTest *bool) android.Path {
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
if autogenPath != nil {
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
if templatePath.Valid() {
autogenTemplate(ctx, autogenPath, templatePath.String(), nil, "")
autogenTemplate(ctx, autogenPath, templatePath.String(), config, "")
} else {
if ctx.Device() {
autogenTemplate(ctx, autogenPath, "${JavaTestConfigTemplate}", nil, "")
autogenTemplate(ctx, autogenPath, "${JavaTestConfigTemplate}", config, "")
} else {
if Bool(unitTest) {
autogenTemplate(ctx, autogenPath, "${JavaHostUnitTestConfigTemplate}", nil, "")
autogenTemplate(ctx, autogenPath, "${JavaHostUnitTestConfigTemplate}", config, "")
} else {
autogenTemplate(ctx, autogenPath, "${JavaHostTestConfigTemplate}", nil, "")
autogenTemplate(ctx, autogenPath, "${JavaHostTestConfigTemplate}", config, "")
}
}
}