run-test: Build against libcore for Android device and host targets.

--jvm will build against the RI bootclasspath
--host will build against the host libcore bootclasspath
(implied --target) will build against the target libcore bootclasspath

Also fix other tests that were relying on building against OpenJDK.

Bug: 72491947
Test: art/test/testrunner/testrunner.py --jvm
Test: art/test/testrunner/testrunner.py --host
Change-Id: Ib7ce6740cda544797604200341578f8191f4b2b4
diff --git a/test/run-test b/test/run-test
index 6bcb9cd..260a65a 100755
--- a/test/run-test
+++ b/test/run-test
@@ -195,7 +195,6 @@
         NEED_DEX="false"
         USE_JACK="false"
         run_args="${run_args} --jvm"
-        build_args="${build_args} --jvm"
         shift
     elif [ "x$1" = "x-O" ]; then
         lib="libart.so"
@@ -836,10 +835,16 @@
   err_echo "ulimit file size setting failed"
 fi
 
+# Tell the build script which mode (target, host, jvm) we are building for
+# to determine the bootclasspath at build time.
 if [[ "$target_mode" == "yes" ]]; then
   build_args="$build_args --target"
 else
-  build_args="$build_args --host"
+  if [[ $runtime == "jvm" ]]; then
+    build_args="$build_args --jvm"
+  else
+    build_args="$build_args --host"
+  fi
 fi
 
 if [[ "$dev_mode" == "yes" ]]; then