< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicArchiveRelocationTest.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -28,13 +28,16 @@
   * @requires vm.cds
   * @summary Testing relocation of dynamic CDS archive (during both dump time and run time)
   * @comment JDK-8231610 Relocate the CDS archive if it cannot be mapped to the requested address
   * @bug 8231610
   * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds /test/hotspot/jtreg/runtime/cds/appcds/test-classes
-  * @build Hello
+  * @enablePreview
+  * @modules java.base/jdk.internal.value
+  *          java.base/jdk.internal.vm.annotation
+  * @compile ../test-classes/HelloInlineClassApp.java ../test-classes/HelloRelocation.java
   * @build jdk.test.whitebox.WhiteBox
-  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar hello.jar Hello
+  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar hello.jar HelloRelocation HelloInlineClassApp HelloInlineClassApp$Point HelloInlineClassApp$Rectangle  HelloInlineClassApp$ValueRecord
   * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
   * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. DynamicArchiveRelocationTest
   */
  
  import jdk.test.lib.process.OutputAnalyzer;

@@ -76,11 +79,11 @@
                             + ", top_reloc = " + dump_top_reloc
                             + ", run = " + run_reloc);
          System.out.println("============================================================");
  
          String appJar = ClassFileInstaller.getJarPath("hello.jar");
-         String mainClass = "Hello";
+         String mainClass = "HelloRelocation";
          String forceRelocation = "-XX:ArchiveRelocationMode=1";
          String dumpTopRelocArg  = dump_top_reloc  ? forceRelocation : "-showversion";
          String runRelocArg      = run_reloc       ? forceRelocation : "-showversion";
          String logArg = "-Xlog:cds=debug,cds+reloc=debug";
  

@@ -90,16 +93,17 @@
          String runtimeMsg = "Try to map archive(s) at an alternative address";
          String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
  
          // (1) Dump base archive (static)
  
-         TestCommon.dumpBaseArchive(baseArchiveName, unlockArg, logArg)
+         TestCommon.dumpBaseArchive(baseArchiveName, "--enable-preview", unlockArg, logArg)
            .shouldContain("Relocating archive from");
  
          // (2) Dump top archive (dynamic)
  
          dump2(baseArchiveName, topArchiveName,
+               "--enable-preview",
                unlockArg,
                dumpTopRelocArg,
                logArg,
                "-cp", appJar, mainClass)
              .assertNormalExit(output -> {

@@ -107,10 +111,11 @@
                          output.shouldContain(runtimeMsg);
                      }
                  });
  
          run2(baseArchiveName, topArchiveName,
+              "--enable-preview",
               unlockArg,
               runRelocArg,
               logArg,
              "-cp", appJar, mainClass)
              .assertNormalExit(output -> {
< prev index next >