Mon, 21 Jul 2014 09:40:19 +0200
8026847: [TESTBUG] gc/g1/TestSummarizeRSetStats* tests launch 32bit jvm with UseCompressedOops
Summary: The test launched a 32 bit VM with UseCompressedOops enabled. This is not supported on 32 bit VMs, causing a test failure. Investigation showed that the use of this flag is not required at all, so simply remove it.
Reviewed-by: tschatzl, jwilhelm
Contributed-by: Andrey Zakharov <andrey.x.zakharov@oracle.com>
1 /*
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
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 */
24 /*
25 * @test TestPrintGCDetails
26 * @bug 8035406 8027295 8035398 8019342
27 * @summary Ensure that the PrintGCDetails output for a minor GC with G1
28 * includes the expected necessary messages.
29 * @key gc
30 * @library /testlibrary
31 */
33 import com.oracle.java.testlibrary.ProcessTools;
34 import com.oracle.java.testlibrary.OutputAnalyzer;
36 public class TestGCLogMessages {
37 public static void main(String[] args) throws Exception {
38 testNormalLogs();
39 testWithToSpaceExhaustionLogs();
40 }
42 private static void testNormalLogs() throws Exception {
44 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
45 "-Xmx10M",
46 GCTest.class.getName());
48 OutputAnalyzer output = new OutputAnalyzer(pb.start());
50 output.shouldNotContain("[Redirty Cards");
51 output.shouldNotContain("[Parallel Redirty");
52 output.shouldNotContain("[Redirtied Cards");
53 output.shouldNotContain("[Code Root Purge");
54 output.shouldNotContain("[String Dedup Fixup");
55 output.shouldNotContain("[Young Free CSet");
56 output.shouldNotContain("[Non-Young Free CSet");
57 output.shouldHaveExitValue(0);
59 pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
60 "-XX:+UseStringDeduplication",
61 "-Xmx10M",
62 "-XX:+PrintGCDetails",
63 GCTest.class.getName());
65 output = new OutputAnalyzer(pb.start());
67 output.shouldContain("[Redirty Cards");
68 output.shouldNotContain("[Parallel Redirty");
69 output.shouldNotContain("[Redirtied Cards");
70 output.shouldContain("[Code Root Purge");
71 output.shouldContain("[String Dedup Fixup");
72 output.shouldNotContain("[Young Free CSet");
73 output.shouldNotContain("[Non-Young Free CSet");
74 output.shouldHaveExitValue(0);
76 pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
77 "-XX:+UseStringDeduplication",
78 "-Xmx10M",
79 "-XX:+PrintGCDetails",
80 "-XX:+UnlockExperimentalVMOptions",
81 "-XX:G1LogLevel=finest",
82 GCTest.class.getName());
84 output = new OutputAnalyzer(pb.start());
86 output.shouldContain("[Redirty Cards");
87 output.shouldContain("[Parallel Redirty");
88 output.shouldContain("[Redirtied Cards");
89 output.shouldContain("[Code Root Purge");
90 output.shouldContain("[String Dedup Fixup");
91 output.shouldContain("[Young Free CSet");
92 output.shouldContain("[Non-Young Free CSet");
94 // also check evacuation failure messages once
95 output.shouldNotContain("[Evacuation Failure");
96 output.shouldNotContain("[Recalculate Used");
97 output.shouldNotContain("[Remove Self Forwards");
98 output.shouldNotContain("[Restore RemSet");
99 output.shouldHaveExitValue(0);
100 }
102 private static void testWithToSpaceExhaustionLogs() throws Exception {
103 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
104 "-Xmx10M",
105 "-Xmn5M",
106 "-XX:+PrintGCDetails",
107 GCTestWithToSpaceExhaustion.class.getName());
109 OutputAnalyzer output = new OutputAnalyzer(pb.start());
110 output.shouldContain("[Evacuation Failure");
111 output.shouldNotContain("[Recalculate Used");
112 output.shouldNotContain("[Remove Self Forwards");
113 output.shouldNotContain("[Restore RemSet");
114 output.shouldHaveExitValue(0);
116 pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
117 "-Xmx10M",
118 "-Xmn5M",
119 "-XX:+PrintGCDetails",
120 "-XX:+UnlockExperimentalVMOptions",
121 "-XX:G1LogLevel=finest",
122 GCTestWithToSpaceExhaustion.class.getName());
124 output = new OutputAnalyzer(pb.start());
125 output.shouldContain("[Evacuation Failure");
126 output.shouldContain("[Recalculate Used");
127 output.shouldContain("[Remove Self Forwards");
128 output.shouldContain("[Restore RemSet");
129 output.shouldHaveExitValue(0);
130 }
132 static class GCTest {
133 private static byte[] garbage;
134 public static void main(String [] args) {
135 System.out.println("Creating garbage");
136 // create 128MB of garbage. This should result in at least one GC
137 for (int i = 0; i < 1024; i++) {
138 garbage = new byte[128 * 1024];
139 }
140 System.out.println("Done");
141 }
142 }
144 static class GCTestWithToSpaceExhaustion {
145 private static byte[] garbage;
146 private static byte[] largeObject;
147 public static void main(String [] args) {
148 largeObject = new byte[5*1024*1024];
149 System.out.println("Creating garbage");
150 // create 128MB of garbage. This should result in at least one GC,
151 // some of them with to-space exhaustion.
152 for (int i = 0; i < 1024; i++) {
153 garbage = new byte[128 * 1024];
154 }
155 System.out.println("Done");
156 }
157 }
158 }