changeset 12962:82e8b5c2c090

8166191: Missing spaces in log message during heap expansion Reviewed-by: tschatzl Contributed-by: chihiro.ito@oracle.com
author tschatzl
date Fri, 12 May 2017 11:38:20 +0200
parents 47f9461b6374
children 1b85fd69802b
files src/share/vm/gc/g1/g1CollectedHeap.cpp test/gc/g1/TestGCLogMessages.java
diffstat 2 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc/g1/g1CollectedHeap.cpp	Thu May 11 23:41:57 2017 -0400
+++ b/src/share/vm/gc/g1/g1CollectedHeap.cpp	Fri May 12 11:38:20 2017 +0200
@@ -1612,7 +1612,7 @@
   aligned_expand_bytes = align_size_up(aligned_expand_bytes,
                                        HeapRegion::GrainBytes);
 
-  log_debug(gc, ergo, heap)("Expand the heap. requested expansion amount:" SIZE_FORMAT "B expansion amount:" SIZE_FORMAT "B",
+  log_debug(gc, ergo, heap)("Expand the heap. requested expansion amount: " SIZE_FORMAT "B expansion amount: " SIZE_FORMAT "B",
                             expand_bytes, aligned_expand_bytes);
 
   if (is_maximal_no_gc()) {
--- a/test/gc/g1/TestGCLogMessages.java	Thu May 11 23:41:57 2017 -0400
+++ b/test/gc/g1/TestGCLogMessages.java	Fri May 12 11:38:20 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test TestGCLogMessages
- * @bug 8035406 8027295 8035398 8019342 8027959 8048179 8027962 8069330 8076463 8150630 8160055 8177059
+ * @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
@@ -152,6 +152,7 @@
         new TestGCLogMessages().testNormalLogs();
         new TestGCLogMessages().testWithToSpaceExhaustionLogs();
         new TestGCLogMessages().testWithInitialMark();
+        new TestGCLogMessages().testExpandHeap();
     }
 
     private void testNormalLogs() throws Exception {
@@ -227,6 +228,22 @@
         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) {