author | tschatzl |
Wed, 19 Aug 2015 13:47:40 +0200 | |
changeset 32377 | 5ee15c417d02 |
parent 31371 | 311143309e73 |
child 35061 | be6025ebffea |
permissions | -rw-r--r-- |
26688
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
1 |
/* |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
26688
diff
changeset
|
2 |
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
26688
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
4 |
* |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
8 |
* |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
13 |
* accompanied this code). |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
14 |
* |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
18 |
* |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
21 |
* questions. |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
22 |
*/ |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
23 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
24 |
/* |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
25 |
* @test |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
26 |
* @bug 8022865 |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
27 |
* @summary Tests for the -XX:CompressedClassSpaceSize command line option |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
28 |
* @library /testlibrary |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
26688
diff
changeset
|
29 |
* @modules java.base/sun.misc |
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
26688
diff
changeset
|
30 |
* java.management |
26688
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
31 |
* @run main CompressedClassSpaceSize |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
32 |
*/ |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
29678
diff
changeset
|
33 |
import jdk.test.lib.*; |
26688
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
34 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
35 |
public class CompressedClassSpaceSize { |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
36 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
37 |
public static void main(String[] args) throws Exception { |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
38 |
ProcessBuilder pb; |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
39 |
OutputAnalyzer output; |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
40 |
if (Platform.is64bit()) { |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
41 |
// Minimum size is 1MB |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
42 |
pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=0", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
43 |
"-version"); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
44 |
output = new OutputAnalyzer(pb.start()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
30604
diff
changeset
|
45 |
output.shouldContain("outside the allowed range") |
26688
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
46 |
.shouldHaveExitValue(1); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
47 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
48 |
// Invalid size of -1 should be handled correctly |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
49 |
pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=-1", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
50 |
"-version"); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
51 |
output = new OutputAnalyzer(pb.start()); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
52 |
output.shouldContain("Improperly specified VM option 'CompressedClassSpaceSize=-1'") |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
53 |
.shouldHaveExitValue(1); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
54 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
55 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
56 |
// Maximum size is 3GB |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
57 |
pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=4g", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
58 |
"-version"); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
59 |
output = new OutputAnalyzer(pb.start()); |
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
30604
diff
changeset
|
60 |
output.shouldContain("outside the allowed range") |
26688
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
61 |
.shouldHaveExitValue(1); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
62 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
63 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
64 |
// Make sure the minimum size is set correctly and printed |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
65 |
pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
66 |
"-XX:CompressedClassSpaceSize=1m", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
67 |
"-XX:+PrintCompressedOopsMode", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
68 |
"-version"); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
69 |
output = new OutputAnalyzer(pb.start()); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
70 |
output.shouldContain("Compressed class space size: 1048576") |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
71 |
.shouldHaveExitValue(0); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
72 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
73 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
74 |
// Make sure the maximum size is set correctly and printed |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
75 |
pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockDiagnosticVMOptions", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
76 |
"-XX:CompressedClassSpaceSize=3g", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
77 |
"-XX:+PrintCompressedOopsMode", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
78 |
"-version"); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
79 |
output = new OutputAnalyzer(pb.start()); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
80 |
output.shouldContain("Compressed class space size: 3221225472") |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
81 |
.shouldHaveExitValue(0); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
82 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
83 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
84 |
pb = ProcessTools.createJavaProcessBuilder("-XX:-UseCompressedOops", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
85 |
"-XX:CompressedClassSpaceSize=1m", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
86 |
"-version"); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
87 |
output = new OutputAnalyzer(pb.start()); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
88 |
output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used") |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
89 |
.shouldHaveExitValue(0); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
90 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
91 |
|
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
92 |
pb = ProcessTools.createJavaProcessBuilder("-XX:-UseCompressedClassPointers", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
93 |
"-XX:CompressedClassSpaceSize=1m", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
94 |
"-version"); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
95 |
output = new OutputAnalyzer(pb.start()); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
96 |
output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used") |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
97 |
.shouldHaveExitValue(0); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
98 |
} else { |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
99 |
// 32bit platforms doesn't have compressed oops |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
100 |
pb = ProcessTools.createJavaProcessBuilder("-XX:CompressedClassSpaceSize=1m", |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
101 |
"-version"); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
102 |
output = new OutputAnalyzer(pb.start()); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
103 |
output.shouldContain("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used") |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
104 |
.shouldHaveExitValue(0); |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
105 |
} |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
106 |
} |
bb0cdd873e51
8022865: [TESTBUG] Compressed Oops testing needs to be revised
ctornqvi
parents:
diff
changeset
|
107 |
} |