23
24 /* @test TestWrongBarrierDisable
25 * @summary Test that disabling wrong barriers fails early
26 * @key gc
27 * @library /testlibrary
28 * @run main/othervm TestWrongBarrierDisable
29 */
30
31 import java.util.*;
32
33 import com.oracle.java.testlibrary.*;
34
35 public class TestWrongBarrierDisable {
36
37 public static void main(String[] args) throws Exception {
38 String[] concurrent = {
39 "ShenandoahLoadRefBarrier",
40 "ShenandoahCASBarrier",
41 "ShenandoahCloneBarrier",
42 "ShenandoahSATBBarrier",
43 };
44
45 shouldFailAll("-XX:ShenandoahGCHeuristics=adaptive", concurrent);
46 shouldFailAll("-XX:ShenandoahGCHeuristics=static", concurrent);
47 shouldFailAll("-XX:ShenandoahGCHeuristics=compact", concurrent);
48 shouldFailAll("-XX:ShenandoahGCHeuristics=aggressive", concurrent);
49 shouldPassAll("-XX:ShenandoahGCMode=passive", concurrent);
50 }
51
52 private static void shouldFailAll(String h, String[] barriers) throws Exception {
53 for (String b : barriers) {
54 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
55 "-XX:+UnlockDiagnosticVMOptions",
56 "-XX:+UnlockExperimentalVMOptions",
57 "-XX:+UseShenandoahGC",
58 h,
59 "-XX:-" + b,
60 "-version"
61 );
62 OutputAnalyzer output = new OutputAnalyzer(pb.start());
63 output.shouldHaveExitValue(1);
64 output.shouldContain("Heuristics needs ");
65 output.shouldContain("to work correctly");
66 }
67 }
68
69 private static void shouldPassAll(String h, String[] barriers) throws Exception {
|
23
24 /* @test TestWrongBarrierDisable
25 * @summary Test that disabling wrong barriers fails early
26 * @key gc
27 * @library /testlibrary
28 * @run main/othervm TestWrongBarrierDisable
29 */
30
31 import java.util.*;
32
33 import com.oracle.java.testlibrary.*;
34
35 public class TestWrongBarrierDisable {
36
37 public static void main(String[] args) throws Exception {
38 String[] concurrent = {
39 "ShenandoahLoadRefBarrier",
40 "ShenandoahCASBarrier",
41 "ShenandoahCloneBarrier",
42 "ShenandoahSATBBarrier",
43 "ShenandoahKeepAliveBarrier",
44 };
45
46 String[] traversal = {
47 "ShenandoahLoadRefBarrier",
48 "ShenandoahCASBarrier",
49 "ShenandoahCloneBarrier",
50 };
51
52 shouldFailAll("-XX:ShenandoahGCHeuristics=adaptive", concurrent);
53 shouldFailAll("-XX:ShenandoahGCHeuristics=static", concurrent);
54 shouldFailAll("-XX:ShenandoahGCHeuristics=compact", concurrent);
55 shouldFailAll("-XX:ShenandoahGCHeuristics=aggressive", concurrent);
56 shouldFailAll("-XX:ShenandoahGCMode=traversal", traversal);
57 shouldPassAll("-XX:ShenandoahGCMode=passive", concurrent);
58 shouldPassAll("-XX:ShenandoahGCMode=passive", traversal);
59 }
60
61 private static void shouldFailAll(String h, String[] barriers) throws Exception {
62 for (String b : barriers) {
63 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
64 "-XX:+UnlockDiagnosticVMOptions",
65 "-XX:+UnlockExperimentalVMOptions",
66 "-XX:+UseShenandoahGC",
67 h,
68 "-XX:-" + b,
69 "-version"
70 );
71 OutputAnalyzer output = new OutputAnalyzer(pb.start());
72 output.shouldHaveExitValue(1);
73 output.shouldContain("Heuristics needs ");
74 output.shouldContain("to work correctly");
75 }
76 }
77
78 private static void shouldPassAll(String h, String[] barriers) throws Exception {
|