summaryrefslogtreecommitdiff
path: root/java/testing.go
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2022-01-12 17:56:19 +0000
committer Jiakai Zhang <jiakaiz@google.com> 2022-01-13 14:50:05 +0000
commit6decef916c4a40855b506582620351a729ad76ea (patch)
tree6eb5815015ba8b16c7a045dbf5cc8920752dc710 /java/testing.go
parent9ab9437b40564c25a0f4dfc71acfd117dc1d34dc (diff)
Allow installing boot images outside of APEX.
After this change, `bootImageConfig.installDirOnDevice` can be set to a path outside of the APEX, in which case, the boot image will not be installed in the APEX. Instead, it will be installed to the given path by Make. This is a no-op change. Current behavior is not affected. Bug: 211973309 Test: m nothing Test: - 1. m com.android.art 2. See the boot image still being installed in the ART APEX. Test: - 1. Change `installDirOnDevice` of the ART boot image config to `system/framework`. 2. See the boot image being installed in `/system/framework/<arch>`. Change-Id: Ib13b17cc9e94dc5754c9b51b04df3307323b8783
Diffstat (limited to 'java/testing.go')
-rw-r--r--java/testing.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/java/testing.go b/java/testing.go
index 7441e4497..6c49bc866 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -506,3 +506,19 @@ func fakeApexMutator(mctx android.BottomUpMutatorContext) {
}
}
}
+
+// Applies the given modifier on the boot image config with the given name.
+func FixtureModifyBootImageConfig(name string, configModifier func(*bootImageConfig)) android.FixturePreparer {
+ return android.FixtureModifyConfig(func(androidConfig android.Config) {
+ pathCtx := android.PathContextForTesting(androidConfig)
+ config := genBootImageConfigRaw(pathCtx)
+ configModifier(config[name])
+ })
+}
+
+// Sets the value of `installDirOnDevice` of the boot image config with the given name.
+func FixtureSetBootImageInstallDirOnDevice(name string, installDir string) android.FixturePreparer {
+ return FixtureModifyBootImageConfig(name, func(config *bootImageConfig) {
+ config.installDirOnDevice = installDir
+ })
+}