aboutsummaryrefslogtreecommitdiff
path: root/apex/systemserver_classpath_fragment_test.go
diff options
context:
space:
mode:
authorSpandan Das <spandandas@google.com>2024-01-25 22:12:50 +0000
committerSpandan Das <spandandas@google.com>2024-01-30 18:04:52 +0000
commit2ea84dd0dc034d982e867e7dec97b713b68ce3bf (patch)
tree73062cdf6401eef787b7bbd2158213406179a636 /apex/systemserver_classpath_fragment_test.go
parente21a8d4dc6ef36c7de97254e40acfd389e887a2d (diff)
Propagate profile_guided requirement of imports to top-level apex
For prebuilts, the dexpreopt rules of system server jars are now generated from the context of the top-level prebuilt apex and not in the context of the shim java_import modules. Since `dex_preopt.profile_guided` property is defined in java_import, this needs to be bubbled up to the top-level apex. This will be done using deapxerInfo. If profile_guided of a transitive java_import is true, the deapexed .prof file will be set as dexreopter.inputProfilePathOnHost before invoking dexpreopter.dexpreopt. This ensures that only that java_import undergoes profile guided dexpreopt, and not every other transitive java_import Test: go test ./apex -run TestPrebuiltStandaloneSystemserverclasspathFragmentContents Test: lunch cf_x86_64_only_phone-next-userdebug && m $ANDROID_PRODUCT_OUT/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex Test: du -sh $ANDROID_PRODUCT_OUT/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex 24K Bug: 308790457 Change-Id: Ibf46ecb400b3f126b243fc8d27b08d9a1aa4cc97
Diffstat (limited to 'apex/systemserver_classpath_fragment_test.go')
-rw-r--r--apex/systemserver_classpath_fragment_test.go20
1 files changed, 12 insertions, 8 deletions
diff --git a/apex/systemserver_classpath_fragment_test.go b/apex/systemserver_classpath_fragment_test.go
index 6b2c39777..f6c53b270 100644
--- a/apex/systemserver_classpath_fragment_test.go
+++ b/apex/systemserver_classpath_fragment_test.go
@@ -221,8 +221,6 @@ func TestSystemServerClasspathFragmentWithContentNotInMake(t *testing.T) {
}
func TestPrebuiltSystemserverclasspathFragmentContents(t *testing.T) {
- // TODO(spandandas): Fix the rules for profile guided dexpreopt of deapexed prebuilt jars
- t.Skip()
result := android.GroupFixturePreparers(
prepareForTestWithSystemserverclasspathFragment,
prepareForTestWithMyapex,
@@ -294,8 +292,8 @@ func TestPrebuiltSystemserverclasspathFragmentContents(t *testing.T) {
"javalib/bar.jar.prof",
})
- assertProfileGuided(t, ctx, "foo", "android_common_myapex", false)
- assertProfileGuided(t, ctx, "bar", "android_common_myapex", true)
+ assertProfileGuidedPrebuilt(t, ctx, "myapex", "foo", false)
+ assertProfileGuidedPrebuilt(t, ctx, "myapex", "bar", true)
}
func TestSystemserverclasspathFragmentStandaloneContents(t *testing.T) {
@@ -381,8 +379,6 @@ func TestSystemserverclasspathFragmentStandaloneContents(t *testing.T) {
}
func TestPrebuiltStandaloneSystemserverclasspathFragmentContents(t *testing.T) {
- // TODO(spandandas): Fix the rules for profile guided dexpreopt of deapexed prebuilt jars
- t.Skip()
result := android.GroupFixturePreparers(
prepareForTestWithSystemserverclasspathFragment,
prepareForTestWithMyapex,
@@ -447,8 +443,8 @@ func TestPrebuiltStandaloneSystemserverclasspathFragmentContents(t *testing.T) {
"javalib/bar.jar.prof",
})
- assertProfileGuided(t, ctx, "foo", "android_common_myapex", false)
- assertProfileGuided(t, ctx, "bar", "android_common_myapex", true)
+ assertProfileGuidedPrebuilt(t, ctx, "myapex", "foo", false)
+ assertProfileGuidedPrebuilt(t, ctx, "myapex", "bar", true)
}
func assertProfileGuided(t *testing.T, ctx *android.TestContext, moduleName string, variant string, expected bool) {
@@ -458,3 +454,11 @@ func assertProfileGuided(t *testing.T, ctx *android.TestContext, moduleName stri
t.Fatalf("Expected profile-guided to be %v, got %v", expected, actual)
}
}
+
+func assertProfileGuidedPrebuilt(t *testing.T, ctx *android.TestContext, apexName string, moduleName string, expected bool) {
+ dexpreopt := ctx.ModuleForTests(apexName, "android_common_"+apexName).Rule("dexpreopt." + moduleName)
+ actual := strings.Contains(dexpreopt.RuleParams.Command, "--profile-file=")
+ if expected != actual {
+ t.Fatalf("Expected profile-guided to be %v, got %v", expected, actual)
+ }
+}