Merge "Convert java_sdk_test.go tests to fixtures" am: c8ad86479f

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1645684

Change-Id: I3b1c5b71e986059eda6a1a194f4f4ef15bdac918
This commit is contained in:
Paul Duffin 2021-03-24 18:53:55 +00:00 committed by Automerger Merge Worker
commit defe86ba99
1 changed files with 43 additions and 21 deletions

View File

@ -26,6 +26,13 @@ var prepareForSdkTestWithJava = android.GroupFixturePreparers(
PrepareForTestWithSdkBuildComponents,
)
var prepareForSdkTestWithJavaSdkLibrary = android.GroupFixturePreparers(
prepareForSdkTestWithJava,
java.PrepareForTestWithJavaDefaultModules,
java.PrepareForTestWithJavaSdkLibraryFiles,
java.FixtureWithLastReleaseApis("myjavalib"),
)
func testSdkWithJava(t *testing.T, bp string) *android.TestResult {
t.Helper()
@ -110,7 +117,7 @@ prebuilt_apis {
// Contains tests for SDK members provided by the java package.
func TestSdkDependsOnSourceEvenWhenPrebuiltPreferred(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_header_libs: ["sdkmember"],
@ -161,7 +168,10 @@ sdk_snapshot {
}
func TestBasicSdkWithJavaLibrary(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(
prepareForSdkTestWithJava,
prepareForSdkTestWithApex,
).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_header_libs: ["sdkmember"],
@ -242,7 +252,10 @@ func TestBasicSdkWithJavaLibrary(t *testing.T) {
}
func TestSnapshotWithJavaHeaderLibrary(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(
prepareForSdkTestWithJava,
android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil),
).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_header_libs: ["myjavalib"],
@ -296,7 +309,10 @@ aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
}
func TestHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(
prepareForSdkTestWithJava,
android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil),
).RunTestWithBp(t, `
sdk {
name: "mysdk",
device_supported: false,
@ -358,7 +374,7 @@ aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
}
func TestDeviceAndHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
sdk {
name: "mysdk",
host_supported: true,
@ -426,7 +442,10 @@ sdk_snapshot {
}
func TestSnapshotWithJavaImplLibrary(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(
prepareForSdkTestWithJava,
android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil),
).RunTestWithBp(t, `
module_exports {
name: "myexports",
java_libs: ["myjavalib"],
@ -481,7 +500,7 @@ aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
}
func TestSnapshotWithJavaBootLibrary(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
module_exports {
name: "myexports",
java_boot_libs: ["myjavalib"],
@ -535,7 +554,10 @@ module_exports_snapshot {
}
func TestHostSnapshotWithJavaImplLibrary(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(
prepareForSdkTestWithJava,
android.FixtureAddFile("aidl/foo/bar/Test.aidl", nil),
).RunTestWithBp(t, `
module_exports {
name: "myexports",
device_supported: false,
@ -597,7 +619,7 @@ aidl/foo/bar/Test.aidl -> aidl/aidl/foo/bar/Test.aidl
}
func TestSnapshotWithJavaTest(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
module_exports {
name: "myexports",
java_tests: ["myjavatests"],
@ -649,7 +671,7 @@ module_exports_snapshot {
}
func TestHostSnapshotWithJavaTest(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
module_exports {
name: "myexports",
device_supported: false,
@ -710,7 +732,7 @@ module_exports_snapshot {
}
func TestSnapshotWithJavaSystemModules(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_header_libs: ["exported-system-module"],
@ -808,7 +830,7 @@ sdk_snapshot {
}
func TestHostSnapshotWithJavaSystemModules(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
sdk {
name: "mysdk",
device_supported: false,
@ -888,7 +910,7 @@ sdk_snapshot {
}
func TestDeviceAndHostSnapshotWithOsSpecificMembers(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJava).RunTestWithBp(t, `
module_exports {
name: "myexports",
host_supported: true,
@ -1021,7 +1043,7 @@ module_exports_snapshot {
}
func TestSnapshotWithJavaSdkLibrary(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_sdk_libs: ["myjavalib"],
@ -1125,7 +1147,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_SdkVersion_None(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_sdk_libs: ["myjavalib"],
@ -1191,7 +1213,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_sdk_libs: ["myjavalib"],
@ -1260,7 +1282,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_ApiScopes(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_sdk_libs: ["myjavalib"],
@ -1350,7 +1372,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_ModuleLib(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_sdk_libs: ["myjavalib"],
@ -1461,7 +1483,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_SystemServer(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_sdk_libs: ["myjavalib"],
@ -1551,7 +1573,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_sdk_libs: ["myjavalib"],
@ -1623,7 +1645,7 @@ sdk_snapshot {
}
func TestSnapshotWithJavaSdkLibrary_DoctagFiles(t *testing.T) {
result := testSdkWithJava(t, `
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
sdk {
name: "mysdk",
java_sdk_libs: ["myjavalib"],