From 837486d30832a9ba999d7952c171acbb7f933918 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Tue, 23 Mar 2021 23:13:53 +0000 Subject: [PATCH] Convert java/boot_image_test.go to test fixtures Bug: 177892522 Test: m nothing Change-Id: I91d2bd2eabe5916fd158501bd0d4fdb608919019 --- java/boot_image_test.go | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/java/boot_image_test.go b/java/boot_image_test.go index 65e590d86..f3d603dd0 100644 --- a/java/boot_image_test.go +++ b/java/boot_image_test.go @@ -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", + } + `) }