diff options
| author | 2023-10-19 19:22:33 +0000 | |
|---|---|---|
| committer | 2023-10-19 19:22:33 +0000 | |
| commit | 04803d47672036ca4e5582e4a534fa06f775b644 (patch) | |
| tree | 4d7fe9a37807e333f5010ba6802d6f855cd30a45 /java/java_test.go | |
| parent | b2435a464d3ed606e53994d3a154437e07610929 (diff) | |
| parent | 1975d3e326250f8fd002b02faa74b82124b7bae7 (diff) | |
Merge "Disable from-text stub build for coverage build" into main
Diffstat (limited to 'java/java_test.go')
| -rw-r--r-- | java/java_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go index c4fc55bc4..c54c0e68f 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -2599,3 +2599,33 @@ func TestApiLibraryDroidstubsDependency(t *testing.T) { currentApiTimestampPath, ) } + +func TestDisableFromTextStubForCoverageBuild(t *testing.T) { + result := android.GroupFixturePreparers( + prepareForJavaTest, + PrepareForTestWithJavaSdkLibraryFiles, + PrepareForTestWithJacocoInstrumentation, + FixtureWithLastReleaseApis("foo"), + android.FixtureModifyConfig(func(config android.Config) { + config.SetApiLibraries([]string{"foo"}) + config.SetBuildFromTextStub(true) + }), + android.FixtureModifyEnv(func(env map[string]string) { + env["EMMA_INSTRUMENT"] = "true" + }), + ).RunTestWithBp(t, ` + java_sdk_library { + name: "foo", + srcs: ["A.java"], + } + `) + android.AssertBoolEquals(t, "stub module expected to depend on from-source stub", + true, CheckModuleHasDependency(t, result.TestContext, + apiScopePublic.stubsLibraryModuleName("foo"), "android_common", + apiScopePublic.sourceStubLibraryModuleName("foo"))) + + android.AssertBoolEquals(t, "stub module expected to not depend on from-text stub", + false, CheckModuleHasDependency(t, result.TestContext, + apiScopePublic.stubsLibraryModuleName("foo"), "android_common", + apiScopePublic.apiLibraryModuleName("foo"))) +} |