8253877: gc/g1/TestGCLogMessages.java fails - missing "Evacuation failure" message
Reviewed-by: sjohanss
This commit is contained in:
parent
e76de18956
commit
cd66e0f25f
@ -39,6 +39,7 @@ package gc.g1;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import jdk.test.lib.process.OutputAnalyzer;
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
import jdk.test.lib.process.ProcessTools;
|
import jdk.test.lib.process.ProcessTools;
|
||||||
import sun.hotspot.code.Compiler;
|
import sun.hotspot.code.Compiler;
|
||||||
|
|
||||||
@ -182,7 +183,9 @@ public class TestGCLogMessages {
|
|||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
new TestGCLogMessages().testNormalLogs();
|
new TestGCLogMessages().testNormalLogs();
|
||||||
new TestGCLogMessages().testConcurrentRefinementLogs();
|
new TestGCLogMessages().testConcurrentRefinementLogs();
|
||||||
new TestGCLogMessages().testWithToSpaceExhaustionLogs();
|
if (Platform.isDebugBuild()) {
|
||||||
|
new TestGCLogMessages().testWithEvacuationFailureLogs();
|
||||||
|
}
|
||||||
new TestGCLogMessages().testWithConcurrentStart();
|
new TestGCLogMessages().testWithConcurrentStart();
|
||||||
new TestGCLogMessages().testExpandHeap();
|
new TestGCLogMessages().testExpandHeap();
|
||||||
}
|
}
|
||||||
@ -240,12 +243,15 @@ public class TestGCLogMessages {
|
|||||||
new LogMessageWithLevel("Remove Self Forwards", Level.TRACE),
|
new LogMessageWithLevel("Remove Self Forwards", Level.TRACE),
|
||||||
};
|
};
|
||||||
|
|
||||||
private void testWithToSpaceExhaustionLogs() throws Exception {
|
private void testWithEvacuationFailureLogs() throws Exception {
|
||||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
|
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
|
||||||
"-Xmx32M",
|
"-Xmx32M",
|
||||||
"-Xmn16M",
|
"-Xmn16M",
|
||||||
|
"-XX:+G1EvacuationFailureALot",
|
||||||
|
"-XX:G1EvacuationFailureALotCount=100",
|
||||||
|
"-XX:G1EvacuationFailureALotInterval=1",
|
||||||
"-Xlog:gc+phases=debug",
|
"-Xlog:gc+phases=debug",
|
||||||
GCTestWithToSpaceExhaustion.class.getName());
|
GCTestWithEvacuationFailure.class.getName());
|
||||||
|
|
||||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
checkMessagesAtLevel(output, exhFailureMessages, Level.DEBUG);
|
checkMessagesAtLevel(output, exhFailureMessages, Level.DEBUG);
|
||||||
@ -255,7 +261,7 @@ public class TestGCLogMessages {
|
|||||||
"-Xmx32M",
|
"-Xmx32M",
|
||||||
"-Xmn16M",
|
"-Xmn16M",
|
||||||
"-Xlog:gc+phases=trace",
|
"-Xlog:gc+phases=trace",
|
||||||
GCTestWithToSpaceExhaustion.class.getName());
|
GCTestWithEvacuationFailure.class.getName());
|
||||||
|
|
||||||
output = new OutputAnalyzer(pb.start());
|
output = new OutputAnalyzer(pb.start());
|
||||||
checkMessagesAtLevel(output, exhFailureMessages, Level.TRACE);
|
checkMessagesAtLevel(output, exhFailureMessages, Level.TRACE);
|
||||||
@ -304,16 +310,19 @@ public class TestGCLogMessages {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class GCTestWithToSpaceExhaustion {
|
static class GCTestWithEvacuationFailure {
|
||||||
private static byte[] garbage;
|
private static byte[] garbage;
|
||||||
private static byte[] largeObject;
|
private static byte[] largeObject;
|
||||||
|
private static Object[] holder = new Object[200]; // Must be larger than G1EvacuationFailureALotCount
|
||||||
|
|
||||||
public static void main(String [] args) {
|
public static void main(String [] args) {
|
||||||
largeObject = new byte[16*1024*1024];
|
largeObject = new byte[16*1024*1024];
|
||||||
System.out.println("Creating garbage");
|
System.out.println("Creating garbage");
|
||||||
// create 128MB of garbage. This should result in at least one GC,
|
// Create 16 MB of garbage. This should result in at least one GC,
|
||||||
// some of them with to-space exhaustion.
|
// (Heap size is 32M, we use 17MB for the large object above)
|
||||||
for (int i = 0; i < 1024; i++) {
|
// which is larger than G1EvacuationFailureALotInterval.
|
||||||
garbage = new byte[128 * 1024];
|
for (int i = 0; i < 16 * 1024; i++) {
|
||||||
|
holder[i % holder.length] = new byte[1024];
|
||||||
}
|
}
|
||||||
System.out.println("Done");
|
System.out.println("Done");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user