< prev index next >

test/gc/g1/TestGCLogMessages.java

Print this page
rev 12847 : 8166191: Missing spaces in log message during heap expansion
Reviewed-by: tschatzl
Contributed-by: chihiro.ito@oracle.com

*** 21,31 **** * questions. */ /* * @test TestGCLogMessages ! * @bug 8035406 8027295 8035398 8019342 8027959 8048179 8027962 8069330 8076463 8150630 8160055 8177059 * @summary Ensure the output for a minor GC with G1 * includes the expected necessary messages. * @key gc * @requires vm.gc.G1 * @library /test/lib --- 21,31 ---- * questions. */ /* * @test TestGCLogMessages ! * @bug 8035406 8027295 8035398 8019342 8027959 8048179 8027962 8069330 8076463 8150630 8160055 8177059 8166191 * @summary Ensure the output for a minor GC with G1 * includes the expected necessary messages. * @key gc * @requires vm.gc.G1 * @library /test/lib
*** 150,159 **** --- 150,160 ---- public static void main(String[] args) throws Exception { new TestGCLogMessages().testNormalLogs(); new TestGCLogMessages().testWithToSpaceExhaustionLogs(); new TestGCLogMessages().testWithInitialMark(); + new TestGCLogMessages().testExpandHeap(); } private void testNormalLogs() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
*** 225,234 **** --- 226,251 ---- OutputAnalyzer output = new OutputAnalyzer(pb.start()); output.shouldContain("Clear Claimed Marks"); output.shouldHaveExitValue(0); } + private void testExpandHeap() throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", + "-Xmx10M", + "-Xbootclasspath/a:.", + "-Xlog:gc+ergo+heap=debug", + "-XX:+UnlockDiagnosticVMOptions", + "-XX:+WhiteBoxAPI", + GCTest.class.getName()); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("Expand the heap. requested expansion amount: "); + output.shouldContain("B expansion amount: "); + output.shouldHaveExitValue(0); + } + + static class GCTest { private static byte[] garbage; public static void main(String [] args) { System.out.println("Creating garbage"); // create 128MB of garbage. This should result in at least one GC
< prev index next >