47 output.shouldContain("outside the allowed range")
48 .shouldHaveExitValue(1);
49
50 // Invalid size of -1 should be handled correctly
51 pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=-1",
52 "-version");
53 output = new OutputAnalyzer(pb.start());
54 output.shouldContain("Improperly specified VM option 'CompressedClassSpaceSize=-1'")
55 .shouldHaveExitValue(1);
56
57
58 // Maximum size is 3GB
59 pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=4g",
60 "-version");
61 output = new OutputAnalyzer(pb.start());
62 output.shouldContain("outside the allowed range")
63 .shouldHaveExitValue(1);
64
65
66 // Make sure the minimum size is set correctly and printed
67 pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
68 "-XX:CompressedClassSpaceSize=1m",
69 "-Xlog:gc+metaspace=trace",
70 "-version");
71 output = new OutputAnalyzer(pb.start());
72 output.shouldMatch("Compressed class space.*1048576")
73 .shouldHaveExitValue(0);
74
75
76 // Make sure the maximum size is set correctly and printed
77 pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
78 "-XX:CompressedClassSpaceSize=3g",
79 "-Xlog:gc+metaspace=trace",
80 "-version");
81 output = new OutputAnalyzer(pb.start());
82 output.shouldMatch("Compressed class space.*3221225472")
83 .shouldHaveExitValue(0);
84
85
86 pb = ProcessTools.createJavaProcessBuilder("-XX:-UseCompressedClassPointers",
87 "-XX:CompressedClassSpaceSize=1m",
88 "-version");
89 output = new OutputAnalyzer(pb.start());
90 output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used")
91 .shouldHaveExitValue(0);
92 }
|
47 output.shouldContain("outside the allowed range")
48 .shouldHaveExitValue(1);
49
50 // Invalid size of -1 should be handled correctly
51 pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=-1",
52 "-version");
53 output = new OutputAnalyzer(pb.start());
54 output.shouldContain("Improperly specified VM option 'CompressedClassSpaceSize=-1'")
55 .shouldHaveExitValue(1);
56
57
58 // Maximum size is 3GB
59 pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=4g",
60 "-version");
61 output = new OutputAnalyzer(pb.start());
62 output.shouldContain("outside the allowed range")
63 .shouldHaveExitValue(1);
64
65
66 // Make sure the minimum size is set correctly and printed
67 // (Note: ccs size shall be rounded up to the minimum size of 4m since metaspace reservations
68 // are done in a 4m granularity. Note that this is **reserved** size and does not affect rss.
69 pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
70 "-XX:CompressedClassSpaceSize=1m",
71 "-Xlog:gc+metaspace=trace",
72 "-version");
73 output = new OutputAnalyzer(pb.start());
74 output.shouldMatch("Compressed class space.*4194304")
75 .shouldHaveExitValue(0);
76
77
78 // Make sure the maximum size is set correctly and printed
79 pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions",
80 "-XX:CompressedClassSpaceSize=3g",
81 "-Xlog:gc+metaspace=trace",
82 "-version");
83 output = new OutputAnalyzer(pb.start());
84 output.shouldMatch("Compressed class space.*3221225472")
85 .shouldHaveExitValue(0);
86
87
88 pb = ProcessTools.createJavaProcessBuilder("-XX:-UseCompressedClassPointers",
89 "-XX:CompressedClassSpaceSize=1m",
90 "-version");
91 output = new OutputAnalyzer(pb.start());
92 output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used")
93 .shouldHaveExitValue(0);
94 }
|