Add extra options to tools/run-jdwp-tests.sh

Adds options for local debugging:
--verbose: passes '-verbose:jdwp' to the debuggee command-line to
           enable JDWP verbose logs.
--test <name>: runs a specific test instead of the whole test
               suite.

Change-Id: Ia04dd26c16c0b6733bb1c8a1b15ec585a24872c8
diff --git a/tools/run-jdwp-tests.sh b/tools/run-jdwp-tests.sh
index 116a611..104cba7 100755
--- a/tools/run-jdwp-tests.sh
+++ b/tools/run-jdwp-tests.sh
@@ -40,6 +40,9 @@
 vm_command="--vm-command=$art"
 image_compiler_option=""
 debug="no"
+verbose="no"
+# By default, we run the whole JDWP test suite.
+test="org.apache.harmony.jpda.tests.share.AllTests"
 
 while true; do
   if [[ "$1" == "--mode=host" ]]; then
@@ -65,6 +68,19 @@
     # Remove the --debug from the arguments.
     args=${args/$1}
     shift
+  elif [[ $1 == "--verbose" ]]; then
+    verbose="yes"
+    # Remove the --verbose from the arguments.
+    args=${args/$1}
+    shift
+  elif [[ $1 == "--test" ]]; then
+    # Remove the --test from the arguments.
+    args=${args/$1}
+    shift
+    test=$1
+    # Remove the test from the arguments.
+    args=${args/$1}
+    shift
   elif [[ "$1" == "" ]]; then
     break
   else
@@ -78,6 +94,10 @@
   art_debugee="$art_debugee -d"
   vm_args="$vm_args --vm-arg -XXlib:libartd.so"
 fi
+if [[ $verbose == "yes" ]]; then
+  # Enable JDWP logs in the debuggee.
+  art_debugee="$art_debugee -verbose:jdwp"
+fi
 
 # Run the tests using vogar.
 vogar $vm_command \
@@ -93,4 +113,4 @@
       --vm-arg -Djpda.settings.debuggeeJavaPath="\"$art_debugee $image $debuggee_args\"" \
       --classpath $test_jar \
       --vm-arg -Xcompiler-option --vm-arg --debuggable \
-      org.apache.harmony.jpda.tests.share.AllTests
+      $test