Tighten bootclasspath_fragment property validation
Previously, due to legacy reasons, the property validation did not require a contents property and allowed the image_name to be either "art" or "boot". Those reasons no longer apply and so this change requires a contents property and only allows the image_name to be set to "art" if specified. Bug: 177892522 Test: m nothing Change-Id: I8855d6e5365ef0b55490e90e7b6c0081cf070ee5
This commit is contained in:
@@ -29,38 +29,28 @@ var prepareForTestWithBootclasspathFragment = android.GroupFixturePreparers(
|
||||
dexpreopt.PrepareForTestByEnablingDexpreopt,
|
||||
)
|
||||
|
||||
func TestUnknownBootclasspathFragment(t *testing.T) {
|
||||
func TestBootclasspathFragment_UnknownImageName(t *testing.T) {
|
||||
prepareForTestWithBootclasspathFragment.
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||
`\Qimage_name: Unknown image name "unknown", expected one of art, boot\E`)).
|
||||
`\Qimage_name: unknown image name "unknown", expected "art"\E`)).
|
||||
RunTestWithBp(t, `
|
||||
bootclasspath_fragment {
|
||||
name: "unknown-bootclasspath-fragment",
|
||||
image_name: "unknown",
|
||||
contents: ["foo"],
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestUnknownBootclasspathFragmentImageName(t *testing.T) {
|
||||
func TestPrebuiltBootclasspathFragment_UnknownImageName(t *testing.T) {
|
||||
prepareForTestWithBootclasspathFragment.
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||
`\Qimage_name: Unknown image name "unknown", expected one of art, boot\E`)).
|
||||
RunTestWithBp(t, `
|
||||
bootclasspath_fragment {
|
||||
name: "unknown-bootclasspath-fragment",
|
||||
image_name: "unknown",
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestUnknownPrebuiltBootclasspathFragment(t *testing.T) {
|
||||
prepareForTestWithBootclasspathFragment.
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||
`\Qimage_name: Unknown image name "unknown", expected one of art, boot\E`)).
|
||||
`\Qimage_name: unknown image name "unknown", expected "art"\E`)).
|
||||
RunTestWithBp(t, `
|
||||
prebuilt_bootclasspath_fragment {
|
||||
name: "unknown-bootclasspath-fragment",
|
||||
image_name: "unknown",
|
||||
contents: ["foo"],
|
||||
}
|
||||
`)
|
||||
}
|
||||
@@ -76,6 +66,7 @@ func TestBootclasspathFragmentInconsistentArtConfiguration_Platform(t *testing.T
|
||||
bootclasspath_fragment {
|
||||
name: "bootclasspath-fragment",
|
||||
image_name: "art",
|
||||
contents: ["foo", "bar"],
|
||||
apex_available: [
|
||||
"apex",
|
||||
],
|
||||
@@ -94,6 +85,7 @@ func TestBootclasspathFragmentInconsistentArtConfiguration_ApexMixture(t *testin
|
||||
bootclasspath_fragment {
|
||||
name: "bootclasspath-fragment",
|
||||
image_name: "art",
|
||||
contents: ["foo", "bar"],
|
||||
apex_available: [
|
||||
"apex1",
|
||||
"apex2",
|
||||
@@ -102,17 +94,6 @@ func TestBootclasspathFragmentInconsistentArtConfiguration_ApexMixture(t *testin
|
||||
`)
|
||||
}
|
||||
|
||||
func TestBootclasspathFragmentWithoutImageNameOrContents(t *testing.T) {
|
||||
prepareForTestWithBootclasspathFragment.
|
||||
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||
`\Qneither of the "image_name" and "contents" properties\E`)).
|
||||
RunTestWithBp(t, `
|
||||
bootclasspath_fragment {
|
||||
name: "bootclasspath-fragment",
|
||||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func TestBootclasspathFragment_Coverage(t *testing.T) {
|
||||
prepareForTestWithFrameworkCoverage := android.FixtureMergeEnv(map[string]string{
|
||||
"EMMA_INSTRUMENT": "true",
|
||||
|
Reference in New Issue
Block a user