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;
diff --git a/test/run-test b/test/run-test
index 0dbbaef..2f8dbf3 100755
--- a/test/run-test
+++ b/test/run-test
@@ -640,7 +640,7 @@
# need to be loaded through LD_LIBRARY_PATH and
# NATIVELOADER_DEFAULT_NAMESPACE_LIBS instead.
run_args+=(--runtime-option "-Djava.library.path=/data/nativetest${suffix64}/art/${target_arch_name}")
- run_args+=(--boot "/data/local/tmp/art_boot_images/boot.art")
+ run_args+=(--boot "/system/framework/art_boot_images/boot.art")
fi
if [ "$relocate" = "yes" ]; then
run_args+=(--relocate)
diff --git a/tools/buildbot-sync.sh b/tools/buildbot-sync.sh
index 277839b..28dab0c 100755
--- a/tools/buildbot-sync.sh
+++ b/tools/buildbot-sync.sh
@@ -116,7 +116,7 @@
basename="generate-boot-image$b"
bin_on_host="$ANDROID_PRODUCT_OUT/system/bin/$basename"
bin_on_device="/data/local/tmp/$basename"
- output_dir="/data/local/tmp/art_boot_images"
+ output_dir="/system/framework/art_boot_images"
if [ -f $bin_on_host ]; then
msginfo "Generating the primary boot image ($b-bit)..."
adb push "$bin_on_host" "$ART_TEST_CHROOT$bin_on_device"