Merge "Remove javaFixtureFactory" am: b6535d329f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1649805 Change-Id: Iaf3eb19c3cb165f9d7e59527fba9588c1a8f172b
This commit is contained in:
@@ -135,7 +135,8 @@ func TestHostdexSpecificRequired(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
|
func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) {
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("foo-shared_library", "foo-no_shared_library"),
|
FixtureWithLastReleaseApis("foo-shared_library", "foo-no_shared_library"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
|
@@ -29,14 +29,14 @@ import (
|
|||||||
"android/soong/genrule"
|
"android/soong/genrule"
|
||||||
)
|
)
|
||||||
|
|
||||||
// testApp runs tests using the javaFixtureFactory
|
// testApp runs tests using the prepareForJavaTest
|
||||||
//
|
//
|
||||||
// See testJava for an explanation as to how to stop using this deprecated method.
|
// See testJava for an explanation as to how to stop using this deprecated method.
|
||||||
//
|
//
|
||||||
// deprecated
|
// deprecated
|
||||||
func testApp(t *testing.T, bp string) *android.TestContext {
|
func testApp(t *testing.T, bp string) *android.TestContext {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
result := javaFixtureFactory.RunTestWithBp(t, bp)
|
result := prepareForJavaTest.RunTestWithBp(t, bp)
|
||||||
return result.TestContext
|
return result.TestContext
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,8 @@ func TestApp(t *testing.T) {
|
|||||||
|
|
||||||
for _, moduleType := range []string{"android_app", "android_library"} {
|
for _, moduleType := range []string{"android_app", "android_library"} {
|
||||||
t.Run(moduleType, func(t *testing.T) {
|
t.Run(moduleType, func(t *testing.T) {
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
android.FixtureModifyMockFS(func(fs android.MockFS) {
|
android.FixtureModifyMockFS(func(fs android.MockFS) {
|
||||||
for _, file := range resourceFiles {
|
for _, file := range resourceFiles {
|
||||||
fs[file] = nil
|
fs[file] = nil
|
||||||
@@ -364,8 +365,8 @@ func TestUpdatableApps(t *testing.T) {
|
|||||||
if test.expectedError != "" {
|
if test.expectedError != "" {
|
||||||
errorHandler = android.FixtureExpectsAtLeastOneErrorMatchingPattern(test.expectedError)
|
errorHandler = android.FixtureExpectsAtLeastOneErrorMatchingPattern(test.expectedError)
|
||||||
}
|
}
|
||||||
javaFixtureFactory.
|
android.GroupFixturePreparers(
|
||||||
Extend(FixtureWithPrebuiltApis(map[string][]string{
|
prepareForJavaTest, FixtureWithPrebuiltApis(map[string][]string{
|
||||||
"29": {"foo"},
|
"29": {"foo"},
|
||||||
})).
|
})).
|
||||||
ExtendWithErrorHandler(errorHandler).RunTestWithBp(t, test.bp)
|
ExtendWithErrorHandler(errorHandler).RunTestWithBp(t, test.bp)
|
||||||
@@ -1063,7 +1064,8 @@ func TestAppSdkVersion(t *testing.T) {
|
|||||||
%s
|
%s
|
||||||
}`, moduleType, test.sdkVersion, platformApiProp)
|
}`, moduleType, test.sdkVersion, platformApiProp)
|
||||||
|
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
variables.Platform_sdk_version = &test.platformSdkInt
|
variables.Platform_sdk_version = &test.platformSdkInt
|
||||||
variables.Platform_sdk_codename = &test.platformSdkCodename
|
variables.Platform_sdk_codename = &test.platformSdkCodename
|
||||||
@@ -1131,7 +1133,8 @@ func TestVendorAppSdkVersion(t *testing.T) {
|
|||||||
vendor: true,
|
vendor: true,
|
||||||
}`, moduleType, sdkKind, test.sdkVersion)
|
}`, moduleType, sdkKind, test.sdkVersion)
|
||||||
|
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
variables.Platform_sdk_version = &test.platformSdkInt
|
variables.Platform_sdk_version = &test.platformSdkInt
|
||||||
variables.Platform_sdk_codename = &test.platformSdkCodename
|
variables.Platform_sdk_codename = &test.platformSdkCodename
|
||||||
@@ -2331,7 +2334,8 @@ func TestUsesLibraries(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("runtime-library", "foo", "quuz", "qux", "bar", "fred"),
|
FixtureWithLastReleaseApis("runtime-library", "foo", "quuz", "qux", "bar", "fred"),
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
@@ -2681,7 +2685,8 @@ func TestUncompressDex(t *testing.T) {
|
|||||||
test := func(t *testing.T, bp string, want bool, unbundled bool) {
|
test := func(t *testing.T, bp string, want bool, unbundled bool) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithPrebuiltsOfCurrentApi,
|
PrepareForTestWithPrebuiltsOfCurrentApi,
|
||||||
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
if unbundled {
|
if unbundled {
|
||||||
|
@@ -43,12 +43,12 @@ func testDexpreoptBoot(t *testing.T, ruleFile string, expectedInputs, expectedOu
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
result := javaFixtureFactory.
|
result := android.GroupFixturePreparers(
|
||||||
Extend(
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("foo"),
|
FixtureWithLastReleaseApis("foo"),
|
||||||
dexpreopt.FixtureSetBootJars("platform:foo", "platform:bar", "platform:baz"),
|
dexpreopt.FixtureSetBootJars("platform:foo", "platform:bar", "platform:baz"),
|
||||||
).RunTestWithBp(t, bp)
|
).RunTestWithBp(t, bp)
|
||||||
|
|
||||||
dexpreoptBootJars := result.SingletonForTests("dex_bootjars")
|
dexpreoptBootJars := result.SingletonForTests("dex_bootjars")
|
||||||
rule := dexpreoptBootJars.Output(ruleFile)
|
rule := dexpreoptBootJars.Output(ruleFile)
|
||||||
|
@@ -35,7 +35,8 @@ func fixtureSetPrebuiltHiddenApiDirProductVariable(prebuiltHiddenApiDir *string)
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var hiddenApiFixtureFactory = javaFixtureFactory.Extend(PrepareForTestWithHiddenApiBuildComponents)
|
var hiddenApiFixtureFactory = android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest, PrepareForTestWithHiddenApiBuildComponents)
|
||||||
|
|
||||||
func TestHiddenAPISingleton(t *testing.T) {
|
func TestHiddenAPISingleton(t *testing.T) {
|
||||||
result := hiddenApiFixtureFactory.Extend(
|
result := hiddenApiFixtureFactory.Extend(
|
||||||
|
@@ -33,14 +33,6 @@ import (
|
|||||||
"android/soong/python"
|
"android/soong/python"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Legacy factory to use to create fixtures for tests in this package.
|
|
||||||
//
|
|
||||||
// deprecated: See prepareForJavaTest
|
|
||||||
var javaFixtureFactory = android.NewFixtureFactory(
|
|
||||||
nil,
|
|
||||||
prepareForJavaTest,
|
|
||||||
)
|
|
||||||
|
|
||||||
// Legacy preparer used for running tests within the java package.
|
// Legacy preparer used for running tests within the java package.
|
||||||
//
|
//
|
||||||
// This includes everything that was needed to run any test in the java package prior to the
|
// This includes everything that was needed to run any test in the java package prior to the
|
||||||
@@ -75,8 +67,8 @@ func TestMain(m *testing.M) {
|
|||||||
// deprecated
|
// deprecated
|
||||||
func testJavaError(t *testing.T, pattern string, bp string) (*android.TestContext, android.Config) {
|
func testJavaError(t *testing.T, pattern string, bp string) (*android.TestContext, android.Config) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
result := javaFixtureFactory.
|
result := android.GroupFixturePreparers(
|
||||||
Extend(dexpreopt.PrepareForTestWithDexpreopt).
|
prepareForJavaTest, dexpreopt.PrepareForTestWithDexpreopt).
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(pattern)).
|
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(pattern)).
|
||||||
RunTestWithBp(t, bp)
|
RunTestWithBp(t, bp)
|
||||||
return result.TestContext, result.Config
|
return result.TestContext, result.Config
|
||||||
@@ -93,37 +85,38 @@ func testJavaErrorWithConfig(t *testing.T, pattern string, config android.Config
|
|||||||
// the fixture's config will be ignored when RunTestWithConfig replaces it.
|
// the fixture's config will be ignored when RunTestWithConfig replaces it.
|
||||||
pathCtx := android.PathContextForTesting(config)
|
pathCtx := android.PathContextForTesting(config)
|
||||||
dexpreopt.SetTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx))
|
dexpreopt.SetTestGlobalConfig(config, dexpreopt.GlobalConfigForTests(pathCtx))
|
||||||
result := javaFixtureFactory.
|
result := prepareForJavaTest.
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(pattern)).
|
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(pattern)).
|
||||||
RunTestWithConfig(t, config)
|
RunTestWithConfig(t, config)
|
||||||
return result.TestContext, result.Config
|
return result.TestContext, result.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// testJavaWithFS runs tests using the javaFixtureFactory
|
// testJavaWithFS runs tests using the prepareForJavaTest
|
||||||
//
|
//
|
||||||
// See testJava for an explanation as to how to stop using this deprecated method.
|
// See testJava for an explanation as to how to stop using this deprecated method.
|
||||||
//
|
//
|
||||||
// deprecated
|
// deprecated
|
||||||
func testJavaWithFS(t *testing.T, bp string, fs android.MockFS) (*android.TestContext, android.Config) {
|
func testJavaWithFS(t *testing.T, bp string, fs android.MockFS) (*android.TestContext, android.Config) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
result := javaFixtureFactory.Extend(fs.AddToFixture()).RunTestWithBp(t, bp)
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest, fs.AddToFixture()).RunTestWithBp(t, bp)
|
||||||
return result.TestContext, result.Config
|
return result.TestContext, result.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// testJava runs tests using the javaFixtureFactory
|
// testJava runs tests using the prepareForJavaTest
|
||||||
//
|
//
|
||||||
// Do not add any new usages of this, instead use the javaFixtureFactory directly as it makes it
|
// Do not add any new usages of this, instead use the prepareForJavaTest directly as it makes it
|
||||||
// much easier to customize the test behavior.
|
// much easier to customize the test behavior.
|
||||||
//
|
//
|
||||||
// If it is necessary to customize the behavior of an existing test that uses this then please first
|
// If it is necessary to customize the behavior of an existing test that uses this then please first
|
||||||
// convert the test to using javaFixtureFactory first and then in a following change add the
|
// convert the test to using prepareForJavaTest first and then in a following change add the
|
||||||
// appropriate fixture preparers. Keeping the conversion change separate makes it easy to verify
|
// appropriate fixture preparers. Keeping the conversion change separate makes it easy to verify
|
||||||
// that it did not change the test behavior unexpectedly.
|
// that it did not change the test behavior unexpectedly.
|
||||||
//
|
//
|
||||||
// deprecated
|
// deprecated
|
||||||
func testJava(t *testing.T, bp string) (*android.TestContext, android.Config) {
|
func testJava(t *testing.T, bp string) (*android.TestContext, android.Config) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
result := javaFixtureFactory.RunTestWithBp(t, bp)
|
result := prepareForJavaTest.RunTestWithBp(t, bp)
|
||||||
return result.TestContext, result.Config
|
return result.TestContext, result.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +631,7 @@ prebuilt_stubs_sources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibraryImport(t *testing.T) {
|
func TestJavaSdkLibraryImport(t *testing.T) {
|
||||||
result := javaFixtureFactory.RunTestWithBp(t, `
|
result := prepareForJavaTest.RunTestWithBp(t, `
|
||||||
java_library {
|
java_library {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
@@ -692,7 +685,8 @@ func TestJavaSdkLibraryImport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibraryImport_WithSource(t *testing.T) {
|
func TestJavaSdkLibraryImport_WithSource(t *testing.T) {
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("sdklib"),
|
FixtureWithLastReleaseApis("sdklib"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
@@ -734,7 +728,8 @@ func TestJavaSdkLibraryImport_WithSource(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibraryImport_Preferred(t *testing.T) {
|
func TestJavaSdkLibraryImport_Preferred(t *testing.T) {
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("sdklib"),
|
FixtureWithLastReleaseApis("sdklib"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
@@ -841,7 +836,7 @@ func TestJavaSdkLibraryEnforce(t *testing.T) {
|
|||||||
if expectedErrorPattern != "" {
|
if expectedErrorPattern != "" {
|
||||||
errorHandler = android.FixtureExpectsAtLeastOneErrorMatchingPattern(expectedErrorPattern)
|
errorHandler = android.FixtureExpectsAtLeastOneErrorMatchingPattern(expectedErrorPattern)
|
||||||
}
|
}
|
||||||
javaFixtureFactory.ExtendWithErrorHandler(errorHandler).RunTest(t, createPreparer(info))
|
prepareForJavaTest.ExtendWithErrorHandler(errorHandler).RunTest(t, createPreparer(info))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1319,8 +1314,8 @@ func TestGeneratedSources(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTurbine(t *testing.T) {
|
func TestTurbine(t *testing.T) {
|
||||||
result := javaFixtureFactory.
|
result := android.GroupFixturePreparers(
|
||||||
Extend(FixtureWithPrebuiltApis(map[string][]string{"14": {"foo"}})).
|
prepareForJavaTest, FixtureWithPrebuiltApis(map[string][]string{"14": {"foo"}})).
|
||||||
RunTestWithBp(t, `
|
RunTestWithBp(t, `
|
||||||
java_library {
|
java_library {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
@@ -1731,7 +1726,8 @@ func TestJavaImport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary(t *testing.T) {
|
func TestJavaSdkLibrary(t *testing.T) {
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithPrebuiltApis(map[string][]string{
|
FixtureWithPrebuiltApis(map[string][]string{
|
||||||
"28": {"foo"},
|
"28": {"foo"},
|
||||||
@@ -1856,7 +1852,8 @@ func TestJavaSdkLibrary(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_StubOrImplOnlyLibs(t *testing.T) {
|
func TestJavaSdkLibrary_StubOrImplOnlyLibs(t *testing.T) {
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("sdklib"),
|
FixtureWithLastReleaseApis("sdklib"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
@@ -1892,7 +1889,8 @@ func TestJavaSdkLibrary_StubOrImplOnlyLibs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_DoNotAccessImplWhenItIsNotBuilt(t *testing.T) {
|
func TestJavaSdkLibrary_DoNotAccessImplWhenItIsNotBuilt(t *testing.T) {
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("foo"),
|
FixtureWithLastReleaseApis("foo"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
@@ -1920,7 +1918,8 @@ func TestJavaSdkLibrary_DoNotAccessImplWhenItIsNotBuilt(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_UseSourcesFromAnotherSdkLibrary(t *testing.T) {
|
func TestJavaSdkLibrary_UseSourcesFromAnotherSdkLibrary(t *testing.T) {
|
||||||
javaFixtureFactory.Extend(
|
android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("foo"),
|
FixtureWithLastReleaseApis("foo"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
@@ -1941,11 +1940,11 @@ func TestJavaSdkLibrary_UseSourcesFromAnotherSdkLibrary(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_AccessOutputFiles_MissingScope(t *testing.T) {
|
func TestJavaSdkLibrary_AccessOutputFiles_MissingScope(t *testing.T) {
|
||||||
javaFixtureFactory.
|
android.GroupFixturePreparers(
|
||||||
Extend(
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("foo"),
|
FixtureWithLastReleaseApis("foo"),
|
||||||
).
|
).
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`"foo" does not provide api scope system`)).
|
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`"foo" does not provide api scope system`)).
|
||||||
RunTestWithBp(t, `
|
RunTestWithBp(t, `
|
||||||
java_sdk_library {
|
java_sdk_library {
|
||||||
@@ -1965,7 +1964,8 @@ func TestJavaSdkLibrary_AccessOutputFiles_MissingScope(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_Deps(t *testing.T) {
|
func TestJavaSdkLibrary_Deps(t *testing.T) {
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("sdklib"),
|
FixtureWithLastReleaseApis("sdklib"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
@@ -1990,7 +1990,7 @@ func TestJavaSdkLibrary_Deps(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibraryImport_AccessOutputFiles(t *testing.T) {
|
func TestJavaSdkLibraryImport_AccessOutputFiles(t *testing.T) {
|
||||||
javaFixtureFactory.RunTestWithBp(t, `
|
prepareForJavaTest.RunTestWithBp(t, `
|
||||||
java_sdk_library_import {
|
java_sdk_library_import {
|
||||||
name: "foo",
|
name: "foo",
|
||||||
public: {
|
public: {
|
||||||
@@ -2023,7 +2023,7 @@ func TestJavaSdkLibraryImport_AccessOutputFiles_Invalid(t *testing.T) {
|
|||||||
`
|
`
|
||||||
|
|
||||||
t.Run("stubs.source", func(t *testing.T) {
|
t.Run("stubs.source", func(t *testing.T) {
|
||||||
javaFixtureFactory.
|
prepareForJavaTest.
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`stubs.source not available for api scope public`)).
|
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`stubs.source not available for api scope public`)).
|
||||||
RunTestWithBp(t, bp+`
|
RunTestWithBp(t, bp+`
|
||||||
java_library {
|
java_library {
|
||||||
@@ -2038,7 +2038,7 @@ func TestJavaSdkLibraryImport_AccessOutputFiles_Invalid(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("api.txt", func(t *testing.T) {
|
t.Run("api.txt", func(t *testing.T) {
|
||||||
javaFixtureFactory.
|
prepareForJavaTest.
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`api.txt not available for api scope public`)).
|
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`api.txt not available for api scope public`)).
|
||||||
RunTestWithBp(t, bp+`
|
RunTestWithBp(t, bp+`
|
||||||
java_library {
|
java_library {
|
||||||
@@ -2052,7 +2052,7 @@ func TestJavaSdkLibraryImport_AccessOutputFiles_Invalid(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("removed-api.txt", func(t *testing.T) {
|
t.Run("removed-api.txt", func(t *testing.T) {
|
||||||
javaFixtureFactory.
|
prepareForJavaTest.
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`removed-api.txt not available for api scope public`)).
|
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`removed-api.txt not available for api scope public`)).
|
||||||
RunTestWithBp(t, bp+`
|
RunTestWithBp(t, bp+`
|
||||||
java_library {
|
java_library {
|
||||||
@@ -2067,7 +2067,7 @@ func TestJavaSdkLibraryImport_AccessOutputFiles_Invalid(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_InvalidScopes(t *testing.T) {
|
func TestJavaSdkLibrary_InvalidScopes(t *testing.T) {
|
||||||
javaFixtureFactory.
|
prepareForJavaTest.
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "foo": enabled api scope "system" depends on disabled scope "public"`)).
|
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "foo": enabled api scope "system" depends on disabled scope "public"`)).
|
||||||
RunTestWithBp(t, `
|
RunTestWithBp(t, `
|
||||||
java_sdk_library {
|
java_sdk_library {
|
||||||
@@ -2087,7 +2087,8 @@ func TestJavaSdkLibrary_InvalidScopes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
|
func TestJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
|
||||||
javaFixtureFactory.Extend(
|
android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("foo"),
|
FixtureWithLastReleaseApis("foo"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
@@ -2104,7 +2105,8 @@ func TestJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_ModuleLib(t *testing.T) {
|
func TestJavaSdkLibrary_ModuleLib(t *testing.T) {
|
||||||
javaFixtureFactory.Extend(
|
android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("foo"),
|
FixtureWithLastReleaseApis("foo"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
@@ -2123,7 +2125,8 @@ func TestJavaSdkLibrary_ModuleLib(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_SystemServer(t *testing.T) {
|
func TestJavaSdkLibrary_SystemServer(t *testing.T) {
|
||||||
javaFixtureFactory.Extend(
|
android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("foo"),
|
FixtureWithLastReleaseApis("foo"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
@@ -2142,7 +2145,7 @@ func TestJavaSdkLibrary_SystemServer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_MissingScope(t *testing.T) {
|
func TestJavaSdkLibrary_MissingScope(t *testing.T) {
|
||||||
javaFixtureFactory.
|
prepareForJavaTest.
|
||||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`requires api scope module-lib from foo but it only has \[\] available`)).
|
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`requires api scope module-lib from foo but it only has \[\] available`)).
|
||||||
RunTestWithBp(t, `
|
RunTestWithBp(t, `
|
||||||
java_sdk_library {
|
java_sdk_library {
|
||||||
@@ -2163,7 +2166,8 @@ func TestJavaSdkLibrary_MissingScope(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_FallbackScope(t *testing.T) {
|
func TestJavaSdkLibrary_FallbackScope(t *testing.T) {
|
||||||
javaFixtureFactory.Extend(
|
android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("foo"),
|
FixtureWithLastReleaseApis("foo"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
@@ -2186,7 +2190,8 @@ func TestJavaSdkLibrary_FallbackScope(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSdkLibrary_DefaultToStubs(t *testing.T) {
|
func TestJavaSdkLibrary_DefaultToStubs(t *testing.T) {
|
||||||
result := javaFixtureFactory.Extend(
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
PrepareForTestWithJavaSdkLibraryFiles,
|
PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
FixtureWithLastReleaseApis("foo"),
|
FixtureWithLastReleaseApis("foo"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
|
@@ -349,7 +349,8 @@ func TestClasspath(t *testing.T) {
|
|||||||
android.AssertPathsRelativeToTopEquals(t, "implicits", deps, javac.Implicits)
|
android.AssertPathsRelativeToTopEquals(t, "implicits", deps, javac.Implicits)
|
||||||
}
|
}
|
||||||
|
|
||||||
fixtureFactory := javaFixtureFactory.Extend(
|
fixtureFactory := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
FixtureWithPrebuiltApis(map[string][]string{
|
FixtureWithPrebuiltApis(map[string][]string{
|
||||||
"29": {},
|
"29": {},
|
||||||
"30": {},
|
"30": {},
|
||||||
|
@@ -50,7 +50,7 @@ var addSourceSystemModules = android.FixtureAddTextFile("source/Android.bp", `
|
|||||||
`)
|
`)
|
||||||
|
|
||||||
func TestJavaSystemModules(t *testing.T) {
|
func TestJavaSystemModules(t *testing.T) {
|
||||||
result := javaFixtureFactory.RunTest(t, addSourceSystemModules)
|
result := prepareForJavaTest.RunTest(t, addSourceSystemModules)
|
||||||
|
|
||||||
// check the existence of the source module
|
// check the existence of the source module
|
||||||
sourceSystemModules := result.ModuleForTests("system-modules", "android_common")
|
sourceSystemModules := result.ModuleForTests("system-modules", "android_common")
|
||||||
@@ -77,7 +77,7 @@ var addPrebuiltSystemModules = android.FixtureAddTextFile("prebuilts/Android.bp"
|
|||||||
`)
|
`)
|
||||||
|
|
||||||
func TestJavaSystemModulesImport(t *testing.T) {
|
func TestJavaSystemModulesImport(t *testing.T) {
|
||||||
result := javaFixtureFactory.RunTest(t, addPrebuiltSystemModules)
|
result := prepareForJavaTest.RunTest(t, addPrebuiltSystemModules)
|
||||||
|
|
||||||
// check the existence of the renamed prebuilt module
|
// check the existence of the renamed prebuilt module
|
||||||
prebuiltSystemModules := result.ModuleForTests("system-modules", "android_common")
|
prebuiltSystemModules := result.ModuleForTests("system-modules", "android_common")
|
||||||
@@ -89,7 +89,7 @@ func TestJavaSystemModulesImport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestJavaSystemModulesMixSourceAndPrebuilt(t *testing.T) {
|
func TestJavaSystemModulesMixSourceAndPrebuilt(t *testing.T) {
|
||||||
result := javaFixtureFactory.RunTest(t,
|
result := prepareForJavaTest.RunTest(t,
|
||||||
addSourceSystemModules,
|
addSourceSystemModules,
|
||||||
addPrebuiltSystemModules,
|
addPrebuiltSystemModules,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user