test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java
changeset 58310 81134def991d
parent 58300 c3b93d6603f5
child 58528 d0519b8bd8d9
equal deleted inserted replaced
58309:c6f8b2c3dc66 58310:81134def991d
   240         String[] cmdLine = cmd.toArray(new String[cmd.size()]);
   240         String[] cmdLine = cmd.toArray(new String[cmd.size()]);
   241         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine);
   241         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine);
   242         if (opts.appJarDir != null) {
   242         if (opts.appJarDir != null) {
   243             pb.directory(new File(opts.appJarDir));
   243             pb.directory(new File(opts.appJarDir));
   244         }
   244         }
   245         return executeAndLog(pb, "dump");
   245 
       
   246         OutputAnalyzer output = executeAndLog(pb, "dump");
       
   247         if (DYNAMIC_DUMP && isUnableToMap(output)) {
       
   248             throw new SkippedException(UnableToMapMsg);
       
   249         }
       
   250         return output;
   246     }
   251     }
   247 
   252 
   248     // This allows you to run the AppCDS tests with JFR enabled at runtime (though not at
   253     // This allows you to run the AppCDS tests with JFR enabled at runtime (though not at
   249     // dump time, as that's uncommon for typical AppCDS users).
   254     // dump time, as that's uncommon for typical AppCDS users).
   250     //
   255     //
   460     // A common operation: dump, then check results
   465     // A common operation: dump, then check results
   461     public static OutputAnalyzer testDump(String appJar, String classList[],
   466     public static OutputAnalyzer testDump(String appJar, String classList[],
   462                                           String... suffix) throws Exception {
   467                                           String... suffix) throws Exception {
   463         OutputAnalyzer output = dump(appJar, classList, suffix);
   468         OutputAnalyzer output = dump(appJar, classList, suffix);
   464         if (DYNAMIC_DUMP) {
   469         if (DYNAMIC_DUMP) {
   465             if (isUnableToMap(output)) {
       
   466                 throw new SkippedException(UnableToMapMsg);
       
   467             }
       
   468             output.shouldContain("Written dynamic archive");
   470             output.shouldContain("Written dynamic archive");
   469         } else {
   471         } else {
   470             output.shouldContain("Loading classes to share");
   472             output.shouldContain("Loading classes to share");
   471         }
   473         }
   472         output.shouldHaveExitValue(0);
   474         output.shouldHaveExitValue(0);
   475 
   477 
   476     public static OutputAnalyzer testDump(String appJarDir, String appJar, String classList[],
   478     public static OutputAnalyzer testDump(String appJarDir, String appJar, String classList[],
   477                                           String... suffix) throws Exception {
   479                                           String... suffix) throws Exception {
   478         OutputAnalyzer output = dump(appJarDir, appJar, classList, suffix);
   480         OutputAnalyzer output = dump(appJarDir, appJar, classList, suffix);
   479         if (DYNAMIC_DUMP) {
   481         if (DYNAMIC_DUMP) {
   480             if (isUnableToMap(output)) {
       
   481                 throw new SkippedException(UnableToMapMsg);
       
   482             }
       
   483             output.shouldContain("Written dynamic archive");
   482             output.shouldContain("Written dynamic archive");
   484         } else {
   483         } else {
   485             output.shouldContain("Loading classes to share");
   484             output.shouldContain("Loading classes to share");
   486         }
   485         }
   487         output.shouldHaveExitValue(0);
   486         output.shouldHaveExitValue(0);