22 *
23 */
24
25 /*
26 * @test TestArgumentRanges
27 * @summary Test that Shenandoah arguments are checked for ranges where applicable
28 * @key gc
29 * @requires vm.gc.Shenandoah & !vm.graal.enabled
30 * @library /test/lib
31 * @modules java.base/jdk.internal.misc
32 * java.management
33 * @run driver TestArgumentRanges
34 */
35
36 import jdk.test.lib.process.ProcessTools;
37 import jdk.test.lib.process.OutputAnalyzer;
38
39 public class TestArgumentRanges {
40 public static void main(String[] args) throws Exception {
41 testRange("ShenandoahGarbageThreshold", 0, 100);
42 testRange("ShenandoahFreeThreshold", 0, 100);
43 testRange("ShenandoahAllocationThreshold", 0, 100);
44 testHeuristics();
45 }
46
47 private static void testHeuristics() throws Exception {
48
49 {
50 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
51 "-XX:+UnlockExperimentalVMOptions",
52 "-XX:+UseShenandoahGC",
53 "-XX:ShenandoahGCHeuristics=aggressive",
54 "-version");
55 OutputAnalyzer output = new OutputAnalyzer(pb.start());
56 output.shouldHaveExitValue(0);
57 }
58 {
59 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
60 "-XX:+UnlockExperimentalVMOptions",
61 "-XX:+UseShenandoahGC",
62 "-XX:ShenandoahGCHeuristics=static",
|
22 *
23 */
24
25 /*
26 * @test TestArgumentRanges
27 * @summary Test that Shenandoah arguments are checked for ranges where applicable
28 * @key gc
29 * @requires vm.gc.Shenandoah & !vm.graal.enabled
30 * @library /test/lib
31 * @modules java.base/jdk.internal.misc
32 * java.management
33 * @run driver TestArgumentRanges
34 */
35
36 import jdk.test.lib.process.ProcessTools;
37 import jdk.test.lib.process.OutputAnalyzer;
38
39 public class TestArgumentRanges {
40 public static void main(String[] args) throws Exception {
41 testRange("ShenandoahGarbageThreshold", 0, 100);
42 testRange("ShenandoahMinFreeThreshold", 0, 100);
43 testRange("ShenandoahAllocationThreshold", 0, 100);
44 testHeuristics();
45 }
46
47 private static void testHeuristics() throws Exception {
48
49 {
50 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
51 "-XX:+UnlockExperimentalVMOptions",
52 "-XX:+UseShenandoahGC",
53 "-XX:ShenandoahGCHeuristics=aggressive",
54 "-version");
55 OutputAnalyzer output = new OutputAnalyzer(pb.start());
56 output.shouldHaveExitValue(0);
57 }
58 {
59 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
60 "-XX:+UnlockExperimentalVMOptions",
61 "-XX:+UseShenandoahGC",
62 "-XX:ShenandoahGCHeuristics=static",
|