Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b96a04ba authored by Yuexi Ma's avatar Yuexi Ma Committed by Gerrit Code Review
Browse files

Merge "Export a few utility methods"

parents eb32d6c2 627263fe
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -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)
//
+13 −0
Original line number Diff line number Diff line
@@ -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)
}