25 * @test 26 * @bug 8014138 27 * @summary Testing new -XX:SharedArchiveFile=<file-name> option 28 * @requires vm.cds 29 * @library /test/lib 30 * @modules java.base/jdk.internal.misc 31 * java.management 32 */ 33 34 import jdk.test.lib.cds.CDSTestUtils; 35 import jdk.test.lib.process.ProcessTools; 36 import jdk.test.lib.process.OutputAnalyzer; 37 38 39 // NOTE: This test serves as a sanity test and also as an example for simple 40 // use of SharedArchiveFile argument. For this reason it DOES NOT use the utility 41 // methods to form command line to create/use shared archive. 42 public class SharedArchiveFile { 43 public static void main(String[] args) throws Exception { 44 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, 45 "-XX:+UnlockDiagnosticVMOptions", 46 "-XX:SharedArchiveFile=./SharedArchiveFile.jsa", 47 "-Xshare:dump"); 48 OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "SharedArchiveFile"); 49 CDSTestUtils.checkDump(out); 50 51 pb = ProcessTools.createJavaProcessBuilder(true, 52 "-XX:+UnlockDiagnosticVMOptions", 53 "-XX:SharedArchiveFile=./SharedArchiveFile.jsa", 54 "-Xshare:on", "-version"); 55 out = CDSTestUtils.executeAndLog(pb, "SharedArchiveFile"); 56 CDSTestUtils.checkExec(out); 57 } 58 } | 25 * @test 26 * @bug 8014138 27 * @summary Testing new -XX:SharedArchiveFile=<file-name> option 28 * @requires vm.cds 29 * @library /test/lib 30 * @modules java.base/jdk.internal.misc 31 * java.management 32 */ 33 34 import jdk.test.lib.cds.CDSTestUtils; 35 import jdk.test.lib.process.ProcessTools; 36 import jdk.test.lib.process.OutputAnalyzer; 37 38 39 // NOTE: This test serves as a sanity test and also as an example for simple 40 // use of SharedArchiveFile argument. For this reason it DOES NOT use the utility 41 // methods to form command line to create/use shared archive. 42 public class SharedArchiveFile { 43 public static void main(String[] args) throws Exception { 44 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, 45 "-XX:SharedArchiveFile=./SharedArchiveFile.jsa", 46 "-Xshare:dump"); 47 OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "SharedArchiveFile"); 48 CDSTestUtils.checkDump(out); 49 50 pb = ProcessTools.createJavaProcessBuilder(true, 51 "-XX:SharedArchiveFile=./SharedArchiveFile.jsa", 52 "-Xshare:on", "-version"); 53 out = CDSTestUtils.executeAndLog(pb, "SharedArchiveFile"); 54 CDSTestUtils.checkExec(out); 55 } 56 } |