Extend gcstress timeouts

More succeeding stack unwinds slows gcstress tests and results in
timeout failures on the bots.

Bug: 185305054
Test: manual
Change-Id: I08bfc276aede58699166535ff738fdf59d074ee2
diff --git a/tools/run-libcore-tests.sh b/tools/run-libcore-tests.sh
index 1f39e7d..0aedd66 100755
--- a/tools/run-libcore-tests.sh
+++ b/tools/run-libcore-tests.sh
@@ -267,7 +267,8 @@
   # the default timeout.
   if $gcstress; then
     if $debug; then
-      default_timeout_secs=1440
+      # Increasing for unwinding changes (b/185305054).
+      default_timeout_secs=1800
     else
       default_timeout_secs=1200
     fi
diff --git a/tools/run-libjdwp-tests.sh b/tools/run-libjdwp-tests.sh
index b816aab..415a7de 100755
--- a/tools/run-libjdwp-tests.sh
+++ b/tools/run-libjdwp-tests.sh
@@ -40,6 +40,7 @@
 has_variant="no"
 has_mode="no"
 mode="target"
+has_gcstress="no"
 has_timeout="no"
 has_verbose="no"
 # The bitmap of log messages in libjdwp. See list in the help message for more
@@ -87,6 +88,9 @@
   elif [[ $1 == --variant=* ]]; then
     has_variant="yes"
     shift
+  elif [[ $1 == *gcstress ]]; then
+    has_gcstress="yes"
+    shift
   elif [[ "$1" == "" ]]; then
     break
   else
@@ -106,11 +110,12 @@
 if [[ "$has_timeout" = "no" ]]; then
   # Double the timeout to 20 seconds
   args+=(--test-timeout-ms)
-  if [[ "$has_verbose" = "no" ]]; then
-    args+=(20000)
-  else
-    # Even more time if verbose is set since those can be quite heavy.
+  if [[ "$has_verbose" = "yes" || "$has_gcstress" = "yes" ]]; then
+    # Extra time if verbose or gcstress is set since those can be
+    # quite heavy.
     args+=(200000)
+  else
+    args+=(20000)
   fi
 fi