Use boot image for all tests instead of core.art.

Test: m test-art-host-gtest
Test: test.py -b -r --host --optimizing
Test: mmma art/tools/ahat
Test: (the tests above do not build core.art)
Bug: 147817558
Bug: 147819342
Change-Id: I412fa140e78fd3769696a6635b896b1cf975edd6
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index ab9d594..fe66bbb 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -254,6 +254,12 @@
 ART_GTEST_oatdump_test_DEX_DEPS := ProfileTestMultiDex
 ART_GTEST_reg_type_test_DEX_DEPS := Interfaces
 
+# Deprecated core.art dependencies.
+HOST_CORE_IMAGE_DEFAULT_32 :=
+HOST_CORE_IMAGE_DEFAULT_64 :=
+TARGET_CORE_IMAGE_DEFAULT_32 :=
+TARGET_CORE_IMAGE_DEFAULT_64 :=
+
 # The elf writer test has dependencies on core.oat.
 ART_GTEST_elf_writer_test_HOST_DEPS := $(HOST_CORE_IMAGE_DEFAULT_64) $(HOST_CORE_IMAGE_DEFAULT_32)
 ART_GTEST_elf_writer_test_TARGET_DEPS := $(TARGET_CORE_IMAGE_DEFAULT_64) $(TARGET_CORE_IMAGE_DEFAULT_32)
diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk
index fb3ca02..a0dfa1b 100644
--- a/test/Android.run-test.mk
+++ b/test/Android.run-test.mk
@@ -135,7 +135,9 @@
       $(foreach address_size, $(ALL_ADDRESS_SIZES), $(eval \
         $(call core-image-dependencies,$(target),$(image),$(compiler),$(address_size)))))))
 
-test-art-host-run-test-dependencies : $(host_prereq_rules) $(HOST_CORE_IMG_OUTS)
+test-art-host-run-test-dependencies : \
+	$(ART_TEST_HOST_RUN_TEST_DEPENDENCIES) $(TEST_ART_RUN_TEST_DEPENDENCIES) \
+	$(HOST_BOOT_IMAGE_JARS) $(HOST_BOOT_IMAGE) $(2ND_HOST_BOOT_IMAGE)
 .PHONY: test-art-host-run-test-dependencies
 test-art-target-run-test-dependencies :
 .PHONY: test-art-target-run-test-dependencies
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 141aab7..af8fecd 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -715,35 +715,31 @@
 bpath=""
 bpath_locations=""
 bpath_separator=""
+bpath_prefix=""
+bpath_location_prefix=""
 if [ "${HOST}" = "y" ]; then
-    framework="${ANDROID_HOST_OUT}/framework"
-    if [ "${ANDROID_HOST_OUT:0:${#ANDROID_BUILD_TOP}+1}" = "${ANDROID_BUILD_TOP}/" ]; then
-      framework_location="${ANDROID_HOST_OUT:${#ANDROID_BUILD_TOP}+1}/framework"
-    else
-      echo "error: ANDROID_BUILD_TOP/ is not a prefix of ANDROID_HOST_OUT"
-      echo "ANDROID_BUILD_TOP=${ANDROID_BUILD_TOP}"
-      echo "ANDROID_HOST_OUT=${ANDROID_HOST_OUT}"
-      exit
-    fi
-    bpath_suffix="-hostdex"
-    for bpath_module in ${bpath_modules}; do
-      bpath+="${bpath_separator}${framework}/${bpath_module}${bpath_suffix}.jar"
-      bpath_locations+="${bpath_separator}${framework_location}/${bpath_module}${bpath_suffix}.jar"
-      bpath_separator=":"
-    done
-else
-    for bpath_module in ${bpath_modules}; do
-      apex_module="com.android.art"
-      if [ "${bpath_module}" = "conscrypt" ]; then
-        apex_module="com.android.conscrypt"
-      elif [ "${bpath_module}" = "core-icu4j" ]; then
-        apex_module="com.android.i18n"
-      fi
-      bpath+="${bpath_separator}/apex/${apex_module}/javalib/${bpath_module}.jar"
-      bpath_locations+="${bpath_separator}/apex/${apex_module}/javalib/${bpath_module}.jar"
-      bpath_separator=":"
-    done
+  bpath_prefix="${ANDROID_HOST_OUT}"
+  if [ "${ANDROID_HOST_OUT:0:${#ANDROID_BUILD_TOP}+1}" = "${ANDROID_BUILD_TOP}/" ]; then
+    bpath_location_prefix="${ANDROID_HOST_OUT:${#ANDROID_BUILD_TOP}+1}"
+  else
+    echo "error: ANDROID_BUILD_TOP/ is not a prefix of ANDROID_HOST_OUT"
+    echo "ANDROID_BUILD_TOP=${ANDROID_BUILD_TOP}"
+    echo "ANDROID_HOST_OUT=${ANDROID_HOST_OUT}"
+    exit
+  fi
 fi
+for bpath_module in ${bpath_modules}; do
+  apex_module="com.android.art"
+  case "$bpath_module" in
+    (conscrypt)  apex_module="com.android.conscrypt";;
+    (core-icu4j) apex_module="com.android.i18n";;
+    (*)          apex_module="com.android.art";;
+  esac
+  bpath_jar="/apex/${apex_module}/javalib/${bpath_module}.jar"
+  bpath+="${bpath_separator}${bpath_prefix}${bpath_jar}"
+  bpath_locations+="${bpath_separator}${bpath_location_prefix}${bpath_jar}"
+  bpath_separator=":"
+done
 # Pass down the bootclasspath
 FLAGS="${FLAGS} -Xbootclasspath:${bpath}"
 FLAGS="${FLAGS} -Xbootclasspath-locations:${bpath_locations}"
@@ -1172,7 +1168,7 @@
     # Needed to access libarttest(d).so and JVMTI agent libraries.
     LD_LIBRARY_PATH="/data/$TEST_DIRECTORY/art/$ISA:$LD_LIBRARY_PATH"
     # Needed to access the boot (core) image files.
-    LD_LIBRARY_PATH="/data/art-test/$ISA:$LD_LIBRARY_PATH"
+    LD_LIBRARY_PATH="/apex/com.android.art/javalib/$ISA:$LD_LIBRARY_PATH"
     # Needed to access the test's Odex files.
     LD_LIBRARY_PATH="$DEX_LOCATION/oat/$ISA:$LD_LIBRARY_PATH"
     # Needed to access the test's native libraries (see e.g. 674-hiddenapi,
diff --git a/test/run-test b/test/run-test
index 714c90a..86d30d5 100755
--- a/test/run-test
+++ b/test/run-test
@@ -615,7 +615,8 @@
 function guess_target_arch_name() {
     # Check whether this is a device with native bridge. Currently this is hardcoded
     # to x86 + arm.
-    x86_arm=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | sort | grep -E '^(arm|x86)$'`
+    local guess_path=${ANDROID_PRODUCT_OUT}/system/apex/com.android.art.testing/javalib
+    local x86_arm=`ls ${guess_path} | sort | grep -E '^(arm|x86)$'`
     # Collapse line-breaks into spaces
     x86_arm=$(echo $x86_arm)
     if [ "x$x86_arm" = "xarm x86" ] ; then
@@ -627,8 +628,8 @@
             target_arch_name=x86
         fi
     else
-        grep32bit=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | grep -E '^(arm|x86)$'`
-        grep64bit=`ls ${ANDROID_PRODUCT_OUT}/data/art-test | grep -E '^(arm64|x86_64)$'`
+        local grep32bit=`ls ${guess_path} | grep -E '^(arm|x86)$'`
+        local grep64bit=`ls ${guess_path} | grep -E '^(arm64|x86_64)$'`
         if [ "x${suffix64}" = "x64" ]; then
             target_arch_name=${grep64bit}
         else
@@ -675,12 +676,12 @@
 elif [ "$runtime" = "art" ]; then
     if [ "$target_mode" = "no" ]; then
         guess_host_arch_name
-        run_args+=(--boot "${ANDROID_HOST_OUT}/framework/core.art:*")
+        run_args+=(--boot "${ANDROID_HOST_OUT}/apex/com.android.art/javalib/boot.art")
         run_args+=(--runtime-option "-Djava.library.path=${host_lib_root}/lib${suffix64}:${host_lib_root}/nativetest${suffix64}")
     else
         guess_target_arch_name
         run_args+=(--runtime-option "-Djava.library.path=/data/nativetest${suffix64}/art/${target_arch_name}")
-        run_args+=(--boot "/data/art-test/core.art:/data/art-test/*")
+        run_args+=(--boot "/apex/com.android.art/javalib/boot.art")
     fi
     if [ "$relocate" = "yes" ]; then
       run_args+=(--relocate)
diff --git a/tools/ahat/Android.mk b/tools/ahat/Android.mk
index 3dc2f10..f827113 100644
--- a/tools/ahat/Android.mk
+++ b/tools/ahat/Android.mk
@@ -60,7 +60,7 @@
   $(ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES) \
   $(ART_HOST_DEX_DEPENDENCIES) \
   $(HOST_OUT_EXECUTABLES)/art \
-  $(HOST_CORE_IMG_OUT_BASE)$(CORE_IMG_SUFFIX)
+  $(HOST_CORE_IMG_OUTS)
 
 $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_ART := $(HOST_OUT_EXECUTABLES)/art
 $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_DUMP_JAR := $(AHAT_TEST_DUMP_JAR)
diff --git a/tools/run-jdwp-tests.sh b/tools/run-jdwp-tests.sh
index 062db09..dd551bc 100755
--- a/tools/run-jdwp-tests.sh
+++ b/tools/run-jdwp-tests.sh
@@ -72,7 +72,7 @@
 debug="no"
 explicit_debug="no"
 verbose="no"
-image="-Ximage:/data/art-test/core.art"
+image="-Ximage:/apex/com.android.art/javalib/boot.art"
 boot_classpath="$(boot_classpath_arg /apex/com.android.art/javalib "" $BOOT_CLASSPATH_JARS)"
 boot_classpath_locations=""
 with_jdwp_path=""
diff --git a/tools/run-libcore-tests.sh b/tools/run-libcore-tests.sh
index ff3c433..c6731b5 100755
--- a/tools/run-libcore-tests.sh
+++ b/tools/run-libcore-tests.sh
@@ -184,7 +184,7 @@
   case "$1" in
     --mode=device)
       vogar_args="$vogar_args --mode=device"
-      vogar_args="$vogar_args --vm-arg -Ximage:/data/art-test/core.art"
+      vogar_args="$vogar_args --vm-arg -Ximage:/apex/com.android.art/javalib/boot.art"
       vogar_args="$vogar_args $(boot_classpath_arg /apex/com.android.art/javalib $BOOT_CLASSPATH_JARS)"
       execution_mode="device"
       ;;