< prev index next > test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/DynamicArchiveRelocationTest.java
Print this page
/*
- * 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.
* @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;
+ ", 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";
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 -> {
output.shouldContain(runtimeMsg);
}
});
run2(baseArchiveName, topArchiveName,
+ "--enable-preview",
unlockArg,
runRelocArg,
logArg,
"-cp", appJar, mainClass)
.assertNormalExit(output -> {
< prev index next >