test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54638 9b8926bf85c1
child 58679 9c3209ff7550
--- a/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java	Thu Oct 17 20:27:44 2019 +0100
+++ b/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java	Thu Oct 17 20:53:35 2019 +0100
@@ -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",
@@ -150,7 +130,7 @@
     public static void loadClass(WhiteBox wb) {
       try {
         URLClassLoader ucl = new URLClassLoader(urls);
-        Class.forName("case00", false, ucl);
+        ucl.loadClass("case00");
       } catch (Exception e) {
         e.printStackTrace();
       }