summaryrefslogtreecommitdiff
path: root/apex/bootclasspath_fragment_test.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2024-06-05 19:27:18 +0000
committer Spandan Das <spandandas@google.com> 2024-06-05 21:32:23 +0000
commit7fd531f5d1a92a473ebd6bf3c06d4351c743d569 (patch)
tree631676e85047af7270162db2981c64249466de6e /apex/bootclasspath_fragment_test.go
parent6c9fa022046e198ce5c2be963383b93f8a0cf3a2 (diff)
Identify profile providing apexes using ApexInfo
`com.android.art` and its overrides include a `etc/boot-image.prof` which is used on device for profile guided dexopt. ``` $ deapexer list <path_in_product_out>/com.android.art.apex | grep boot-image $ deapexer list <path_in_product_out>/com.google.android.art.apex | grep boot-image ``` To identify that we should include a boot-image.prof in the override apexes, we currently look at ApexInfo.InApexVariants in the context of art's bootclasspath fragment module. InApexVariants are colated based on the min_sdk_version of the top-level apex. At ToT, we have a single variant of `art-bootlcasspath-fragment` for aosp art apex, google art apex and google go art apex. When google go art apex overrides the min_sdk_version, ApexInfo is cleaved, and two distinct variants of art-bootclasspath-fragment are created. The one corresponding to go art apex does not know we should include boot-image.prof To fix this, use AllApexInfoProvider instead. If any of the apexInfos corresponds to com.android.art, include etc/boot-image.prof Test: Added a unit test Test: With https://b.corp.google.com/issues/345173231#comment2 reverted, m com.google.android.go.art && deapexer list <apex> # verified that boot-image.prof exists Bug: 345173231 Bug: 295311875 Change-Id: I5a0e8f74725388f05343c64f268260b1eb139ae5
Diffstat (limited to 'apex/bootclasspath_fragment_test.go')
-rw-r--r--apex/bootclasspath_fragment_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index 778c20a56..af9123e70 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -197,6 +197,12 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
updatable: false,
}
+ override_apex {
+ name: "com.mycompany.android.art",
+ base: "com.android.art",
+ min_sdk_version: "33", // mycompany overrides the min_sdk_version
+ }
+
apex_key {
name: "com.android.art.key",
public_key: "testkey.avbpubkey",
@@ -325,6 +331,26 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
})
+ t.Run("boot image files from source of override apex", 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"),
+ dexpreopt.FixtureSetTestOnlyArtBootImageJars("com.android.art:foo", "com.android.art:bar"),
+ addSource("foo", "bar"),
+ java.FixtureSetBootImageInstallDirOnDevice("art", "apex/com.android.art/javalib"),
+ ).RunTest(t)
+
+ ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.mycompany.android.art_com.mycompany.android.art", []string{
+ "etc/boot-image.prof",
+ "etc/classpaths/bootclasspath.pb",
+ "javalib/bar.jar",
+ "javalib/foo.jar",
+ })
+ })
+
t.Run("generate boot image profile even if dexpreopt is disabled", func(t *testing.T) {
result := android.GroupFixturePreparers(
commonPreparer,