Merge "Test that DisableGenerateProfile takes effects for APEXes." am: 5f496eed0a am: 9fdc009e7a

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

Change-Id: I59cf2e58b9d77addf13c744a10a37705f01bda95
This commit is contained in:
Jiakai Zhang
2021-12-16 18:38:58 +00:00
committed by Automerger Merge Worker
2 changed files with 26 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ package apex
import ( import (
"fmt" "fmt"
"path"
"sort" "sort"
"strings" "strings"
"testing" "testing"
@@ -442,6 +443,24 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo") checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
}) })
t.Run("boot image disable generate profile", func(t *testing.T) {
result := android.GroupFixturePreparers(
commonPreparer,
// Configure some libraries in the art bootclasspath_fragment that match the source
// bootclasspath_fragment's contents property.
java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"),
addSource("foo", "bar"),
dexpreopt.FixtureDisableGenerateProfile(true),
).RunTest(t)
files := getFiles(t, result.TestContext, "com.android.art", "android_common_com.android.art_image")
for _, file := range files {
matched, _ := path.Match("etc/boot-image.prof", file.path)
android.AssertBoolEquals(t, "\"etc/boot-image.prof\" should not be in the APEX", matched, false)
}
})
t.Run("boot image files with preferred prebuilt", func(t *testing.T) { t.Run("boot image files with preferred prebuilt", func(t *testing.T) {
result := android.GroupFixturePreparers( result := android.GroupFixturePreparers(
commonPreparer, commonPreparer,

View File

@@ -167,3 +167,10 @@ func FixtureSetBootImageProfiles(profiles ...string) android.FixturePreparer {
dexpreoptConfig.BootImageProfiles = android.PathsForSource(ctx, profiles) dexpreoptConfig.BootImageProfiles = android.PathsForSource(ctx, profiles)
}) })
} }
// FixtureDisableGenerateProfile sets the DisableGenerateProfile property in the global config.
func FixtureDisableGenerateProfile(disable bool) android.FixturePreparer {
return FixtureModifyGlobalConfig(func(_ android.PathContext, dexpreoptConfig *GlobalConfig) {
dexpreoptConfig.DisableGenerateProfile = disable
})
}