< prev index next >

test/hotspot/jtreg/gc/shenandoah/options/TestHumongousThresholdArgs.java

Print this page
rev 59823 : 8247751: Shenandoah: options tests should run with smaller heaps
Reviewed-by: XXX


  21  * questions.
  22  *
  23  */
  24 
  25 /*
  26  * @test TestHumongousThresholdArgs
  27  * @summary Test that Shenandoah humongous threshold args are checked
  28  * @requires vm.gc.Shenandoah & !vm.graal.enabled
  29  * @library /test/lib
  30  * @modules java.base/jdk.internal.misc
  31  *          java.management
  32  * @run driver TestHumongousThresholdArgs
  33  */
  34 
  35 import jdk.test.lib.process.ProcessTools;
  36 import jdk.test.lib.process.OutputAnalyzer;
  37 
  38 public class TestHumongousThresholdArgs {
  39     public static void main(String[] args) throws Exception {
  40         {
  41             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",


  42                     "-XX:+UseShenandoahGC",
  43                     "-version");
  44             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  45             output.shouldHaveExitValue(0);
  46         }
  47 
  48         int[] valid = new int[] {1, 10, 50, 90, 100};
  49         int[] invalid = new int[] {-100, -1, 0, 101, 1000};
  50 
  51         for (int v : valid) {
  52             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",


  53                     "-XX:+UseShenandoahGC",
  54                     "-XX:ShenandoahHumongousThreshold=" + v,
  55                     "-version");
  56             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  57             output.shouldHaveExitValue(0);
  58         }
  59 
  60         for (int v : invalid) {
  61             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",


  62                     "-XX:+UseShenandoahGC",
  63                     "-XX:ShenandoahHumongousThreshold=" + v,
  64                     "-version");
  65             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  66             output.shouldHaveExitValue(1);
  67         }
  68     }
  69 }


  21  * questions.
  22  *
  23  */
  24 
  25 /*
  26  * @test TestHumongousThresholdArgs
  27  * @summary Test that Shenandoah humongous threshold args are checked
  28  * @requires vm.gc.Shenandoah & !vm.graal.enabled
  29  * @library /test/lib
  30  * @modules java.base/jdk.internal.misc
  31  *          java.management
  32  * @run driver TestHumongousThresholdArgs
  33  */
  34 
  35 import jdk.test.lib.process.ProcessTools;
  36 import jdk.test.lib.process.OutputAnalyzer;
  37 
  38 public class TestHumongousThresholdArgs {
  39     public static void main(String[] args) throws Exception {
  40         {
  41             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  42                     "-Xmx128m",
  43                     "-XX:+UnlockExperimentalVMOptions",
  44                     "-XX:+UseShenandoahGC",
  45                     "-version");
  46             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  47             output.shouldHaveExitValue(0);
  48         }
  49 
  50         int[] valid = new int[] {1, 10, 50, 90, 100};
  51         int[] invalid = new int[] {-100, -1, 0, 101, 1000};
  52 
  53         for (int v : valid) {
  54             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  55                     "-Xmx128m",
  56                     "-XX:+UnlockExperimentalVMOptions",
  57                     "-XX:+UseShenandoahGC",
  58                     "-XX:ShenandoahHumongousThreshold=" + v,
  59                     "-version");
  60             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  61             output.shouldHaveExitValue(0);
  62         }
  63 
  64         for (int v : invalid) {
  65             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  66                     "-Xmx128m",
  67                     "-XX:+UnlockExperimentalVMOptions",
  68                     "-XX:+UseShenandoahGC",
  69                     "-XX:ShenandoahHumongousThreshold=" + v,
  70                     "-version");
  71             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  72             output.shouldHaveExitValue(1);
  73         }
  74     }
  75 }
< prev index next >