Merge "Make apex/boot_image_test.go more realistic"
This commit is contained in:
@@ -160,24 +160,29 @@ func checkBootImage(t *testing.T, result *android.TestResult, moduleName string,
|
|||||||
android.AssertTrimmedStringEquals(t, "invalid paths for "+moduleName, expectedBootImageFiles, strings.Join(allPaths, "\n"))
|
android.AssertTrimmedStringEquals(t, "invalid paths for "+moduleName, expectedBootImageFiles, strings.Join(allPaths, "\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBootImageInApex(t *testing.T) {
|
func TestBootImageInArtApex(t *testing.T) {
|
||||||
result := android.GroupFixturePreparers(
|
result := android.GroupFixturePreparers(
|
||||||
prepareForTestWithBootImage,
|
prepareForTestWithBootImage,
|
||||||
prepareForTestWithMyapex,
|
prepareForTestWithArtApex,
|
||||||
// Configure some libraries in the framework boot image.
|
|
||||||
dexpreopt.FixtureSetBootJars("platform:foo", "platform:bar"),
|
// Configure some libraries in the art boot image.
|
||||||
|
dexpreopt.FixtureSetArtBootJars("com.android.art:foo", "com.android.art:bar"),
|
||||||
).RunTestWithBp(t, `
|
).RunTestWithBp(t, `
|
||||||
apex {
|
apex {
|
||||||
name: "myapex",
|
name: "com.android.art",
|
||||||
key: "myapex.key",
|
key: "com.android.art.key",
|
||||||
boot_images: [
|
boot_images: [
|
||||||
"mybootimage",
|
"mybootimage",
|
||||||
],
|
],
|
||||||
|
java_libs: [
|
||||||
|
"foo",
|
||||||
|
"bar",
|
||||||
|
],
|
||||||
updatable: false,
|
updatable: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
apex_key {
|
apex_key {
|
||||||
name: "myapex.key",
|
name: "com.android.art.key",
|
||||||
public_key: "testkey.avbpubkey",
|
public_key: "testkey.avbpubkey",
|
||||||
private_key: "testkey.pem",
|
private_key: "testkey.pem",
|
||||||
}
|
}
|
||||||
@@ -186,52 +191,123 @@ func TestBootImageInApex(t *testing.T) {
|
|||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["b.java"],
|
srcs: ["b.java"],
|
||||||
installable: true,
|
installable: true,
|
||||||
|
apex_available: [
|
||||||
|
"com.android.art",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
name: "bar",
|
name: "bar",
|
||||||
srcs: ["b.java"],
|
srcs: ["b.java"],
|
||||||
installable: true,
|
installable: true,
|
||||||
|
apex_available: [
|
||||||
|
"com.android.art",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
boot_image {
|
boot_image {
|
||||||
name: "mybootimage",
|
name: "mybootimage",
|
||||||
image_name: "boot",
|
image_name: "art",
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"com.android.art",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that a preferred prebuilt doesn't affect the apex.
|
// Make sure that a preferred prebuilt doesn't affect the apex.
|
||||||
prebuilt_boot_image {
|
prebuilt_boot_image {
|
||||||
name: "mybootimage",
|
name: "mybootimage",
|
||||||
image_name: "boot",
|
image_name: "art",
|
||||||
prefer: true,
|
prefer: true,
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"com.android.art",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex_image", []string{
|
ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
|
||||||
|
"javalib/arm/boot.art",
|
||||||
|
"javalib/arm/boot.oat",
|
||||||
|
"javalib/arm/boot.vdex",
|
||||||
"javalib/arm/boot-bar.art",
|
"javalib/arm/boot-bar.art",
|
||||||
"javalib/arm/boot-bar.oat",
|
"javalib/arm/boot-bar.oat",
|
||||||
"javalib/arm/boot-bar.vdex",
|
"javalib/arm/boot-bar.vdex",
|
||||||
"javalib/arm/boot-foo.art",
|
"javalib/arm64/boot.art",
|
||||||
"javalib/arm/boot-foo.oat",
|
"javalib/arm64/boot.oat",
|
||||||
"javalib/arm/boot-foo.vdex",
|
"javalib/arm64/boot.vdex",
|
||||||
"javalib/arm64/boot-bar.art",
|
"javalib/arm64/boot-bar.art",
|
||||||
"javalib/arm64/boot-bar.oat",
|
"javalib/arm64/boot-bar.oat",
|
||||||
"javalib/arm64/boot-bar.vdex",
|
"javalib/arm64/boot-bar.vdex",
|
||||||
"javalib/arm64/boot-foo.art",
|
"javalib/bar.jar",
|
||||||
"javalib/arm64/boot-foo.oat",
|
"javalib/foo.jar",
|
||||||
"javalib/arm64/boot-foo.vdex",
|
|
||||||
})
|
})
|
||||||
|
|
||||||
java.CheckModuleDependencies(t, result.TestContext, "myapex", "android_common_myapex_image", []string{
|
java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
|
||||||
`myapex.key`,
|
`bar`,
|
||||||
|
`com.android.art.key`,
|
||||||
|
`foo`,
|
||||||
`mybootimage`,
|
`mybootimage`,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBootImageInPrebuiltArtApex(t *testing.T) {
|
||||||
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForTestWithBootImage,
|
||||||
|
prepareForTestWithArtApex,
|
||||||
|
|
||||||
|
android.FixtureMergeMockFs(android.MockFS{
|
||||||
|
"com.android.art-arm64.apex": nil,
|
||||||
|
"com.android.art-arm.apex": nil,
|
||||||
|
}),
|
||||||
|
|
||||||
|
// Configure some libraries in the art boot image.
|
||||||
|
dexpreopt.FixtureSetArtBootJars("com.android.art:foo", "com.android.art:bar"),
|
||||||
|
).RunTestWithBp(t, `
|
||||||
|
prebuilt_apex {
|
||||||
|
name: "com.android.art",
|
||||||
|
arch: {
|
||||||
|
arm64: {
|
||||||
|
src: "com.android.art-arm64.apex",
|
||||||
|
},
|
||||||
|
arm: {
|
||||||
|
src: "com.android.art-arm.apex",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exported_java_libs: ["foo", "bar"],
|
||||||
|
}
|
||||||
|
|
||||||
|
java_import {
|
||||||
|
name: "foo",
|
||||||
|
jars: ["foo.jar"],
|
||||||
|
apex_available: [
|
||||||
|
"com.android.art",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
java_import {
|
||||||
|
name: "bar",
|
||||||
|
jars: ["bar.jar"],
|
||||||
|
apex_available: [
|
||||||
|
"com.android.art",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_boot_image {
|
||||||
|
name: "mybootimage",
|
||||||
|
image_name: "art",
|
||||||
|
apex_available: [
|
||||||
|
"com.android.art",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
java.CheckModuleDependencies(t, result.TestContext, "com.android.art", "android_common", []string{
|
||||||
|
`prebuilt_bar`,
|
||||||
|
`prebuilt_foo`,
|
||||||
|
})
|
||||||
|
|
||||||
|
java.CheckModuleDependencies(t, result.TestContext, "mybootimage", "android_common", []string{
|
||||||
|
`dex2oatd`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(b/177892522) - add test for host apex.
|
// TODO(b/177892522) - add test for host apex.
|
||||||
|
Reference in New Issue
Block a user