< prev index next >

test/hotspot/jtreg/gc/g1/TestVerifyGCType.java

Print this page
rev 48019 : 8191821: Finer granularity for GC verification
Reviewed-by:
rev 48020 : [mq]: 8191821-rev-sang-poonam

@@ -43,47 +43,67 @@
     public static final String  VERIFY_BEFORE = "Verifying Before GC";
     public static final String  VERIFY_DURING = "Verifying During GC";
     public static final String  VERIFY_AFTER  = "Verifying After GC";
 
     public static void main(String args[]) throws Exception {
+        testAllVerificationEnabled();
+        testAllExplicitlyEnabled();
+        testFullAndRemark();
+        testBadVerificationType();
+        testUnsupportedCollector();
+    }
+
+    private static void testAllVerificationEnabled() throws Exception {
         // Test with all verification enabled
         OutputAnalyzer output = testWithVerificationType(new String[0]);
         output.shouldHaveExitValue(0);
 
         verifyCollection("Pause Young", true, false, true, output.getStdout());
         verifyCollection("Pause Remark", false, true, false, output.getStdout());
         verifyCollection("Pause Cleanup", false, true, false, output.getStdout());
         verifyCollection("Pause Full", true, true, true, output.getStdout());
+    }
 
+    private static void testAllExplicitlyEnabled() throws Exception {
+        OutputAnalyzer output;
         // Test with all explicitly enabled
         output = testWithVerificationType(new String[] {"young", "remark", "cleanup", "full"});
         output.shouldHaveExitValue(0);
 
         verifyCollection("Pause Young", true, false, true, output.getStdout());
         verifyCollection("Pause Remark", false, true, false, output.getStdout());
         verifyCollection("Pause Cleanup", false, true, false, output.getStdout());
         verifyCollection("Pause Full", true, true, true, output.getStdout());
+    }
 
+    private static void testFullAndRemark() throws Exception {
+        OutputAnalyzer output;
         // Test with full and remark
         output = testWithVerificationType(new String[] {"remark", "full"});
         output.shouldHaveExitValue(0);
 
         verifyCollection("Pause Young", false, false, false, output.getStdout());
         verifyCollection("Pause Remark", false, true, false, output.getStdout());
         verifyCollection("Pause Cleanup", false, false, false, output.getStdout());
         verifyCollection("Pause Full", true, true, true, output.getStdout());
+    }
 
+    private static void testBadVerificationType() throws Exception {
+        OutputAnalyzer output;
         // Test bad type
         output = testWithVerificationType(new String[] {"old"});
         output.shouldHaveExitValue(0);
 
-        output.shouldMatch("VerifyGCType: '.*' is unknown. Available are: young, mixed, remark, cleanup and full ");
+        output.shouldMatch("VerifyGCType: '.*' is unknown. Available types are: young, mixed, remark, cleanup and full");
         verifyCollection("Pause Young", true, false, true, output.getStdout());
         verifyCollection("Pause Remark", false, true, false, output.getStdout());
         verifyCollection("Pause Cleanup", false, true, false, output.getStdout());
         verifyCollection("Pause Full", true, true, true, output.getStdout());
+    }
 
+    private static void testUnsupportedCollector() throws Exception {
+        OutputAnalyzer output;
         // Test bad gc
         output = testWithBadGC();
         output.shouldHaveExitValue(0);
         output.shouldMatch("VerifyGCType is not supported by this collector.");
     }
< prev index next >