Add a --no-compile option to the art script and use it for jdwp.

The tests started to sometimes timeout, and I suspect the new dex2oat
invocations are related.

Test: run-jdwp-tests.sh
bug: 111174995
bug: 111342996

Change-Id: Ic15e05c614cb8f9cf5378fbb5753a5a2ac75ac0f
diff --git a/tools/art b/tools/art
index 9c032c0..fbc7992 100644
--- a/tools/art
+++ b/tools/art
@@ -49,6 +49,7 @@
   --profile                Run with profiling, then run using profile data.
   --verbose                Run script verbosely.
   --no-clean               Don't cleanup oat directories.
+  --no-compile             Don't invoke dex2oat before running.
   --allow-default-jdwp     Don't automatically put in -XjdwpProvider:none.
                            You probably do not want this.
 
@@ -290,6 +291,7 @@
 ALLOW_DEFAULT_JDWP="no"
 VERBOSE="no"
 CLEAN_OAT_FILES="yes"
+RUN_DEX2OAT="yes"
 EXTRA_OPTIONS=()
 DEX2OAT_FLAGS=()
 DEX2OAT_CLASSPATH=()
@@ -347,6 +349,10 @@
   --no-clean)
     CLEAN_OAT_FILES="no"
     ;;
+  --no-compile)
+    CLEAN_OAT_FILES="no"
+    RUN_DEX2OAT="no"
+    ;;
   --allow-default-jdwp)
     ALLOW_DEFAULT_JDWP="yes"
     ;;
@@ -480,8 +486,10 @@
 fi
 
 if [ -x "$DEX2OAT_BINARY_PATH" ]; then
-  # Run dex2oat before launching ART to generate the oat files for the classpath.
-  run_dex2oat
+  if [ "$RUN_DEX2OAT" = "yes" ]; then
+    # Run dex2oat before launching ART to generate the oat files for the classpath.
+    run_dex2oat
+  fi
 fi
 
 # Do not continue if the dex2oat failed.
diff --git a/tools/run-jdwp-tests.sh b/tools/run-jdwp-tests.sh
index b0b5810..13f756c 100755
--- a/tools/run-jdwp-tests.sh
+++ b/tools/run-jdwp-tests.sh
@@ -260,8 +260,8 @@
   # we don't want to be trying to connect to adbconnection which might not have
   # been built.
   vm_args="${vm_args} --vm-arg -XjdwpProvider:none"
-  # Make sure the debuggee doesn't clean up what the debugger has generated.
-  art_debugee="$art_debugee --no-clean"
+  # Make sure the debuggee doesn't re-generate, nor clean up what the debugger has generated.
+  art_debugee="$art_debugee --no-compile --no-clean"
 fi
 
 function jlib_name {