30 * @modules java.base/jdk.internal.misc
31 * java.management
32 */
33
34 import jdk.test.lib.cds.CDSTestUtils;
35 import jdk.test.lib.process.OutputAnalyzer;
36
37 public class SharedSymbolTableBucketSize {
38 public static void main(String[] args) throws Exception {
39 int bucket_size = 8;
40
41 OutputAnalyzer output =
42 CDSTestUtils.createArchiveAndCheck("-XX:SharedSymbolTableBucketSize="
43 + Integer.valueOf(bucket_size));
44 CDSTestUtils.checkMappingFailure(output);
45
46 String regex = "Average bucket size : ([0-9]+\\.[0-9]+).*";
47 String s = output.firstMatch(regex, 1);
48 Float f = Float.parseFloat(s);
49 int size = Math.round(f);
50 if (size != bucket_size) {
51 throw new Exception("FAILED: incorrect bucket size " + size +
52 ", expect " + bucket_size);
53 }
54
55 // Invalid SharedSymbolTableBucketSize input
56 String input[] = {"-XX:SharedSymbolTableBucketSize=-1",
57 "-XX:SharedSymbolTableBucketSize=2.5"};
58 for (int i = 0; i < input.length; i++) {
59 CDSTestUtils.createArchive(input[i])
60 .shouldContain("Improperly specified VM option")
61 .shouldHaveExitValue(1);
62 }
63 }
64 }
|
30 * @modules java.base/jdk.internal.misc
31 * java.management
32 */
33
34 import jdk.test.lib.cds.CDSTestUtils;
35 import jdk.test.lib.process.OutputAnalyzer;
36
37 public class SharedSymbolTableBucketSize {
38 public static void main(String[] args) throws Exception {
39 int bucket_size = 8;
40
41 OutputAnalyzer output =
42 CDSTestUtils.createArchiveAndCheck("-XX:SharedSymbolTableBucketSize="
43 + Integer.valueOf(bucket_size));
44 CDSTestUtils.checkMappingFailure(output);
45
46 String regex = "Average bucket size : ([0-9]+\\.[0-9]+).*";
47 String s = output.firstMatch(regex, 1);
48 Float f = Float.parseFloat(s);
49 int size = Math.round(f);
50 if (size != bucket_size && size != bucket_size + 1) {
51 throw new Exception("FAILED: incorrect bucket size " + size +
52 ", expect " + bucket_size + ", or " + (bucket_size + 1));
53 }
54
55 // Invalid SharedSymbolTableBucketSize input
56 String input[] = {"-XX:SharedSymbolTableBucketSize=-1",
57 "-XX:SharedSymbolTableBucketSize=2.5"};
58 for (int i = 0; i < input.length; i++) {
59 CDSTestUtils.createArchive(input[i])
60 .shouldContain("Improperly specified VM option")
61 .shouldHaveExitValue(1);
62 }
63 }
64 }
|