diff options
author | 2021-05-21 19:28:09 +0100 | |
---|---|---|
committer | 2021-05-24 16:22:47 +0100 | |
commit | 8018e50ddb141dea7891918c4178a7a394a788d8 (patch) | |
tree | 556c2be2de45c61641bf6ef6c452e63593c3aa84 /java/bootclasspath_fragment_test.go | |
parent | 58e0e769c9b1f4dbad95acfd1792dd91e716e456 (diff) |
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
Diffstat (limited to 'java/bootclasspath_fragment_test.go')
-rw-r--r-- | java/bootclasspath_fragment_test.go | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go index 581625d8c..fba7d1a71 100644 --- a/java/bootclasspath_fragment_test.go +++ b/java/bootclasspath_fragment_test.go @@ -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", |