< prev index next >

test/hotspot/jtreg/gc/arguments/TestDisableDefaultGC.java

Print this page




  26  * @summary Test that the VM complains when the default GC is disabled and no other GC is specified
  27  * @bug 8068579
  28  * @key gc
  29  * @library /test/lib
  30  * @requires vm.gc=="null"
  31  * @modules java.base/jdk.internal.misc
  32  *          java.management
  33  * @run driver TestDisableDefaultGC
  34  */
  35 
  36 import jdk.test.lib.process.ProcessTools;
  37 import jdk.test.lib.process.OutputAnalyzer;
  38 
  39 public class TestDisableDefaultGC {
  40     public static void main(String[] args) throws Exception {
  41         // Start VM, disabling all possible default GCs
  42         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseSerialGC",
  43                                                                   "-XX:-UseParallelGC",
  44                                                                   "-XX:-UseG1GC",
  45                                                                   "-XX:-UseConcMarkSweepGC",


  46                                                                   "-version");
  47         OutputAnalyzer output = new OutputAnalyzer(pb.start());
  48         output.shouldMatch("Garbage collector not selected");
  49         output.shouldHaveExitValue(1);
  50     }
  51 }


  26  * @summary Test that the VM complains when the default GC is disabled and no other GC is specified
  27  * @bug 8068579
  28  * @key gc
  29  * @library /test/lib
  30  * @requires vm.gc=="null"
  31  * @modules java.base/jdk.internal.misc
  32  *          java.management
  33  * @run driver TestDisableDefaultGC
  34  */
  35 
  36 import jdk.test.lib.process.ProcessTools;
  37 import jdk.test.lib.process.OutputAnalyzer;
  38 
  39 public class TestDisableDefaultGC {
  40     public static void main(String[] args) throws Exception {
  41         // Start VM, disabling all possible default GCs
  42         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseSerialGC",
  43                                                                   "-XX:-UseParallelGC",
  44                                                                   "-XX:-UseG1GC",
  45                                                                   "-XX:-UseConcMarkSweepGC",
  46                                                                   "-XX:+UnlockExperimentalVMOptions",
  47                                                                   "-XX:-UseZGC",
  48                                                                   "-version");
  49         OutputAnalyzer output = new OutputAnalyzer(pb.start());
  50         output.shouldMatch("Garbage collector not selected");
  51         output.shouldHaveExitValue(1);
  52     }
  53 }
< prev index next >