Move the primary boot image in chroot environment.
This change moves the primary boot image to
`/system/framework/art_boot_images` in the chroot environment because
some run-tests (specifially, those that uses
`-Xonly-use-system-oat-files` or `--zygote` expects the primary boot
image to be in a trusted location.
Bug: 216467764
Test: art/test/testrunner/testrunner.py --target --64
Test: art/tools/run-gtests.sh -- -j4
Test: atest ArtGtestsTargetChroot
Change-Id: Ib0e9e15013a02639da2d904c97a69aea743709db
diff --git a/libartbase/base/common_art_test.cc b/libartbase/base/common_art_test.cc
index e35cb93..c74f3de 100644
--- a/libartbase/base/common_art_test.cc
+++ b/libartbase/base/common_art_test.cc
@@ -540,7 +540,14 @@
if (OS::DirectoryExists(path.c_str())) {
return path;
}
- // In a chroot test, the boot image is located in a predefined location.
+ // In a chroot environment prepared by scripts, the boot image is located in a predefined
+ // location on /system.
+ path = "/system/framework/art_boot_images";
+ if (OS::DirectoryExists(path.c_str())) {
+ return path;
+ }
+ // In art-target-gtest-chroot, the boot image is located in a predefined location on /data because
+ // /system is a mount point that replicates the real one on device.
path = "/data/local/tmp/art_boot_images";
if (OS::DirectoryExists(path.c_str())) {
return path;