< prev index next >

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

Print this page
rev 53988 : imported patch 8219100-cleanup-young-collection-prologue


 157         ProcessBuilder procBuilder =  ProcessTools.createJavaProcessBuilder(basicOpts.toArray(
 158                                                                             new String[basicOpts.size()]));
 159         OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start());
 160         return analyzer;
 161     }
 162 
 163     private static void verifyCollection(String name, boolean expectBefore, boolean expectDuring, boolean expectAfter, String data) {
 164         CollectionInfo ci = CollectionInfo.parseFirst(name, data);
 165         Asserts.assertTrue(ci != null, "Expected GC not found: " + name + "\n" + data);
 166 
 167         // Verify Before
 168         verifyType(ci, expectBefore, VERIFY_BEFORE);
 169         // Verify During
 170         verifyType(ci, expectDuring, VERIFY_DURING);
 171         // Verify After
 172         verifyType(ci, expectAfter, VERIFY_AFTER);
 173     }
 174 
 175     private static void verifyType(CollectionInfo ci, boolean shouldExist, String pattern) {
 176         if (shouldExist) {
 177             Asserts.assertTrue(ci.containsVerification(pattern), "Missing expected verification for: " + ci.getName());
 178         } else {
 179             Asserts.assertFalse(ci.containsVerification(pattern), "Found unexpected verification for: " + ci.getName());
 180         }
 181     }
 182 
 183     public static class CollectionInfo {
 184         String name;
 185         ArrayList<String> verification;
 186         public CollectionInfo(String name) {
 187             this.name = name;
 188             this.verification = new ArrayList<>();
 189             System.out.println("Created CollectionInfo: " + name);
 190         }
 191 
 192         public String getName() {
 193             return name;
 194         }
 195 
 196         public void addVerification(String verify) {
 197             System.out.println("Adding: " + verify);
 198             verification.add(verify);
 199         }




 157         ProcessBuilder procBuilder =  ProcessTools.createJavaProcessBuilder(basicOpts.toArray(
 158                                                                             new String[basicOpts.size()]));
 159         OutputAnalyzer analyzer = new OutputAnalyzer(procBuilder.start());
 160         return analyzer;
 161     }
 162 
 163     private static void verifyCollection(String name, boolean expectBefore, boolean expectDuring, boolean expectAfter, String data) {
 164         CollectionInfo ci = CollectionInfo.parseFirst(name, data);
 165         Asserts.assertTrue(ci != null, "Expected GC not found: " + name + "\n" + data);
 166 
 167         // Verify Before
 168         verifyType(ci, expectBefore, VERIFY_BEFORE);
 169         // Verify During
 170         verifyType(ci, expectDuring, VERIFY_DURING);
 171         // Verify After
 172         verifyType(ci, expectAfter, VERIFY_AFTER);
 173     }
 174 
 175     private static void verifyType(CollectionInfo ci, boolean shouldExist, String pattern) {
 176         if (shouldExist) {
 177             Asserts.assertTrue(ci.containsVerification(pattern), "Missing expected verification pattern " + pattern + " for: " + ci.getName());
 178         } else {
 179             Asserts.assertFalse(ci.containsVerification(pattern), "Found unexpected verification pattern " + pattern + " for: " + ci.getName());
 180         }
 181     }
 182 
 183     public static class CollectionInfo {
 184         String name;
 185         ArrayList<String> verification;
 186         public CollectionInfo(String name) {
 187             this.name = name;
 188             this.verification = new ArrayList<>();
 189             System.out.println("Created CollectionInfo: " + name);
 190         }
 191 
 192         public String getName() {
 193             return name;
 194         }
 195 
 196         public void addVerification(String verify) {
 197             System.out.println("Adding: " + verify);
 198             verification.add(verify);
 199         }


< prev index next >