< prev index next >

test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java

Print this page

        

@@ -34,10 +34,12 @@
  *          jdk.jartool/sun.tools.jar
  * @compile test-classes/Hello.java
  * @run main/timeout=240 SharedBaseAddress
  */
 
+import jdk.test.lib.cds.CDSTestUtils;
+import jdk.test.lib.cds.CDSOptions;
 import jdk.test.lib.process.OutputAnalyzer;
 
 public class SharedBaseAddress {
 
     // shared base address test table

@@ -48,10 +50,23 @@
     };
 
     public static void main(String[] args) throws Exception {
         String appJar = JarBuilder.getOrCreateHelloJar();
 
+        // First check CDS for default mode
+        for (String testEntry : testTable) {
+            String filename = "SharedBaseAddress" + testEntry + ".jsa";
+            System.out.println("sharedBaseAddress = " + testEntry);
+            CDSOptions opts = (new CDSOptions())
+                .setArchiveName(filename)
+                .addPrefix("-XX:SharedBaseAddress=" + testEntry);
+
+            CDSTestUtils.createArchiveAndCheck(opts);
+            CDSTestUtils.runWithArchiveAndCheck(opts);
+        }
+
+        // Next check CDS in AppCDS mode
         for (String testEntry : testTable) {
             System.out.println("sharedBaseAddress = " + testEntry);
 
             OutputAnalyzer dumpOutput = TestCommon.dump(
                 appJar, new String[] {"Hello"}, "-XX:SharedBaseAddress=" + testEntry);
< prev index next >