author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 57705 | 7cf02b2c1455 |
permissions | -rw-r--r-- |
51388 | 1 |
/* |
57567
b000362a89a0
8202339: [TESTBUG] Consolidate the tests in runtime/SharedArchiveFile and runtime/appcds
coleenp
parents:
52811
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
51388 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
/* |
|
26 |
* @test |
|
52626 | 27 |
* @summary Test primitive box caches integrity in various scenarios (IntegerCache etc) |
51388 | 28 |
* @requires vm.cds.archived.java.heap |
57567
b000362a89a0
8202339: [TESTBUG] Consolidate the tests in runtime/SharedArchiveFile and runtime/appcds
coleenp
parents:
52811
diff
changeset
|
29 |
* @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/cds/appcds |
51388 | 30 |
* @build sun.hotspot.WhiteBox |
31 |
* @compile CheckIntegerCacheApp.java |
|
52626 | 32 |
* @run driver ClassFileInstaller -jar boxCache.jar CheckIntegerCacheApp |
51388 | 33 |
* @run driver ClassFileInstaller -jar WhiteBox.jar sun.hotspot.WhiteBox |
51990
6003e034cdd8
8209946: [TESTBUG] CDS tests should use "@run driver"
iklam
parents:
51425
diff
changeset
|
34 |
* @run driver ArchivedIntegerCacheTest |
51388 | 35 |
*/ |
36 |
||
37 |
import java.nio.file.Files; |
|
38 |
import java.nio.file.Path; |
|
39 |
import java.nio.file.Paths; |
|
40 |
import jdk.test.lib.process.OutputAnalyzer; |
|
41 |
||
42 |
public class ArchivedIntegerCacheTest { |
|
43 |
||
44 |
public static void main(String[] args) throws Exception { |
|
45 |
String wbJar = ClassFileInstaller.getJarPath("WhiteBox.jar"); |
|
46 |
String use_whitebox_jar = "-Xbootclasspath/a:" + wbJar; |
|
52626 | 47 |
String appJar = ClassFileInstaller.getJarPath("boxCache.jar"); |
51388 | 48 |
|
49 |
Path userDir = Paths.get(System.getProperty("user.dir")); |
|
50 |
Path moduleDir = Files.createTempDirectory(userDir, "mods"); |
|
51 |
||
52 |
// |
|
53 |
// Dump default archive |
|
54 |
// |
|
55 |
OutputAnalyzer output = TestCommon.dump(appJar, |
|
56 |
TestCommon.list("CheckIntegerCacheApp"), |
|
57 |
use_whitebox_jar); |
|
58 |
TestCommon.checkDump(output); |
|
59 |
||
60 |
// Test case 1) |
|
61 |
// - Default options |
|
62 |
System.out.println("----------------------- Test case 1 ----------------------"); |
|
63 |
output = TestCommon.exec(appJar, use_whitebox_jar, |
|
64 |
"-XX:+UnlockDiagnosticVMOptions", |
|
65 |
"-XX:+WhiteBoxAPI", |
|
66 |
"CheckIntegerCacheApp", |
|
67 |
"127", |
|
68 |
"true"); |
|
69 |
TestCommon.checkExec(output); |
|
70 |
||
71 |
// Test case 2) |
|
72 |
// - Default archive |
|
73 |
// - Larger -XX:AutoBoxCacheMax |
|
74 |
System.out.println("----------------------- Test case 2 ----------------------"); |
|
75 |
output = TestCommon.exec(appJar, use_whitebox_jar, |
|
76 |
"-XX:+UnlockDiagnosticVMOptions", |
|
77 |
"-XX:+WhiteBoxAPI", |
|
78 |
"-XX:AutoBoxCacheMax=20000", |
|
79 |
"CheckIntegerCacheApp", |
|
80 |
"20000", |
|
81 |
"false"); |
|
82 |
TestCommon.checkExec(output); |
|
83 |
||
84 |
// |
|
85 |
// Dump with -XX:AutoBoxCacheMax specified |
|
86 |
// |
|
87 |
output = TestCommon.dump(appJar, |
|
88 |
TestCommon.list("CheckIntegerCacheApp"), |
|
89 |
"-XX:AutoBoxCacheMax=20000", |
|
90 |
use_whitebox_jar); |
|
91 |
TestCommon.checkDump(output); |
|
92 |
||
93 |
// Test case 3) |
|
94 |
// - Large archived cache |
|
95 |
// - Default options |
|
96 |
System.out.println("----------------------- Test case 3 ----------------------"); |
|
97 |
output = TestCommon.exec(appJar, use_whitebox_jar, |
|
98 |
"--module-path", |
|
99 |
moduleDir.toString(), |
|
100 |
"-XX:+UnlockDiagnosticVMOptions", |
|
101 |
"-XX:+WhiteBoxAPI", |
|
102 |
"CheckIntegerCacheApp", |
|
103 |
"127", |
|
104 |
"true"); |
|
105 |
TestCommon.checkExec(output); |
|
106 |
||
107 |
||
108 |
// Test case 4) |
|
109 |
// - Large archived cache |
|
110 |
// - Matching options |
|
111 |
System.out.println("----------------------- Test case 4 ----------------------"); |
|
112 |
output = TestCommon.exec(appJar, use_whitebox_jar, |
|
113 |
"--module-path", |
|
114 |
moduleDir.toString(), |
|
115 |
"-XX:+UnlockDiagnosticVMOptions", |
|
116 |
"-XX:+WhiteBoxAPI", |
|
117 |
"-XX:AutoBoxCacheMax=20000", |
|
118 |
"CheckIntegerCacheApp", |
|
119 |
"20000", |
|
120 |
"true"); |
|
121 |
TestCommon.checkExec(output); |
|
122 |
||
123 |
// Test case 5) |
|
124 |
// - Large archived cache |
|
125 |
// - Larger requested cache |
|
126 |
System.out.println("----------------------- Test case 5 ----------------------"); |
|
127 |
output = TestCommon.exec(appJar, use_whitebox_jar, |
|
128 |
"--module-path", |
|
129 |
moduleDir.toString(), |
|
130 |
"-XX:+UnlockDiagnosticVMOptions", |
|
131 |
"-XX:+WhiteBoxAPI", |
|
132 |
"-XX:AutoBoxCacheMax=30000", |
|
133 |
"CheckIntegerCacheApp", |
|
134 |
"30000", |
|
135 |
"false"); |
|
136 |
TestCommon.checkExec(output); |
|
51425
4e9667589c43
8209389: SIGSEGV in WalkOopAndArchiveClosure::do_oop_work.
jiangli
parents:
51388
diff
changeset
|
137 |
|
4e9667589c43
8209389: SIGSEGV in WalkOopAndArchiveClosure::do_oop_work.
jiangli
parents:
51388
diff
changeset
|
138 |
// Test case 6) |
4e9667589c43
8209389: SIGSEGV in WalkOopAndArchiveClosure::do_oop_work.
jiangli
parents:
51388
diff
changeset
|
139 |
// - Cache is too large to archive |
4e9667589c43
8209389: SIGSEGV in WalkOopAndArchiveClosure::do_oop_work.
jiangli
parents:
51388
diff
changeset
|
140 |
output = TestCommon.dump(appJar, |
4e9667589c43
8209389: SIGSEGV in WalkOopAndArchiveClosure::do_oop_work.
jiangli
parents:
51388
diff
changeset
|
141 |
TestCommon.list("CheckIntegerCacheApp"), |
4e9667589c43
8209389: SIGSEGV in WalkOopAndArchiveClosure::do_oop_work.
jiangli
parents:
51388
diff
changeset
|
142 |
"-XX:AutoBoxCacheMax=2000000", |
4e9667589c43
8209389: SIGSEGV in WalkOopAndArchiveClosure::do_oop_work.
jiangli
parents:
51388
diff
changeset
|
143 |
"-Xmx1g", |
4e9667589c43
8209389: SIGSEGV in WalkOopAndArchiveClosure::do_oop_work.
jiangli
parents:
51388
diff
changeset
|
144 |
"-XX:NewSize=1g", |
4e9667589c43
8209389: SIGSEGV in WalkOopAndArchiveClosure::do_oop_work.
jiangli
parents:
51388
diff
changeset
|
145 |
"-Xlog:cds+heap=info", |
52811
ff04b71bf6f1
8214388: CDS dumping fails with java heap fragmentation
iklam
parents:
52626
diff
changeset
|
146 |
"-Xlog:gc+region+cds", |
ff04b71bf6f1
8214388: CDS dumping fails with java heap fragmentation
iklam
parents:
52626
diff
changeset
|
147 |
"-Xlog:gc+region=trace", |
51425
4e9667589c43
8209389: SIGSEGV in WalkOopAndArchiveClosure::do_oop_work.
jiangli
parents:
51388
diff
changeset
|
148 |
use_whitebox_jar); |
4e9667589c43
8209389: SIGSEGV in WalkOopAndArchiveClosure::do_oop_work.
jiangli
parents:
51388
diff
changeset
|
149 |
TestCommon.checkDump(output, |
52811
ff04b71bf6f1
8214388: CDS dumping fails with java heap fragmentation
iklam
parents:
52626
diff
changeset
|
150 |
"Cannot archive the sub-graph referenced from [Ljava.lang.Integer; object", |
ff04b71bf6f1
8214388: CDS dumping fails with java heap fragmentation
iklam
parents:
52626
diff
changeset
|
151 |
"humongous regions have been found and may lead to fragmentation"); |
51388 | 152 |
} |
153 |
} |