< prev index next >

test/gc/g1/TestGCLogMessages.java

Print this page
rev 7563 : 8067941: [TESTBUG] Fix tests for OS with 64K page size.


  87                                                GCTest.class.getName());
  88 
  89     output = new OutputAnalyzer(pb.start());
  90 
  91     output.shouldContain("[Redirty Cards");
  92     output.shouldContain("[Parallel Redirty");
  93     output.shouldContain("[Redirtied Cards");
  94     output.shouldContain("[Code Root Purge");
  95     output.shouldContain("[String Dedup Fixup");
  96     output.shouldContain("[Young Free CSet");
  97     output.shouldContain("[Non-Young Free CSet");
  98     output.shouldContain("[Humongous Reclaim");
  99     output.shouldContain("[Humongous Total");
 100     output.shouldContain("[Humongous Candidate");
 101     output.shouldContain("[Humongous Reclaimed");
 102     output.shouldHaveExitValue(0);
 103   }
 104 
 105   private static void testWithToSpaceExhaustionLogs() throws Exception {
 106     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
 107                                                "-Xmx10M",
 108                                                "-Xmn5M",
 109                                                "-XX:+PrintGCDetails",
 110                                                GCTestWithToSpaceExhaustion.class.getName());
 111 
 112     OutputAnalyzer output = new OutputAnalyzer(pb.start());
 113     output.shouldContain("[Evacuation Failure");
 114     output.shouldNotContain("[Recalculate Used");
 115     output.shouldNotContain("[Remove Self Forwards");
 116     output.shouldNotContain("[Restore RemSet");
 117     output.shouldHaveExitValue(0);
 118 
 119     pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
 120                                                "-Xmx10M",
 121                                                "-Xmn5M",
 122                                                "-XX:+PrintGCDetails",
 123                                                "-XX:+UnlockExperimentalVMOptions",
 124                                                "-XX:G1LogLevel=finest",
 125                                                GCTestWithToSpaceExhaustion.class.getName());
 126 
 127     output = new OutputAnalyzer(pb.start());
 128     output.shouldContain("[Evacuation Failure");
 129     output.shouldContain("[Recalculate Used");
 130     output.shouldContain("[Remove Self Forwards");
 131     output.shouldContain("[Restore RemSet");
 132     output.shouldHaveExitValue(0);
 133   }
 134 
 135   static class GCTest {
 136     private static byte[] garbage;
 137     public static void main(String [] args) {
 138       System.out.println("Creating garbage");
 139       // create 128MB of garbage. This should result in at least one GC
 140       for (int i = 0; i < 1024; i++) {
 141         garbage = new byte[128 * 1024];
 142       }
 143       System.out.println("Done");
 144     }
 145   }
 146 
 147   static class GCTestWithToSpaceExhaustion {
 148     private static byte[] garbage;
 149     private static byte[] largeObject;
 150     public static void main(String [] args) {
 151       largeObject = new byte[5*1024*1024];
 152       System.out.println("Creating garbage");
 153       // create 128MB of garbage. This should result in at least one GC,
 154       // some of them with to-space exhaustion.
 155       for (int i = 0; i < 1024; i++) {
 156         garbage = new byte[128 * 1024];
 157       }
 158       System.out.println("Done");
 159     }
 160   }
 161 }


  87                                                GCTest.class.getName());
  88 
  89     output = new OutputAnalyzer(pb.start());
  90 
  91     output.shouldContain("[Redirty Cards");
  92     output.shouldContain("[Parallel Redirty");
  93     output.shouldContain("[Redirtied Cards");
  94     output.shouldContain("[Code Root Purge");
  95     output.shouldContain("[String Dedup Fixup");
  96     output.shouldContain("[Young Free CSet");
  97     output.shouldContain("[Non-Young Free CSet");
  98     output.shouldContain("[Humongous Reclaim");
  99     output.shouldContain("[Humongous Total");
 100     output.shouldContain("[Humongous Candidate");
 101     output.shouldContain("[Humongous Reclaimed");
 102     output.shouldHaveExitValue(0);
 103   }
 104 
 105   private static void testWithToSpaceExhaustionLogs() throws Exception {
 106     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
 107                                                "-Xmx32M",
 108                                                "-Xmn16M",
 109                                                "-XX:+PrintGCDetails",
 110                                                GCTestWithToSpaceExhaustion.class.getName());
 111 
 112     OutputAnalyzer output = new OutputAnalyzer(pb.start());
 113     output.shouldContain("[Evacuation Failure");
 114     output.shouldNotContain("[Recalculate Used");
 115     output.shouldNotContain("[Remove Self Forwards");
 116     output.shouldNotContain("[Restore RemSet");
 117     output.shouldHaveExitValue(0);
 118 
 119     pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
 120                                                "-Xmx32M",
 121                                                "-Xmn16M",
 122                                                "-XX:+PrintGCDetails",
 123                                                "-XX:+UnlockExperimentalVMOptions",
 124                                                "-XX:G1LogLevel=finest",
 125                                                GCTestWithToSpaceExhaustion.class.getName());
 126 
 127     output = new OutputAnalyzer(pb.start());
 128     output.shouldContain("[Evacuation Failure");
 129     output.shouldContain("[Recalculate Used");
 130     output.shouldContain("[Remove Self Forwards");
 131     output.shouldContain("[Restore RemSet");
 132     output.shouldHaveExitValue(0);
 133   }
 134 
 135   static class GCTest {
 136     private static byte[] garbage;
 137     public static void main(String [] args) {
 138       System.out.println("Creating garbage");
 139       // create 128MB of garbage. This should result in at least one GC
 140       for (int i = 0; i < 1024; i++) {
 141         garbage = new byte[128 * 1024];
 142       }
 143       System.out.println("Done");
 144     }
 145   }
 146 
 147   static class GCTestWithToSpaceExhaustion {
 148     private static byte[] garbage;
 149     private static byte[] largeObject;
 150     public static void main(String [] args) {
 151       largeObject = new byte[16*1024*1024];
 152       System.out.println("Creating garbage");
 153       // create 128MB of garbage. This should result in at least one GC,
 154       // some of them with to-space exhaustion.
 155       for (int i = 0; i < 1024; i++) {
 156         garbage = new byte[128 * 1024];
 157       }
 158       System.out.println("Done");
 159     }
 160   }
 161 }
< prev index next >