231 throws Exception { 232 return createArchive((new CDSOptions()).addPrefix(cliPrefix)); 233 } 234 235 // Create bootstrap CDS archive 236 public static OutputAnalyzer createArchive(CDSOptions opts) 237 throws Exception { 238 239 startNewArchiveName(); 240 241 ArrayList<String> cmd = new ArrayList<String>(); 242 243 for (String p : opts.prefix) cmd.add(p); 244 245 cmd.add("-Xshare:dump"); 246 cmd.add("-Xlog:cds,cds+hashtables"); 247 if (opts.archiveName == null) 248 opts.archiveName = getDefaultArchiveName(); 249 cmd.add("-XX:SharedArchiveFile=./" + opts.archiveName); 250 251 for (String s : opts.suffix) cmd.add(s); 252 253 String[] cmdLine = cmd.toArray(new String[cmd.size()]); 254 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine); 255 return executeAndLog(pb, "dump"); 256 } 257 258 259 // check result of 'dump-the-archive' operation, that is "-Xshare:dump" 260 public static OutputAnalyzer checkDump(OutputAnalyzer output, String... extraMatches) 261 throws Exception { 262 263 output.shouldContain("Loading classes to share"); 264 output.shouldHaveExitValue(0); 265 266 for (String match : extraMatches) { 267 output.shouldContain(match); 268 } 269 270 return output; | 231 throws Exception { 232 return createArchive((new CDSOptions()).addPrefix(cliPrefix)); 233 } 234 235 // Create bootstrap CDS archive 236 public static OutputAnalyzer createArchive(CDSOptions opts) 237 throws Exception { 238 239 startNewArchiveName(); 240 241 ArrayList<String> cmd = new ArrayList<String>(); 242 243 for (String p : opts.prefix) cmd.add(p); 244 245 cmd.add("-Xshare:dump"); 246 cmd.add("-Xlog:cds,cds+hashtables"); 247 if (opts.archiveName == null) 248 opts.archiveName = getDefaultArchiveName(); 249 cmd.add("-XX:SharedArchiveFile=./" + opts.archiveName); 250 251 if (opts.classList != null) { 252 File classListFile = makeClassList(opts.classList); 253 cmd.add("-XX:ExtraSharedClassListFile=" + classListFile.getPath()); 254 } 255 256 for (String s : opts.suffix) cmd.add(s); 257 258 String[] cmdLine = cmd.toArray(new String[cmd.size()]); 259 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, cmdLine); 260 return executeAndLog(pb, "dump"); 261 } 262 263 264 // check result of 'dump-the-archive' operation, that is "-Xshare:dump" 265 public static OutputAnalyzer checkDump(OutputAnalyzer output, String... extraMatches) 266 throws Exception { 267 268 output.shouldContain("Loading classes to share"); 269 output.shouldHaveExitValue(0); 270 271 for (String match : extraMatches) { 272 output.shouldContain(match); 273 } 274 275 return output; |