Refactor test handling with @requires epsilon-gc-branch
authorshade
Fri, 11 May 2018 18:33:36 +0200
branchepsilon-gc-branch
changeset 56540 ada11a8e2ebc
parent 56536 9931d138b808
child 56576 92316ff16d5c
Refactor test handling with @requires
test/hotspot/jtreg/TEST.ROOT
test/hotspot/jtreg/TEST.groups
test/hotspot/jtreg/gc/epsilon/AbstractEpsilonTest.java
test/hotspot/jtreg/gc/epsilon/TestAlwaysPretouch.java
test/hotspot/jtreg/gc/epsilon/TestByteArrays.java
test/hotspot/jtreg/gc/epsilon/TestDieDefault.java
test/hotspot/jtreg/gc/epsilon/TestDieWithHeapDump.java
test/hotspot/jtreg/gc/epsilon/TestDieWithOnError.java
test/hotspot/jtreg/gc/epsilon/TestEpsilonEnabled.java
test/hotspot/jtreg/gc/epsilon/TestHelloWorld.java
test/hotspot/jtreg/gc/epsilon/TestLogTrace.java
test/hotspot/jtreg/gc/epsilon/TestManyThreads.java
test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java
test/hotspot/jtreg/gc/epsilon/TestMemoryPools.java
test/hotspot/jtreg/gc/epsilon/TestObjects.java
test/hotspot/jtreg/gc/epsilon/TestPrintHeapSteps.java
test/hotspot/jtreg/gc/epsilon/TestRefArrays.java
test/hotspot/jtreg/gc/epsilon/TestUpdateCountersSteps.java
test/lib/sun/hotspot/gc/GC.java
--- a/test/hotspot/jtreg/TEST.ROOT	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/TEST.ROOT	Fri May 11 18:33:36 2018 +0200
@@ -45,6 +45,7 @@
     vm.gc.Serial \
     vm.gc.Parallel \
     vm.gc.ConcMarkSweep \
+    vm.gc.Epsilon \
     vm.jvmci \
     vm.emulatedClient \
     vm.cpu.features \
--- a/test/hotspot/jtreg/TEST.groups	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/TEST.groups	Fri May 11 18:33:36 2018 +0200
@@ -173,12 +173,14 @@
   -:tier1_gc
 
 tier1_gc_1 = \
+  gc/epsilon/ \
   gc/g1/ \
   -gc/g1/ihop/TestIHOPErgo.java
 
 tier1_gc_2 = \
   sanity/ExecuteInternalVMTests.java \
   gc/ \
+  -gc/epsilon/ \
   -gc/g1/ \
   -gc/logging/TestUnifiedLoggingSwitchStress.java \
   -gc/stress \
--- a/test/hotspot/jtreg/gc/epsilon/AbstractEpsilonTest.java	Mon May 07 16:41:38 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.lang.management.GarbageCollectorMXBean;
-import java.lang.management.ManagementFactory;
-
-public class AbstractEpsilonTest {
-  public static boolean isEpsilonEnabled() {
-    for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
-      if (bean.getName().contains("Epsilon")) {
-        return true;
-      }
-    }
-    return false;
-  }
-}
--- a/test/hotspot/jtreg/gc/epsilon/TestAlwaysPretouch.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestAlwaysPretouch.java	Fri May 11 18:33:36 2018 +0200
@@ -23,8 +23,10 @@
 
 /**
  * @test TestAlwaysPretouch
+ * @key gc
+ * @requires vm.gc.Epsilon
  * @summary Basic sanity test for Epsilon
- * @run main/othervm -Xmx1g -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestAlwaysPretouch
+ * @run main/othervm -Xmx1g -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestAlwaysPretouch
  */
 
 public class TestAlwaysPretouch {
--- a/test/hotspot/jtreg/gc/epsilon/TestByteArrays.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestByteArrays.java	Fri May 11 18:33:36 2018 +0200
@@ -23,25 +23,26 @@
 
 /**
  * @test TestByteArrays
- * @library /test/lib
+ * @key gc
+ * @requires vm.gc.Epsilon
  * @summary Epsilon is able to allocate arrays, and does not corrupt their state
  *
- * @run main/othervm -Xmx1g                                        -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestByteArrays
- * @run main/othervm -Xmx1g -Xint                                  -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestByteArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp                         -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestByteArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestByteArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestByteArrays
+ * @run main/othervm -Xmx1g                                        -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestByteArrays
+ * @run main/othervm -Xmx1g -Xint                                  -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestByteArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp                         -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestByteArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestByteArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestByteArrays
  *
- * @run main/othervm -Xmx1g                                        -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestByteArrays
- * @run main/othervm -Xmx1g -Xint                                  -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestByteArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp                         -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestByteArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestByteArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestByteArrays
+ * @run main/othervm -Xmx1g                                        -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestByteArrays
+ * @run main/othervm -Xmx1g -Xint                                  -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestByteArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp                         -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestByteArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestByteArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestByteArrays
  */
 
 import java.util.Random;
 
-public class TestByteArrays extends AbstractEpsilonTest {
+public class TestByteArrays {
 
   static long SEED = Long.getLong("seed", System.nanoTime());
   static int COUNT = Integer.getInteger("count", 3000); // ~500 MB allocation
@@ -49,8 +50,6 @@
   static byte[][] arr;
 
   public static void main(String[] args) throws Exception {
-    if (!isEpsilonEnabled()) return;
-
     Random r = new Random(SEED);
 
     arr = new byte[COUNT * 100][];
--- a/test/hotspot/jtreg/gc/epsilon/TestDieDefault.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestDieDefault.java	Fri May 11 18:33:36 2018 +0200
@@ -23,6 +23,8 @@
 
 /**
  * @test TestDieDefault
+ * @key gc
+ * @requires vm.gc.Epsilon
  * @summary Epsilon GC should die on heap exhaustion
  * @library /test/lib
  * @run main TestDieDefault
@@ -31,7 +33,7 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
-public class TestDieDefault extends AbstractEpsilonTest {
+public class TestDieDefault {
 
   public static void passWith(String... args) throws Exception {
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
@@ -50,8 +52,6 @@
   }
 
   public static void main(String[] args) throws Exception {
-    if (!isEpsilonEnabled()) return;
-
     passWith("-Xmx128m",
              "-XX:+UnlockExperimentalVMOptions",
              "-XX:+UseEpsilonGC",
--- a/test/hotspot/jtreg/gc/epsilon/TestDieWithHeapDump.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestDieWithHeapDump.java	Fri May 11 18:33:36 2018 +0200
@@ -23,6 +23,8 @@
 
 /**
  * @test TestDieWithHeapDump
+ * @key gc
+ * @requires vm.gc.Epsilon
  * @summary Epsilon GC should die on heap exhaustion with error handler attached
  * @library /test/lib
  * @run main TestDieWithHeapDump
@@ -32,7 +34,7 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
-public class TestDieWithHeapDump extends AbstractEpsilonTest {
+public class TestDieWithHeapDump {
 
   public static void passWith(String... args) throws Exception {
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
@@ -56,8 +58,6 @@
   }
 
   public static void main(String[] args) throws Exception {
-    if (!isEpsilonEnabled()) return;
-
     passWith("-Xmx128m",
              "-XX:+UnlockExperimentalVMOptions",
              "-XX:+UseEpsilonGC",
--- a/test/hotspot/jtreg/gc/epsilon/TestDieWithOnError.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestDieWithOnError.java	Fri May 11 18:33:36 2018 +0200
@@ -23,6 +23,8 @@
 
 /**
  * @test TestDieWithOnError
+ * @key gc
+ * @requires vm.gc.Epsilon
  * @summary Epsilon GC should die on heap exhaustion with error handler attached
  * @library /test/lib
  * @run main TestDieWithOnError
@@ -31,7 +33,7 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
-public class TestDieWithOnError extends AbstractEpsilonTest {
+public class TestDieWithOnError {
 
   static String ON_ERR_MSG = "Epsilon error handler message";
 
@@ -54,8 +56,6 @@
   }
 
   public static void main(String[] args) throws Exception {
-    if (!isEpsilonEnabled()) return;
-
     passWith("-Xmx128m",
              "-XX:+UnlockExperimentalVMOptions",
              "-XX:+UseEpsilonGC",
--- a/test/hotspot/jtreg/gc/epsilon/TestEpsilonEnabled.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestEpsilonEnabled.java	Fri May 11 18:33:36 2018 +0200
@@ -23,20 +23,30 @@
 
 /**
  * @test TestAlwaysPretouch
- * @library /test/lib
+ * @key gc
+ * @requires vm.gc.Epsilon
  * @summary Basic sanity test for Epsilon
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestEpsilonEnabled
+ * @library /test/lib
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestEpsilonEnabled
  */
 
 import jdk.test.lib.Platform;
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
 
-public class TestEpsilonEnabled extends AbstractEpsilonTest {
+public class TestEpsilonEnabled {
   public static void main(String[] args) throws Exception {
-    if (Platform.isDebugBuild() && !isEpsilonEnabled()) {
+    if (!isEpsilonEnabled()) {
       throw new IllegalStateException("Debug builds should have Epsilon enabled");
     }
-    if (!Platform.isDebugBuild() && !isEpsilonEnabled()) {
-      throw new IllegalStateException("Non-debug builds should have Epsilon enabled");
+  }
+
+  public static boolean isEpsilonEnabled() {
+    for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
+      if (bean.getName().contains("Epsilon")) {
+        return true;
+      }
     }
+    return false;
   }
 }
--- a/test/hotspot/jtreg/gc/epsilon/TestHelloWorld.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestHelloWorld.java	Fri May 11 18:33:36 2018 +0200
@@ -23,12 +23,12 @@
 
 /**
  * @test TestHelloWorld
+ * @key gc
+ * @requires vm.gc.Epsilon
  * @summary Basic sanity test for Epsilon
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestHelloWorld
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestHelloWorld
  */
 
-import java.util.LinkedList;
-
 public class TestHelloWorld {
   public static void main(String[] args) throws Exception {
     System.out.println("Hello World");
--- a/test/hotspot/jtreg/gc/epsilon/TestLogTrace.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestLogTrace.java	Fri May 11 18:33:36 2018 +0200
@@ -23,12 +23,12 @@
 
 /**
  * @test TestLogTrace
- * @summary Basic sanity test for Epsilon
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC -Xlog:gc=trace TestLogTrace
+ * @key gc
+ * @requires vm.gc.Epsilon
+ * @summary Test that tracing does not crash Epsilon
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc*=trace TestLogTrace
  */
 
-import java.util.LinkedList;
-
 public class TestLogTrace {
   public static void main(String[] args) throws Exception {
     System.out.println("Hello World");
--- a/test/hotspot/jtreg/gc/epsilon/TestManyThreads.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestManyThreads.java	Fri May 11 18:33:36 2018 +0200
@@ -23,23 +23,26 @@
 
 /**
  * @test TestManyThreads
+ * @key gc
+ * @requires vm.gc.Epsilon
+ * @summary Test allocations from many threads
  *
- * @run main/othervm -Xmx128m -Xss512k                                        -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestManyThreads
- * @run main/othervm -Xmx128m -Xss512k -Xint                                  -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestManyThreads
- * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp                         -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestManyThreads
- * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestManyThreads
- * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestManyThreads
+ * @run main/othervm -Xmx128m -Xss512k                                        -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestManyThreads
+ * @run main/othervm -Xmx128m -Xss512k -Xint                                  -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestManyThreads
+ * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp                         -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestManyThreads
+ * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestManyThreads
+ * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestManyThreads
  *
- * @run main/othervm -Xmx128m -Xss512k                                        -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestManyThreads
- * @run main/othervm -Xmx128m -Xss512k -Xint                                  -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestManyThreads
- * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp                         -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestManyThreads
- * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestManyThreads
- * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestManyThreads
+ * @run main/othervm -Xmx128m -Xss512k                                        -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestManyThreads
+ * @run main/othervm -Xmx128m -Xss512k -Xint                                  -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestManyThreads
+ * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp                         -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestManyThreads
+ * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestManyThreads
+ * @run main/othervm -Xmx128m -Xss512k -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestManyThreads
  */
 
 import java.util.concurrent.atomic.*;
 
-public class TestManyThreads extends AbstractEpsilonTest {
+public class TestManyThreads {
 
   static int COUNT = Integer.getInteger("count", 128);  // 128 * 4M max tlabs = 512M, would overflow without TLAB sizing
 
@@ -58,8 +61,6 @@
   }
 
   public static void main(String[] args) throws Throwable {
-    if (!isEpsilonEnabled()) return;
-
     for (int c = 0; c < COUNT; c++) {
       Thread t = new Thread(TestManyThreads::workload);
       t.setDaemon(true);
--- a/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestMemoryMXBeans.java	Fri May 11 18:33:36 2018 +0200
@@ -24,24 +24,23 @@
 /**
  * @test TestMemoryMXBeans
  * @key gc
+ * @requires vm.gc.Epsilon
  * @summary Test JMX memory beans
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC          -Xmx1g TestMemoryMXBeans   -1 1024
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC -Xms1g   -Xmx1g TestMemoryMXBeans 1024 1024
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC -Xms128m -Xmx1g TestMemoryMXBeans  128 1024
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC          -Xmx1g TestMemoryMXBeans   -1 1024
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xms1g   -Xmx1g TestMemoryMXBeans 1024 1024
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xms128m -Xmx1g TestMemoryMXBeans  128 1024
  */
 
 import java.lang.management.*;
 import java.util.*;
 
-public class TestMemoryMXBeans extends AbstractEpsilonTest {
+public class TestMemoryMXBeans {
 
     static volatile Object sink;
 
     public static void main(String[] args) throws Exception {
-        if (!isEpsilonEnabled()) return;
-
         if (args.length < 2) {
             throw new IllegalStateException("Should provide expected heap sizes");
         }
--- a/test/hotspot/jtreg/gc/epsilon/TestMemoryPools.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestMemoryPools.java	Fri May 11 18:33:36 2018 +0200
@@ -25,20 +25,19 @@
 /**
  * @test TestMemoryPools
  * @key gc
+ * @requires vm.gc.Epsilon
  * @summary Test JMX memory pools
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC -Xmx1g -Xms1g TestMemoryPools
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xmx1g -Xms1g TestMemoryPools
  */
 
 import java.lang.management.*;
 import java.util.*;
 
-public class TestMemoryPools extends AbstractEpsilonTest {
+public class TestMemoryPools {
 
     public static void main(String[] args) throws Exception {
-        if (!isEpsilonEnabled()) return;
-
         List<MemoryManagerMXBean> mms = ManagementFactory.getMemoryManagerMXBeans();
         if (mms == null) {
             throw new RuntimeException("getMemoryManagerMXBeans is null");
--- a/test/hotspot/jtreg/gc/epsilon/TestObjects.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestObjects.java	Fri May 11 18:33:36 2018 +0200
@@ -23,24 +23,26 @@
 
 /**
  * @test TestObjects
+ * @key gc
+ * @requires vm.gc.Epsilon
  * @summary Epsilon is able to allocate objects, and does not corrupt their state
  *
- * @run main/othervm -Xmx128m                                        -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestObjects
- * @run main/othervm -Xmx128m -Xint                                  -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestObjects
- * @run main/othervm -Xmx128m -Xbatch -Xcomp                         -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestObjects
- * @run main/othervm -Xmx128m -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestObjects
- * @run main/othervm -Xmx128m -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestObjects
+ * @run main/othervm -Xmx128m                                        -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestObjects
+ * @run main/othervm -Xmx128m -Xint                                  -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestObjects
+ * @run main/othervm -Xmx128m -Xbatch -Xcomp                         -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestObjects
+ * @run main/othervm -Xmx128m -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestObjects
+ * @run main/othervm -Xmx128m -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestObjects
  *
- * @run main/othervm -Xmx128m                                        -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestObjects
- * @run main/othervm -Xmx128m -Xint                                  -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestObjects
- * @run main/othervm -Xmx128m -Xbatch -Xcomp                         -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestObjects
- * @run main/othervm -Xmx128m -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestObjects
- * @run main/othervm -Xmx128m -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestObjects
+ * @run main/othervm -Xmx128m                                        -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestObjects
+ * @run main/othervm -Xmx128m -Xint                                  -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestObjects
+ * @run main/othervm -Xmx128m -Xbatch -Xcomp                         -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestObjects
+ * @run main/othervm -Xmx128m -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestObjects
+ * @run main/othervm -Xmx128m -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestObjects
  */
 
 import java.util.Random;
 
-public class TestObjects extends AbstractEpsilonTest {
+public class TestObjects {
 
   static long SEED = Long.getLong("seed", System.nanoTime());
   static int COUNT = Integer.getInteger("count", 1_000_000); // ~24 MB allocation
@@ -48,8 +50,6 @@
   static MyObject[] arr;
 
   public static void main(String[] args) throws Exception {
-    if (!isEpsilonEnabled()) return;
-
     Random r = new Random(SEED);
 
     arr = new MyObject[COUNT];
--- a/test/hotspot/jtreg/gc/epsilon/TestPrintHeapSteps.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestPrintHeapSteps.java	Fri May 11 18:33:36 2018 +0200
@@ -23,9 +23,12 @@
 
 /**
  * @test TestPrintSteps
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapSteps=0    TestPrintHeapSteps
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapSteps=1    TestPrintHeapSteps
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapSteps=1000 TestPrintHeapSteps
+ * @key gc
+ * @requires vm.gc.Epsilon
+ * @summary Tests -XX:EpsilonPrintHeapSteps works
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapStep=0    TestPrintHeapSteps
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapStep=1    TestPrintHeapSteps
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonPrintHeapStep=1000 TestPrintHeapSteps
  */
 
 public class TestPrintHeapSteps {
--- a/test/hotspot/jtreg/gc/epsilon/TestRefArrays.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestRefArrays.java	Fri May 11 18:33:36 2018 +0200
@@ -23,25 +23,27 @@
 
 /**
  * @test TestRefArrays
+ * @key gc
+ * @requires vm.gc.Epsilon
+ * @summary Epsilon is able to allocate arrays, and does not corrupt their state
  * @library /test/lib
- * @summary Epsilon is able to allocate arrays, and does not corrupt their state
  *
- * @run main/othervm -Xmx1g                                        -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestRefArrays
- * @run main/othervm -Xmx1g -Xint                                  -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestRefArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp                         -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestRefArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestRefArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestRefArrays
+ * @run main/othervm -Xmx1g                                        -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestRefArrays
+ * @run main/othervm -Xmx1g -Xint                                  -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestRefArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp                         -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestRefArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestRefArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:+UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestRefArrays
  *
- * @run main/othervm -Xmx1g                                        -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestRefArrays
- * @run main/othervm -Xmx1g -Xint                                  -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestRefArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp                         -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestRefArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestRefArrays
- * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC TestRefArrays
+ * @run main/othervm -Xmx1g                                        -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestRefArrays
+ * @run main/othervm -Xmx1g -Xint                                  -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestRefArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp                         -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestRefArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestRefArrays
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=4 -XX:-UseTLAB -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestRefArrays
  */
 
 import java.util.Random;
 
-public class TestRefArrays extends AbstractEpsilonTest {
+public class TestRefArrays {
 
   static long SEED = Long.getLong("seed", System.nanoTime());
   static int COUNT = Integer.getInteger("count", 1000); // ~500 MB allocation
@@ -49,8 +51,6 @@
   static MyObject[][] arr;
 
   public static void main(String[] args) throws Exception {
-    if (!isEpsilonEnabled()) return;
-
     Random r = new Random(SEED);
 
     arr = new MyObject[COUNT * 100][];
--- a/test/hotspot/jtreg/gc/epsilon/TestUpdateCountersSteps.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/hotspot/jtreg/gc/epsilon/TestUpdateCountersSteps.java	Fri May 11 18:33:36 2018 +0200
@@ -23,10 +23,13 @@
 
 /**
  * @test TestUpdateCountersSteps
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonTestUpdateCountersSteps=1    TestUpdateCountersSteps
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonTestUpdateCountersSteps=10   TestUpdateCountersSteps
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonTestUpdateCountersSteps=100  TestUpdateCountersSteps
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonTestUpdateCountersSteps=1000 TestUpdateCountersSteps
+ * @key gc
+ * @requires vm.gc.Epsilon
+ * @summary Test EpsilonUpdateCountersStep works
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonUpdateCountersStep=1    TestUpdateCountersSteps
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonUpdateCountersStep=10   TestUpdateCountersSteps
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonUpdateCountersStep=100  TestUpdateCountersSteps
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -XX:EpsilonUpdateCountersStep=1000 TestUpdateCountersSteps
  */
 
 public class TestUpdateCountersSteps {
--- a/test/lib/sun/hotspot/gc/GC.java	Mon May 07 16:41:38 2018 +0200
+++ b/test/lib/sun/hotspot/gc/GC.java	Fri May 11 18:33:36 2018 +0200
@@ -36,7 +36,9 @@
     Serial(1),
     Parallel(2),
     ConcMarkSweep(3),
-    G1(4);
+    G1(4),
+    Epsilon(5),
+    ;
 
     private static final WhiteBox WB = WhiteBox.getWhiteBox();