< prev index next >

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

Print this page
rev 59451 : 8245478: Implementation: JEP 379: Shenandoah: A Low-Pause-Time Garbage Collector (Production)
Reviewed-by: XXX


  35 
  36 import jdk.test.lib.process.ProcessTools;
  37 import jdk.test.lib.process.OutputAnalyzer;
  38 
  39 public class TestHeuristicsUnlock {
  40 
  41     enum Mode {
  42         PRODUCT,
  43         DIAGNOSTIC,
  44         EXPERIMENTAL,
  45     }
  46 
  47     public static void main(String[] args) throws Exception {
  48         testWith("-XX:ShenandoahGCHeuristics=adaptive",   Mode.PRODUCT);
  49         testWith("-XX:ShenandoahGCHeuristics=static",     Mode.PRODUCT);
  50         testWith("-XX:ShenandoahGCHeuristics=compact",    Mode.PRODUCT);
  51         testWith("-XX:ShenandoahGCHeuristics=aggressive", Mode.DIAGNOSTIC);
  52     }
  53 
  54     private static void testWith(String h, Mode mode) throws Exception {
  55         if (false) { // When ShenandoahGC is experimental flag, this makes no sense to test
  56             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  57                     "-XX:-UnlockDiagnosticVMOptions",
  58                     "-XX:-UnlockExperimentalVMOptions",
  59                     "-XX:+UseShenandoahGC",
  60                     h,
  61                     "-version"
  62             );
  63             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  64             switch (mode) {
  65                 case PRODUCT:
  66                     output.shouldHaveExitValue(0);
  67                     break;
  68                 case DIAGNOSTIC:
  69                 case EXPERIMENTAL:
  70                     output.shouldNotHaveExitValue(0);
  71                     break;
  72             }
  73         }
  74 
  75         if (false) { // When ShenandoahGC is experimental flag, this makes no sense to test
  76             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  77                     "-XX:+UnlockDiagnosticVMOptions",
  78                     "-XX:-UnlockExperimentalVMOptions",
  79                     "-XX:+UseShenandoahGC",
  80                     h,
  81                     "-version"
  82             );
  83             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  84             switch (mode) {
  85                 case PRODUCT:
  86                 case DIAGNOSTIC:
  87                     output.shouldHaveExitValue(0);
  88                     break;
  89                 case EXPERIMENTAL:
  90                     output.shouldNotHaveExitValue(0);
  91                     break;
  92             }
  93         }
  94 
  95         {




  35 
  36 import jdk.test.lib.process.ProcessTools;
  37 import jdk.test.lib.process.OutputAnalyzer;
  38 
  39 public class TestHeuristicsUnlock {
  40 
  41     enum Mode {
  42         PRODUCT,
  43         DIAGNOSTIC,
  44         EXPERIMENTAL,
  45     }
  46 
  47     public static void main(String[] args) throws Exception {
  48         testWith("-XX:ShenandoahGCHeuristics=adaptive",   Mode.PRODUCT);
  49         testWith("-XX:ShenandoahGCHeuristics=static",     Mode.PRODUCT);
  50         testWith("-XX:ShenandoahGCHeuristics=compact",    Mode.PRODUCT);
  51         testWith("-XX:ShenandoahGCHeuristics=aggressive", Mode.DIAGNOSTIC);
  52     }
  53 
  54     private static void testWith(String h, Mode mode) throws Exception {
  55         {
  56             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  57                     "-XX:-UnlockDiagnosticVMOptions",
  58                     "-XX:-UnlockExperimentalVMOptions",
  59                     "-XX:+UseShenandoahGC",
  60                     h,
  61                     "-version"
  62             );
  63             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  64             switch (mode) {
  65                 case PRODUCT:
  66                     output.shouldHaveExitValue(0);
  67                     break;
  68                 case DIAGNOSTIC:
  69                 case EXPERIMENTAL:
  70                     output.shouldNotHaveExitValue(0);
  71                     break;
  72             }
  73         }
  74 
  75         {
  76             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  77                     "-XX:+UnlockDiagnosticVMOptions",
  78                     "-XX:-UnlockExperimentalVMOptions",
  79                     "-XX:+UseShenandoahGC",
  80                     h,
  81                     "-version"
  82             );
  83             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  84             switch (mode) {
  85                 case PRODUCT:
  86                 case DIAGNOSTIC:
  87                     output.shouldHaveExitValue(0);
  88                     break;
  89                 case EXPERIMENTAL:
  90                     output.shouldNotHaveExitValue(0);
  91                     break;
  92             }
  93         }
  94 
  95         {


< prev index next >