Add jvm mode to run-libcore-tests.sh

Test: art/tools/run-libcore-tests.sh --mode=jvm -- libcore.java.lang.invoke
Change-Id: I998641b292d872ffb77e069d21b180e4bf12734a
diff --git a/tools/run-libcore-tests.sh b/tools/run-libcore-tests.sh
index 7dea61e..c707b3e 100755
--- a/tools/run-libcore-tests.sh
+++ b/tools/run-libcore-tests.sh
@@ -64,7 +64,7 @@
   Run libcore tests using the vogar testing tool.
 
   Required parameters:
-    --mode=device|host     Specify where tests should be run.
+    --mode=device|host|jvm Specify where tests should be run.
 
   Optional parameters:
     --debug                Use debug version of ART (device|host only).
@@ -151,7 +151,7 @@
 # Run tests that use the getrandom() syscall? (Requires Linux 3.17+).
 getrandom=true
 
-# Execution mode specifies where to run tests (device|host).
+# Execution mode specifies where to run tests (device|host|jvm).
 execution_mode=""
 
 vogar_args=""
@@ -172,6 +172,10 @@
       vogar_args="$vogar_args $1 --vm-arg -Ximage:/non/existent/vogar.art"
       execution_mode="host"
       ;;
+    --mode=jvm)
+      vogar_args="$vogar_args $1"
+      execution_mode="jvm"
+      ;;
     --no-getrandom)
       getrandom=false
       ;;
@@ -257,33 +261,35 @@
   fi
 fi  # $execution_mode = "device"
 
-# set the toolchain to use.
-vogar_args="$vogar_args --toolchain d8 --language CUR"
+if [ $execution_mode = "device" -o $execution_mode = "host" ]; then
+  # set the toolchain to use.
+  vogar_args="$vogar_args --toolchain d8 --language CUR"
 
-# JIT settings.
-if $use_jit; then
-  vogar_args="$vogar_args --vm-arg -Xcompiler-option --vm-arg --compiler-filter=quicken"
-fi
-vogar_args="$vogar_args --vm-arg -Xusejit:$use_jit"
-
-# gcstress may lead to timeouts, so we need dedicated expectations files for it.
-if $gcstress; then
-  expectations="$expectations --expectations art/tools/libcore_gcstress_failures.txt"
-  if $debug; then
-    expectations="$expectations --expectations art/tools/libcore_gcstress_debug_failures.txt"
+  # JIT settings.
+  if $use_jit; then
+    vogar_args="$vogar_args --vm-arg -Xcompiler-option --vm-arg --compiler-filter=quicken"
   fi
-else
-  # We only run this package when user has not specified packages
-  # to run and not under gcstress as it can cause timeouts. See
-  # b/78228743.
-  working_packages+=("libcore.libcore.icu")
-fi
+  vogar_args="$vogar_args --vm-arg -Xusejit:$use_jit"
 
-if $getrandom; then :; else
-  # Ignore failures in tests that use the getrandom() syscall (which requires
-  # Linux 3.17+). This is needed on fugu (Nexus Player) devices, where the
-  # kernel is Linux 3.10.
-  expectations="$expectations --expectations art/tools/libcore_no_getrandom_failures.txt"
+  # gcstress may lead to timeouts, so we need dedicated expectations files for it.
+  if $gcstress; then
+    expectations="$expectations --expectations art/tools/libcore_gcstress_failures.txt"
+    if $debug; then
+      expectations="$expectations --expectations art/tools/libcore_gcstress_debug_failures.txt"
+    fi
+  else
+    # We only run this package when user has not specified packages
+    # to run and not under gcstress as it can cause timeouts. See
+    # b/78228743.
+    working_packages+=("libcore.libcore.icu")
+  fi
+
+  if $getrandom; then :; else
+    # Ignore failures in tests that use the getrandom() syscall (which requires
+    # Linux 3.17+). This is needed on fugu (Nexus Player) devices, where the
+    # kernel is Linux 3.10.
+    expectations="$expectations --expectations art/tools/libcore_no_getrandom_failures.txt"
+  fi
 fi
 
 if [ ! -t 1 ] ; then