test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff test/hotspot/jtreg/runtime/SharedArchiveFile

test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java

Print this page




  34 import jdk.test.lib.cds.CDSOptions;
  35 import jdk.test.lib.cds.CDSTestUtils;
  36 import jdk.test.lib.process.OutputAnalyzer;
  37 
  38 public class NonBootLoaderClasses {
  39     public static void main(String[] args) throws Exception {
  40         final String PLATFORM_CLASS = "jdk/dynalink/DynamicLinker";
  41         final String APP_CLASS = "com/sun/tools/javac/Main";
  42         String[] classes = {PLATFORM_CLASS, APP_CLASS};
  43         String classList =
  44             CDSTestUtils.makeClassList(classes).getPath();
  45         String archiveName = "NonBootLoaderClasses.jsa";
  46         CDSOptions opts = (new CDSOptions())
  47             .addPrefix("-XX:ExtraSharedClassListFile=" + classList, "-cp", "\"\"")
  48             .setArchiveName(archiveName);
  49         CDSTestUtils.createArchiveAndCheck(opts);
  50 
  51         // Print the shared dictionary and inspect the output
  52         opts = (new CDSOptions())
  53             .setUseVersion(false)
  54             .addSuffix( "-cp", "\"\"",
  55                 "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
  56                 "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary");
  57         CDSTestUtils.run(opts)
  58             .assertNormalExit(output -> {
  59                 output.shouldContain("archive is valid");
  60                 output.shouldContain(PLATFORM_CLASS.replace('/', '.'));
  61                 output.shouldContain(APP_CLASS.replace('/', '.'));
  62             });
  63    }
  64 }


  34 import jdk.test.lib.cds.CDSOptions;
  35 import jdk.test.lib.cds.CDSTestUtils;
  36 import jdk.test.lib.process.OutputAnalyzer;
  37 
  38 public class NonBootLoaderClasses {
  39     public static void main(String[] args) throws Exception {
  40         final String PLATFORM_CLASS = "jdk/dynalink/DynamicLinker";
  41         final String APP_CLASS = "com/sun/tools/javac/Main";
  42         String[] classes = {PLATFORM_CLASS, APP_CLASS};
  43         String classList =
  44             CDSTestUtils.makeClassList(classes).getPath();
  45         String archiveName = "NonBootLoaderClasses.jsa";
  46         CDSOptions opts = (new CDSOptions())
  47             .addPrefix("-XX:ExtraSharedClassListFile=" + classList, "-cp", "\"\"")
  48             .setArchiveName(archiveName);
  49         CDSTestUtils.createArchiveAndCheck(opts);
  50 
  51         // Print the shared dictionary and inspect the output
  52         opts = (new CDSOptions())
  53             .setUseVersion(false)
  54             .addSuffix( "-cp", "\"\"", "-Xlog:cds",
  55                 "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
  56                 "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary");
  57         CDSTestUtils.run(opts)
  58             .assertNormalExit(output -> {
  59                 output.shouldContain("archive is valid");
  60                 output.shouldContain(PLATFORM_CLASS.replace('/', '.'));
  61                 output.shouldContain(APP_CLASS.replace('/', '.'));
  62             });
  63    }
  64 }
test/hotspot/jtreg/runtime/SharedArchiveFile/NonBootLoaderClasses.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File