< prev index next >

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

Print this page

 35 import jdk.test.lib.process.OutputAnalyzer;
 36 
 37 public class TestWrongBarrierDisable {
 38 
 39     public static void main(String[] args) throws Exception {
 40         String[] concurrent = {
 41                 "ShenandoahLoadRefBarrier",
 42                 "ShenandoahSATBBarrier",
 43                 "ShenandoahCASBarrier",
 44                 "ShenandoahCloneBarrier",
 45                 "ShenandoahStackWatermarkBarrier",
 46         };
 47         String[] iu = {
 48                 "ShenandoahLoadRefBarrier",
 49                 "ShenandoahIUBarrier",
 50                 "ShenandoahCASBarrier",
 51                 "ShenandoahCloneBarrier",
 52                 "ShenandoahStackWatermarkBarrier",
 53         };
 54 




 55         shouldFailAll("-XX:ShenandoahGCHeuristics=adaptive",   concurrent);
 56         shouldFailAll("-XX:ShenandoahGCHeuristics=static",     concurrent);
 57         shouldFailAll("-XX:ShenandoahGCHeuristics=compact",    concurrent);
 58         shouldFailAll("-XX:ShenandoahGCHeuristics=aggressive", concurrent);
 59         shouldFailAll("-XX:ShenandoahGCMode=iu",               iu);
 60         shouldPassAll("-XX:ShenandoahGCMode=passive",          concurrent);
 61         shouldPassAll("-XX:ShenandoahGCMode=passive",          iu);



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

 35 import jdk.test.lib.process.OutputAnalyzer;
 36 
 37 public class TestWrongBarrierDisable {
 38 
 39     public static void main(String[] args) throws Exception {
 40         String[] concurrent = {
 41                 "ShenandoahLoadRefBarrier",
 42                 "ShenandoahSATBBarrier",
 43                 "ShenandoahCASBarrier",
 44                 "ShenandoahCloneBarrier",
 45                 "ShenandoahStackWatermarkBarrier",
 46         };
 47         String[] iu = {
 48                 "ShenandoahLoadRefBarrier",
 49                 "ShenandoahIUBarrier",
 50                 "ShenandoahCASBarrier",
 51                 "ShenandoahCloneBarrier",
 52                 "ShenandoahStackWatermarkBarrier",
 53         };
 54 
 55         String[] generational = {
 56                 "ShenandoahCardBarrier"
 57         };
 58 
 59         shouldFailAll("-XX:ShenandoahGCHeuristics=adaptive",   concurrent);
 60         shouldFailAll("-XX:ShenandoahGCHeuristics=static",     concurrent);
 61         shouldFailAll("-XX:ShenandoahGCHeuristics=compact",    concurrent);
 62         shouldFailAll("-XX:ShenandoahGCHeuristics=aggressive", concurrent);
 63         shouldFailAll("-XX:ShenandoahGCMode=iu",               iu);
 64         shouldPassAll("-XX:ShenandoahGCMode=passive",          concurrent);
 65         shouldPassAll("-XX:ShenandoahGCMode=passive",          iu);
 66         shouldPassAll("-XX:ShenandoahGCMode=passive",          generational);
 67         shouldPassAll("-XX:ShenandoahGCMode=satb",             generational);
 68         shouldFailAll("-XX:ShenandoahGCMode=generational",     generational);
 69     }
 70 
 71     private static void shouldFailAll(String h, String[] barriers) throws Exception {
 72         for (String b : barriers) {
 73             OutputAnalyzer output = ProcessTools.executeLimitedTestJava(
 74                     "-Xmx128m",
 75                     "-XX:+UnlockDiagnosticVMOptions",
 76                     "-XX:+UnlockExperimentalVMOptions",
 77                     "-XX:+UseShenandoahGC",
 78                     h,
 79                     "-XX:-" + b,
 80                     "-version"
 81             );
 82             output.shouldNotHaveExitValue(0);
 83             output.shouldContain("GC mode needs ");
 84             output.shouldContain("to work correctly");
 85         }
 86     }
 87 
 88     private static void shouldPassAll(String h, String[] barriers) throws Exception {
< prev index next >