Use higher default thread suspend timeout for run tests

Increase the default for tests from 10s-50s to 500s. This is done
by adding a run-test option "--suspend-timeout" that defaults to
500000.

Example when passing a low value of 100:
test/run-test --host --suspend-timeout 100 --dev 004-ThreadStress

Results in:
dalvikvm32 F 01-22 13:33:31 12067 12118 thread_list.cc:669] Timed
out waiting for threads to suspend, waited for 100.114ms

This should fix some of the recent test flakiness.

Test: test-art-host

Change-Id: I303c4f198e560e9f38ec375e9d7a80a5e61f776e
diff --git a/test/run-test b/test/run-test
index 9b17802..c78fa35 100755
--- a/test/run-test
+++ b/test/run-test
@@ -131,6 +131,7 @@
 multi_image_suffix=""
 android_root="/system"
 bisection_search="no"
+suspend_timeout="500000"
 # By default we will use optimizing.
 image_args=""
 image_suffix=""
@@ -219,6 +220,10 @@
         basic_verify="true"
         gc_stress="true"
         shift
+    elif [ "x$1" = "x--suspend-timeout" ]; then
+        shift
+        suspend_timeout="$1"
+        shift
     elif [ "x$1" = "x--image" ]; then
         shift
         image="$1"
@@ -402,6 +407,9 @@
 tmp_dir="`cd $oldwd ; python -c "import os; print os.path.realpath('$tmp_dir')"`"
 mkdir -p $tmp_dir
 
+# Add thread suspend timeout flag
+run_args="${run_args} --runtime-option -XX:ThreadSuspendTimeout=$suspend_timeout"
+
 if [ "$basic_verify" = "true" ]; then
   # Set HspaceCompactForOOMMinIntervalMs to zero to run hspace compaction for OOM more frequently in tests.
   run_args="${run_args} --runtime-option -Xgc:preverify --runtime-option -Xgc:postverify --runtime-option -XX:HspaceCompactForOOMMinIntervalMs=0"
@@ -649,6 +657,7 @@
         echo "    --quiet               Don't print anything except failure messages"
         echo "    --bisection-search    Perform bisection bug search."
         echo "    --vdex                Test using vdex as in input to dex2oat. Only works with --prebuild."
+        echo "    --suspend-timeout     Change thread suspend timeout ms (default 500000)."
     ) 1>&2  # Direct to stderr so usage is not printed if --quiet is set.
     exit 1
 fi