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 TestThreadCounts
33 */
34
35 import jdk.test.lib.process.ProcessTools;
36 import jdk.test.lib.process.OutputAnalyzer;
37
38 public class TestThreadCounts {
39 public static void main(String[] args) throws Exception {
40 for (int conc = 0; conc < 16; conc++) {
41 for (int par = 0; par < 16; par++) {
42 testWith(conc, par);
43 }
44 }
45 }
46
47 private static void testWith(int conc, int par) throws Exception {
48 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
49 "-XX:+UnlockExperimentalVMOptions",
50 "-XX:+UseShenandoahGC",
51 "-XX:ConcGCThreads=" + conc,
52 "-XX:ParallelGCThreads=" + par,
53 "-version");
54 OutputAnalyzer output = new OutputAnalyzer(pb.start());
55
56 if (conc == 0) {
57 output.shouldContain("Shenandoah expects ConcGCThreads > 0");
58 output.shouldHaveExitValue(1);
59 } else if (par == 0) {
60 output.shouldContain("Shenandoah expects ParallelGCThreads > 0");
61 output.shouldHaveExitValue(1);
62 } else if (conc > par) {
63 output.shouldContain("Shenandoah expects ConcGCThreads <= ParallelGCThreads");
64 output.shouldHaveExitValue(1);
65 } else {
66 output.shouldNotContain("Shenandoah expects ConcGCThreads <= ParallelGCThreads");
67 output.shouldHaveExitValue(0);
68 }
|
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 TestThreadCounts
33 */
34
35 import jdk.test.lib.process.ProcessTools;
36 import jdk.test.lib.process.OutputAnalyzer;
37
38 public class TestThreadCounts {
39 public static void main(String[] args) throws Exception {
40 for (int conc = 0; conc < 16; conc++) {
41 for (int par = 0; par < 16; par++) {
42 testWith(conc, par);
43 }
44 }
45 }
46
47 private static void testWith(int conc, int par) throws Exception {
48 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
49 "-Xmx128m",
50 "-XX:+UnlockDiagnosticVMOptions",
51 "-XX:+UnlockExperimentalVMOptions",
52 "-XX:+UseShenandoahGC",
53 "-XX:ConcGCThreads=" + conc,
54 "-XX:ParallelGCThreads=" + par,
55 "-version");
56 OutputAnalyzer output = new OutputAnalyzer(pb.start());
57
58 if (conc == 0) {
59 output.shouldContain("Shenandoah expects ConcGCThreads > 0");
60 output.shouldHaveExitValue(1);
61 } else if (par == 0) {
62 output.shouldContain("Shenandoah expects ParallelGCThreads > 0");
63 output.shouldHaveExitValue(1);
64 } else if (conc > par) {
65 output.shouldContain("Shenandoah expects ConcGCThreads <= ParallelGCThreads");
66 output.shouldHaveExitValue(1);
67 } else {
68 output.shouldNotContain("Shenandoah expects ConcGCThreads <= ParallelGCThreads");
69 output.shouldHaveExitValue(0);
70 }
|