Fix 925-threadgroups when running on T.

Given we take metrics flags in priority from system properties, the flag
being passed through the 'run' script wasn't taking effect.

Make the test more robust by removing the metrics thread from the list
of threads we expect to see.

Test: 925-threadgroups
Change-Id: If15fe11a81af855c41a7c3c1bdb2f54edadc761c
diff --git a/test/925-threadgroups/expected-stdout.txt b/test/925-threadgroups/expected-stdout.txt
index 3cc36f2..9dfa37d 100644
--- a/test/925-threadgroups/expected-stdout.txt
+++ b/test/925-threadgroups/expected-stdout.txt
@@ -12,7 +12,7 @@
   [Thread[main,5,main]]
   []
 system:
-  [Thread[FinalizerDaemon,5,system], Thread[FinalizerWatchdogDaemon,5,system], Thread[HeapTaskDaemon,5,system], Thread[Metrics Background Reporting Thread,5,system], Thread[ReferenceQueueDaemon,5,system], Thread[Signal Catcher,5,system]]
+  [Thread[FinalizerDaemon,5,system], Thread[FinalizerWatchdogDaemon,5,system], Thread[HeapTaskDaemon,5,system], Thread[ReferenceQueueDaemon,5,system], Thread[Signal Catcher,5,system]]
   [java.lang.ThreadGroup[name=main,maxpri=10]]
 art.Test925$CustomThreadGroup[name=TEST GROUP,maxpri=10]
   java.lang.ThreadGroup[name=main,maxpri=10]
diff --git a/test/925-threadgroups/run b/test/925-threadgroups/run
index 8e44166..c6e62ae 100755
--- a/test/925-threadgroups/run
+++ b/test/925-threadgroups/run
@@ -14,4 +14,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-./default-run "$@" --jvmti --runtime-option -Xmetrics-reporting-mods:100
+./default-run "$@" --jvmti
diff --git a/test/925-threadgroups/src/art/Test925.java b/test/925-threadgroups/src/art/Test925.java
index 78068ae..cb77e25 100644
--- a/test/925-threadgroups/src/art/Test925.java
+++ b/test/925-threadgroups/src/art/Test925.java
@@ -47,7 +47,7 @@
     printThreadGroupInfo(curGroup);
     printThreadGroupInfo(rootGroup);
 
-    waitGroupChildren(rootGroup, 6 /* # daemons */, 30 /* timeout in seconds */);
+    waitGroupChildren(rootGroup, 5 /* # daemons */, 30 /* timeout in seconds */);
 
     checkChildren(curGroup);
 
@@ -90,22 +90,27 @@
     System.out.println("  " + threadGroupInfo[3]);  // Daemon
   }
 
+  private static ArrayList<Thread> filteredThread(Thread[] threads) {
+    ArrayList<Thread> list = new ArrayList<>(Arrays.asList(threads));
+
+    // Filter out JIT and reporting thread. They may or may not be there depending on configuration.
+    Iterator<Thread> it = list.iterator();
+    while (it.hasNext()) {
+      Thread t = it.next();
+      if (t.getName().startsWith("Jit thread pool worker") ||
+          t.getName().startsWith("Metrics Background Reporting Thread")) {
+        it.remove();
+      }
+    }
+    return list;
+  }
+
   private static void checkChildren(ThreadGroup tg) {
     Object[] data = getThreadGroupChildren(tg);
     Thread[] threads = (Thread[])data[0];
     ThreadGroup[] groups = (ThreadGroup[])data[1];
 
-    List<Thread> threadList = new ArrayList<>(Arrays.asList(threads));
-
-    // Filter out JIT thread. It may or may not be there depending on configuration.
-    Iterator<Thread> it = threadList.iterator();
-    while (it.hasNext()) {
-      Thread t = it.next();
-      if (t.getName().startsWith("Jit thread pool worker")) {
-        it.remove();
-        break;
-      }
-    }
+    List<Thread> threadList = filteredThread(threads);
 
     Collections.sort(threadList, THREAD_COMP);
 
@@ -124,15 +129,7 @@
     for (int i = 0; i <  timeoutS; i++) {
       Object[] data = getThreadGroupChildren(tg);
       Thread[] threads = (Thread[])data[0];
-      List<Thread> lthreads = new ArrayList<>(Arrays.asList(threads));
-      Iterator<Thread> it = lthreads.iterator();
-      while (it.hasNext()) {
-        Thread t = it.next();
-        if (t.getName().startsWith("Jit thread pool worker")) {
-          it.remove();
-          break;
-        }
-      }
+      List<Thread> lthreads = filteredThread(threads);
       if (lthreads.size() == expectedChildCount) {
         return;
       }