< prev index next >

test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java

Print this page




  31  * @modules java.management
  32  *          jdk.jartool/sun.tools.jar
  33  * @build HelloString
  34  * @run main SharedStringsBasic
  35  */
  36 import jdk.test.lib.process.OutputAnalyzer;
  37 import jdk.test.lib.process.ProcessTools;
  38 
  39 // This test does not use SharedStringsUtils intentionally:
  40 // - in order to demonstrate the basic use of the functionality
  41 // - to provide sanity check and catch potential problems in the utils
  42 public class SharedStringsBasic {
  43     public static void main(String[] args) throws Exception {
  44         String appJar = JarBuilder.build("SharedStringsBasic", "HelloString");
  45 
  46         String sharedArchiveConfigFile =
  47             TestCommon.getSourceFile("SharedStringsBasic.txt").toString();
  48 
  49         ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true,
  50           TestCommon.makeCommandLineForAppCDS(
  51             "-XX:+UseAppCDS",
  52             "-cp", appJar,
  53             "-XX:SharedArchiveConfigFile=" + sharedArchiveConfigFile,
  54             "-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
  55             "-Xshare:dump",
  56             "-Xlog:cds,cds+hashtables"));
  57 
  58         TestCommon.executeAndLog(dumpPb, "dump")
  59             .shouldContain("Shared string table stats")
  60             .shouldHaveExitValue(0);
  61 
  62         ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true,
  63           TestCommon.makeCommandLineForAppCDS(
  64             "-XX:+UseAppCDS",
  65             "-cp", appJar,
  66             "-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
  67             "-Xshare:auto",
  68             "-showversion",
  69             "HelloString"));
  70 
  71         TestCommon.executeAndLog(runPb, "run").shouldHaveExitValue(0);
  72     }
  73 }


  31  * @modules java.management
  32  *          jdk.jartool/sun.tools.jar
  33  * @build HelloString
  34  * @run main SharedStringsBasic
  35  */
  36 import jdk.test.lib.process.OutputAnalyzer;
  37 import jdk.test.lib.process.ProcessTools;
  38 
  39 // This test does not use SharedStringsUtils intentionally:
  40 // - in order to demonstrate the basic use of the functionality
  41 // - to provide sanity check and catch potential problems in the utils
  42 public class SharedStringsBasic {
  43     public static void main(String[] args) throws Exception {
  44         String appJar = JarBuilder.build("SharedStringsBasic", "HelloString");
  45 
  46         String sharedArchiveConfigFile =
  47             TestCommon.getSourceFile("SharedStringsBasic.txt").toString();
  48 
  49         ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true,
  50           TestCommon.makeCommandLineForAppCDS(

  51             "-cp", appJar,
  52             "-XX:SharedArchiveConfigFile=" + sharedArchiveConfigFile,
  53             "-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
  54             "-Xshare:dump",
  55             "-Xlog:cds,cds+hashtables"));
  56 
  57         TestCommon.executeAndLog(dumpPb, "dump")
  58             .shouldContain("Shared string table stats")
  59             .shouldHaveExitValue(0);
  60 
  61         ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true,
  62           TestCommon.makeCommandLineForAppCDS(

  63             "-cp", appJar,
  64             "-XX:SharedArchiveFile=./SharedStringsBasic.jsa",
  65             "-Xshare:auto",
  66             "-showversion",
  67             "HelloString"));
  68 
  69         TestCommon.executeAndLog(runPb, "run").shouldHaveExitValue(0);
  70     }
  71 }
< prev index next >