< prev index next >

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

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


  45         };
  46         String[] iu = {
  47                 "ShenandoahLoadRefBarrier",
  48                 "ShenandoahStoreValEnqueueBarrier",
  49                 "ShenandoahCASBarrier",
  50                 "ShenandoahCloneBarrier",
  51         };
  52 
  53         shouldFailAll("-XX:ShenandoahGCHeuristics=adaptive",   concurrent);
  54         shouldFailAll("-XX:ShenandoahGCHeuristics=static",     concurrent);
  55         shouldFailAll("-XX:ShenandoahGCHeuristics=compact",    concurrent);
  56         shouldFailAll("-XX:ShenandoahGCHeuristics=aggressive", concurrent);
  57         shouldFailAll("-XX:ShenandoahGCMode=iu",               iu);
  58         shouldPassAll("-XX:ShenandoahGCMode=passive",          concurrent);
  59         shouldPassAll("-XX:ShenandoahGCMode=passive",          iu);
  60     }
  61 
  62     private static void shouldFailAll(String h, String[] barriers) throws Exception {
  63         for (String b : barriers) {
  64             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(

  65                     "-XX:+UnlockDiagnosticVMOptions",
  66                     "-XX:+UnlockExperimentalVMOptions",
  67                     "-XX:+UseShenandoahGC",
  68                     h,
  69                     "-XX:-" + b,
  70                     "-version"
  71             );
  72             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  73             output.shouldNotHaveExitValue(0);
  74             output.shouldContain("GC mode needs ");
  75             output.shouldContain("to work correctly");
  76         }
  77     }
  78 
  79     private static void shouldPassAll(String h, String[] barriers) throws Exception {
  80         for (String b : barriers) {
  81             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(

  82                     "-XX:+UnlockDiagnosticVMOptions",
  83                     "-XX:+UnlockExperimentalVMOptions",
  84                     "-XX:+UseShenandoahGC",
  85                     h,
  86                     "-XX:-" + b,
  87                     "-version"
  88             );
  89             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  90             output.shouldHaveExitValue(0);
  91         }
  92     }
  93 
  94 }


  45         };
  46         String[] iu = {
  47                 "ShenandoahLoadRefBarrier",
  48                 "ShenandoahStoreValEnqueueBarrier",
  49                 "ShenandoahCASBarrier",
  50                 "ShenandoahCloneBarrier",
  51         };
  52 
  53         shouldFailAll("-XX:ShenandoahGCHeuristics=adaptive",   concurrent);
  54         shouldFailAll("-XX:ShenandoahGCHeuristics=static",     concurrent);
  55         shouldFailAll("-XX:ShenandoahGCHeuristics=compact",    concurrent);
  56         shouldFailAll("-XX:ShenandoahGCHeuristics=aggressive", concurrent);
  57         shouldFailAll("-XX:ShenandoahGCMode=iu",               iu);
  58         shouldPassAll("-XX:ShenandoahGCMode=passive",          concurrent);
  59         shouldPassAll("-XX:ShenandoahGCMode=passive",          iu);
  60     }
  61 
  62     private static void shouldFailAll(String h, String[] barriers) throws Exception {
  63         for (String b : barriers) {
  64             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  65                     "-Xmx128m",
  66                     "-XX:+UnlockDiagnosticVMOptions",
  67                     "-XX:+UnlockExperimentalVMOptions",
  68                     "-XX:+UseShenandoahGC",
  69                     h,
  70                     "-XX:-" + b,
  71                     "-version"
  72             );
  73             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  74             output.shouldNotHaveExitValue(0);
  75             output.shouldContain("GC mode needs ");
  76             output.shouldContain("to work correctly");
  77         }
  78     }
  79 
  80     private static void shouldPassAll(String h, String[] barriers) throws Exception {
  81         for (String b : barriers) {
  82             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  83                     "-Xmx128m",
  84                     "-XX:+UnlockDiagnosticVMOptions",
  85                     "-XX:+UnlockExperimentalVMOptions",
  86                     "-XX:+UseShenandoahGC",
  87                     h,
  88                     "-XX:-" + b,
  89                     "-version"
  90             );
  91             OutputAnalyzer output = new OutputAnalyzer(pb.start());
  92             output.shouldHaveExitValue(0);
  93         }
  94     }
  95 
  96 }
< prev index next >