8212630: jtreg/gc/logging/TestMetaSpaceLog.java failed with Agent timed out
authorkbarrett
Tue, 04 Jun 2019 13:26:20 -0400
changeset 55203 8e31e083fe3c
parent 55202 7c49133fc1bc
child 55204 0289438c1286
8212630: jtreg/gc/logging/TestMetaSpaceLog.java failed with Agent timed out Summary: Use driver with framework test options passed through to subtask. Reviewed-by: tschatzl, lmesnik
test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java
--- a/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java	Tue Jun 04 17:51:14 2019 +0200
+++ b/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java	Tue Jun 04 13:26:20 2019 -0400
@@ -33,8 +33,6 @@
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jtreg.SkippedException;
-import sun.hotspot.gc.GC;
 import sun.hotspot.WhiteBox;
 
 /*
@@ -45,10 +43,13 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @requires vm.gc != "Epsilon"
+ * @requires vm.gc != "Z"
+ * @requires vm.gc != "Shenandoah"
  *
  * @compile TestMetaSpaceLog.java
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.logging.TestMetaSpaceLog
+ * @run driver gc.logging.TestMetaSpaceLog
  */
 
 public class TestMetaSpaceLog {
@@ -60,27 +61,7 @@
   }
 
   public static void main(String[] args) throws Exception {
-    boolean noneGCSupported = true;
-
-    if (GC.Parallel.isSupported()) {
-      noneGCSupported = false;
-      testMetaSpaceUpdate("UseParallelGC");
-    }
-    if (GC.G1.isSupported()) {
-      noneGCSupported = false;
-      testMetaSpaceUpdate("UseG1GC");
-    }
-    if (GC.ConcMarkSweep.isSupported()) {
-      noneGCSupported = false;
-      testMetaSpaceUpdate("UseConcMarkSweepGC");
-    }
-    if (GC.Serial.isSupported()) {
-      noneGCSupported = false;
-      testMetaSpaceUpdate("UseSerialGC");
-    }
-    if (noneGCSupported) {
-      throw new SkippedException("Skipping test because none of Parallel/G1/ConcMarkSweep/Serial is supported.");
-    }
+    testMetaSpaceUpdate();
   }
 
   private static void verifyContainsMetaSpaceUpdate(OutputAnalyzer output) {
@@ -99,14 +80,13 @@
     return before > after;
   }
 
-  private static void testMetaSpaceUpdate(String gcFlag) throws Exception {
+  private static void testMetaSpaceUpdate() throws Exception {
     // Propagate test.src for the jar file.
     String testSrc= "-Dtest.src=" + System.getProperty("test.src", ".");
 
-    System.err.println("Testing with GC Flag: " + gcFlag);
     ProcessBuilder pb =
       ProcessTools.createJavaProcessBuilder(
-          "-XX:+" + gcFlag,
+          true,
           "-Xlog:gc*",
           "-Xbootclasspath/a:.",
           "-XX:+UnlockDiagnosticVMOptions",