Merge "Convert java/boot_image_test.go to test fixtures" am: 60fbea0ec6

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

Change-Id: I08edc1e00ab3f34ac503a80a98ec684d4597ddb5
This commit is contained in:
Paul Duffin
2021-03-29 12:58:37 +00:00
committed by Automerger Merge Worker

View File

@@ -16,25 +16,39 @@ package java
import (
"testing"
"android/soong/android"
"android/soong/dexpreopt"
)
// Contains some simple tests for boot_image logic, additional tests can be found in
// apex/boot_image_test.go as the ART boot image requires modules from the ART apex.
var prepareForTestWithBootImage = android.GroupFixturePreparers(
PrepareForTestWithJavaDefaultModules,
dexpreopt.PrepareForTestByEnablingDexpreopt,
)
func TestUnknownBootImage(t *testing.T) {
testJavaError(t, "image_name: Unknown image name \\\"unknown\\\", expected one of art, boot", `
boot_image {
name: "unknown-boot-image",
image_name: "unknown",
}
`)
prepareForTestWithBootImage.
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
`\Qimage_name: Unknown image name "unknown", expected one of art, boot\E`)).
RunTestWithBp(t, `
boot_image {
name: "unknown-boot-image",
image_name: "unknown",
}
`)
}
func TestUnknownPrebuiltBootImage(t *testing.T) {
testJavaError(t, "image_name: Unknown image name \\\"unknown\\\", expected one of art, boot", `
prebuilt_boot_image {
name: "unknown-boot-image",
image_name: "unknown",
}
`)
prepareForTestWithBootImage.
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
`\Qimage_name: Unknown image name "unknown", expected one of art, boot\E`)).
RunTestWithBp(t, `
prebuilt_boot_image {
name: "unknown-boot-image",
image_name: "unknown",
}
`)
}