< prev index next >

test/lib/jdk/test/lib/cds/CDSTestUtils.java

Print this page

266 
267         String[] cmdLine = cmd.toArray(new String[cmd.size()]);
268         ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(cmdLine);
269         return executeAndLog(pb, "dump");
270     }
271 
272     public static boolean isDynamicArchive() {
273         return DYNAMIC_DUMP;
274     }
275 
276     // check result of 'dump-the-archive' operation, that is "-Xshare:dump"
277     public static OutputAnalyzer checkDump(OutputAnalyzer output, String... extraMatches)
278         throws Exception {
279 
280         if (!DYNAMIC_DUMP) {
281             output.shouldContain("Loading classes to share");
282         } else {
283             output.shouldContain("Written dynamic archive 0x");
284         }
285         output.shouldHaveExitValue(0);
286         output.shouldNotContain(MSG_STATIC_FIELD_MAY_HOLD_DIFFERENT_VALUE);
287 
288         for (String match : extraMatches) {
289             output.shouldContain(match);
290         }
291 
292         return output;
293     }
294 
295     // check result of dumping base archive
296     public static OutputAnalyzer checkBaseDump(OutputAnalyzer output) throws Exception {
297         output.shouldContain("Loading classes to share");
298         output.shouldHaveExitValue(0);
299         output.shouldNotContain(MSG_STATIC_FIELD_MAY_HOLD_DIFFERENT_VALUE);
300         return output;
301     }
302 
303     // A commonly used convenience methods to create an archive and check the results
304     // Creates an archive and checks for errors
305     public static OutputAnalyzer createArchiveAndCheck(CDSOptions opts)
306         throws Exception {
307         return checkDump(createArchive(opts));
308     }
309 
310 
311     public static OutputAnalyzer createArchiveAndCheck(String... cliPrefix)
312         throws Exception {
313         return checkDump(createArchive(cliPrefix));
314     }
315 
316 
317     // This method should be used to check the output of child VM for common exceptions.
318     // Most of CDS tests deal with child VM processes for creating and using the archive.
319     // However exceptions that occur in the child process do not automatically propagate

266 
267         String[] cmdLine = cmd.toArray(new String[cmd.size()]);
268         ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(cmdLine);
269         return executeAndLog(pb, "dump");
270     }
271 
272     public static boolean isDynamicArchive() {
273         return DYNAMIC_DUMP;
274     }
275 
276     // check result of 'dump-the-archive' operation, that is "-Xshare:dump"
277     public static OutputAnalyzer checkDump(OutputAnalyzer output, String... extraMatches)
278         throws Exception {
279 
280         if (!DYNAMIC_DUMP) {
281             output.shouldContain("Loading classes to share");
282         } else {
283             output.shouldContain("Written dynamic archive 0x");
284         }
285         output.shouldHaveExitValue(0);
286         //output.shouldNotContain(MSG_STATIC_FIELD_MAY_HOLD_DIFFERENT_VALUE); // FIXME -- leyden+JEP483 merge
287 
288         for (String match : extraMatches) {
289             output.shouldContain(match);
290         }
291 
292         return output;
293     }
294 
295     // check result of dumping base archive
296     public static OutputAnalyzer checkBaseDump(OutputAnalyzer output) throws Exception {
297         output.shouldContain("Loading classes to share");
298         output.shouldHaveExitValue(0);
299         //output.shouldNotContain(MSG_STATIC_FIELD_MAY_HOLD_DIFFERENT_VALUE); // FIXME -- leyden+JEP483 merge
300         return output;
301     }
302 
303     // A commonly used convenience methods to create an archive and check the results
304     // Creates an archive and checks for errors
305     public static OutputAnalyzer createArchiveAndCheck(CDSOptions opts)
306         throws Exception {
307         return checkDump(createArchive(opts));
308     }
309 
310 
311     public static OutputAnalyzer createArchiveAndCheck(String... cliPrefix)
312         throws Exception {
313         return checkDump(createArchive(cliPrefix));
314     }
315 
316 
317     // This method should be used to check the output of child VM for common exceptions.
318     // Most of CDS tests deal with child VM processes for creating and using the archive.
319     // However exceptions that occur in the child process do not automatically propagate
< prev index next >