author | iignatyev |
Mon, 18 Nov 2019 14:13:11 -0800 | |
changeset 59129 | d8eddc0ba770 |
parent 57705 | 7cf02b2c1455 |
permissions | -rw-r--r-- |
52811 | 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. |
52811 | 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 |
|
27 |
* @summary Test how CDS dumping handles the existence of humongous G1 regions. |
|
57567
b000362a89a0
8202339: [TESTBUG] Consolidate the tests in runtime/SharedArchiveFile and runtime/appcds
coleenp
parents:
52811
diff
changeset
|
28 |
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds /test/hotspot/jtreg/runtime/cds/appcds/test-classes |
52811 | 29 |
* @requires vm.cds.archived.java.heap |
30 |
* @requires vm.flavor != "minimal" |
|
59129
d8eddc0ba770
8234304: runtime/cds/appcds/javaldr tests should use driver mode
iignatyev
parents:
57705
diff
changeset
|
31 |
* @run driver/timeout=240 HumongousDuringDump |
52811 | 32 |
*/ |
33 |
||
34 |
import jdk.test.lib.cds.CDSOptions; |
|
35 |
import jdk.test.lib.process.OutputAnalyzer; |
|
36 |
import jdk.test.lib.process.ProcessTools; |
|
37 |
||
38 |
public class HumongousDuringDump { |
|
39 |
public static String appClasses[] = { |
|
59129
d8eddc0ba770
8234304: runtime/cds/appcds/javaldr tests should use driver mode
iignatyev
parents:
57705
diff
changeset
|
40 |
Hello.class.getName(), |
52811 | 41 |
}; |
42 |
public static String agentClasses[] = { |
|
59129
d8eddc0ba770
8234304: runtime/cds/appcds/javaldr tests should use driver mode
iignatyev
parents:
57705
diff
changeset
|
43 |
HumongousDuringDumpTransformer.class.getName(), |
52811 | 44 |
}; |
45 |
||
46 |
public static void main(String[] args) throws Throwable { |
|
47 |
String agentJar = |
|
48 |
ClassFileInstaller.writeJar("HumongousDuringDumpTransformer.jar", |
|
49 |
ClassFileInstaller.Manifest.fromSourceFile("HumongousDuringDumpTransformer.mf"), |
|
50 |
agentClasses); |
|
51 |
||
52 |
String appJar = |
|
53 |
ClassFileInstaller.writeJar("HumongousDuringDumpApp.jar", appClasses); |
|
54 |
||
55 |
String gcLog = Boolean.getBoolean("test.cds.verbose.gc") ? |
|
56 |
"-Xlog:gc*=info,gc+region=trace,gc+alloc+region=debug" : "-showversion"; |
|
57 |
||
58 |
String extraArg = "-javaagent:" + agentJar; |
|
59 |
String extraOption = "-XX:+AllowArchivingWithJavaAgent"; |
|
60 |
||
61 |
OutputAnalyzer out = |
|
59129
d8eddc0ba770
8234304: runtime/cds/appcds/javaldr tests should use driver mode
iignatyev
parents:
57705
diff
changeset
|
62 |
TestCommon.testDump(appJar, TestCommon.list(Hello.class.getName()), |
52811 | 63 |
"-XX:+UnlockDiagnosticVMOptions", extraOption, |
64 |
"-Xlog:gc+region+cds", |
|
65 |
"-Xlog:gc+region=trace", |
|
66 |
extraArg, "-Xmx64m", gcLog); |
|
67 |
out.shouldContain("(Unmovable) humongous regions have been found and may lead to fragmentation"); |
|
68 |
out.shouldContain("All free regions should be at the top end of the heap, but we found holes."); |
|
69 |
out.shouldMatch("gc,region,cds. HeapRegion .* HUM. hole"); |
|
70 |
String pattern = "gc,region,cds. HeapRegion .*hole"; |
|
71 |
out.shouldMatch(pattern); |
|
72 |
out.shouldNotMatch(pattern + ".*unexpected"); |
|
73 |
||
74 |
TestCommon.run( |
|
75 |
"-cp", appJar, |
|
76 |
"-verbose", |
|
77 |
"-Xmx64m", |
|
78 |
"-XX:+PrintSharedSpaces", |
|
79 |
"-XX:+UnlockDiagnosticVMOptions", extraOption, |
|
80 |
gcLog, |
|
59129
d8eddc0ba770
8234304: runtime/cds/appcds/javaldr tests should use driver mode
iignatyev
parents:
57705
diff
changeset
|
81 |
Hello.class.getName()) |
52811 | 82 |
.assertNormalExit(); |
83 |
} |
|
84 |
} |
|
85 |