Merge "Export a few utility methods"

This commit is contained in:
Yuexi Ma
2021-03-17 01:40:51 +00:00
committed by Gerrit Code Review
2 changed files with 28 additions and 1 deletions

View File

@@ -2520,6 +2520,10 @@ func (j *TestHost) DepsMutator(ctx android.BottomUpMutatorContext) {
j.deps(ctx)
}
func (j *TestHost) AddExtraResource(p android.Path) {
j.extraResources = append(j.extraResources, p)
}
func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if j.testProperties.Test_options.Unit_test == nil && ctx.Host() {
// TODO(b/): Clean temporary heuristic to avoid unexpected onboarding.
@@ -2683,13 +2687,23 @@ func TestHostFactory() android.Module {
module.AddProperties(&module.testProperties)
module.AddProperties(&module.testHostProperties)
module.Module.properties.Installable = proptools.BoolPtr(true)
InitTestHost(
module,
proptools.BoolPtr(true),
nil,
nil)
InitJavaModuleMultiTargets(module, android.HostSupported)
return module
}
func InitTestHost(th *TestHost, installable *bool, testSuites []string, autoGenConfig *bool) {
th.properties.Installable = installable
th.testProperties.Auto_gen_config = autoGenConfig
th.testProperties.Test_suites = testSuites
}
//
// Java Binaries (.jar file plus wrapper script)
//

View File

@@ -2601,3 +2601,16 @@ func TestDataNativeBinaries(t *testing.T) {
t.Errorf("Unexpected test data - expected: %q, actual: %q", expected, actual)
}
}
func TestDefaultInstallable(t *testing.T) {
ctx, _ := testJava(t, `
java_test_host {
name: "foo"
}
`)
buildOS := android.BuildOs.String()
module := ctx.ModuleForTests("foo", buildOS+"_common").Module().(*TestHost)
assertDeepEquals(t, "Default installable value should be true.", proptools.BoolPtr(true),
module.properties.Installable)
}