test/runtime/SharedArchiveFile/BootAppendTests.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
hotspot Cdiff test/runtime/SharedArchiveFile/BootAppendTests.java
test/runtime/SharedArchiveFile/BootAppendTests.java
Print this page
*** 71,81 ****
dumpArchive();
logTestCase("1");
testBootAppendModuleClass();
! log("TESTCASE: 2");
testBootAppendDuplicateModuleClass();
logTestCase("3");
testBootAppendExcludedModuleClass();
--- 71,81 ----
dumpArchive();
logTestCase("1");
testBootAppendModuleClass();
! logTestCase("2");
testBootAppendDuplicateModuleClass();
logTestCase("3");
testBootAppendExcludedModuleClass();
*** 121,135 ****
// should not be loaded at runtime.
public static void testBootAppendModuleClass() throws Exception {
for (String mode : modes) {
CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false)
! .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar)
.addSuffix(APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
! CDSTestUtils.runWithArchive(opts)
! .shouldContain("java.lang.ClassNotFoundException: javax.sound.sampled.MyClass");
}
}
// Test #2: If a class on -Xbootclasspath/a has the same fully qualified
// name as a class defined in boot modules, the class is not loaded
--- 121,135 ----
// should not be loaded at runtime.
public static void testBootAppendModuleClass() throws Exception {
for (String mode : modes) {
CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false)
! .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar, "-showversion")
.addSuffix(APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
! OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
! CDSTestUtils.checkExec(out, opts, "java.lang.ClassNotFoundException: javax.sound.sampled.MyClass");
}
}
// Test #2: If a class on -Xbootclasspath/a has the same fully qualified
// name as a class defined in boot modules, the class is not loaded
*** 142,156 ****
// The one from the boot modules should be loaded instead.
public static void testBootAppendDuplicateModuleClass() throws Exception {
for (String mode : modes) {
CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false)
! .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar)
! .addSuffix(APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
! CDSTestUtils.runWithArchive(opts)
! .shouldContain("[class,load] org.omg.CORBA.Context source: jrt:/java.corba");
}
}
// Test #3: If a class on -Xbootclasspath/a is from a package defined in boot modules,
// the class can be loaded from -Xbootclasspath/a when the module is excluded
--- 142,158 ----
// The one from the boot modules should be loaded instead.
public static void testBootAppendDuplicateModuleClass() throws Exception {
for (String mode : modes) {
CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false)
! .addPrefix("--add-modules", "java.corba", "-showversion",
! "-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar)
! .addSuffix("-Xlog:class+load=info",
! APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
! OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
! CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context source: jrt:/java.corba");
}
}
// Test #3: If a class on -Xbootclasspath/a is from a package defined in boot modules,
// the class can be loaded from -Xbootclasspath/a when the module is excluded
*** 162,182 ****
// loaded from the archive at runtime.
public static void testBootAppendExcludedModuleClass() throws Exception {
for (String mode : modes) {
CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false)
! .addPrefix("-Xbootclasspath/a:" + bootAppendJar,
"--limit-modules=java.base", "-cp", appJar)
.addSuffix("-Xlog:class+load=info",
APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
! OutputAnalyzer out = CDSTestUtils.runWithArchive(opts)
! .shouldContain("[class,load] javax.sound.sampled.MyClass");
// When CDS is enabled, the shared class should be loaded from the archive.
if (mode.equals("on")) {
! out.shouldContain("[class,load] javax.sound.sampled.MyClass source: shared objects file");
}
}
}
// Test #4: If a class on -Xbootclasspath/a has the same fully qualified
--- 164,184 ----
// loaded from the archive at runtime.
public static void testBootAppendExcludedModuleClass() throws Exception {
for (String mode : modes) {
CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false)
! .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
"--limit-modules=java.base", "-cp", appJar)
.addSuffix("-Xlog:class+load=info",
APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
! OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
! CDSTestUtils.checkExec(out, opts, "[class,load] javax.sound.sampled.MyClass");
// When CDS is enabled, the shared class should be loaded from the archive.
if (mode.equals("on")) {
! CDSTestUtils.checkExec(out, opts, "[class,load] javax.sound.sampled.MyClass source: shared objects file");
}
}
}
// Test #4: If a class on -Xbootclasspath/a has the same fully qualified
*** 191,208 ****
// java.corba is excluded.
public static void testBootAppendDuplicateExcludedModuleClass() throws Exception {
for (String mode : modes) {
CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false)
! .addPrefix("-Xbootclasspath/a:" + bootAppendJar,
"--limit-modules=java.base", "-cp", appJar)
.addSuffix("-Xlog:class+load=info",
APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
! CDSTestUtils.runWithArchive(opts)
! .shouldContain("[class,load] org.omg.CORBA.Context")
! .shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar");
}
}
// Test #5: If a class on -Xbootclasspath/a is not from named modules,
// the class can be loaded at runtime. Verify the behavior is
--- 193,212 ----
// java.corba is excluded.
public static void testBootAppendDuplicateExcludedModuleClass() throws Exception {
for (String mode : modes) {
CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false)
! .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
"--limit-modules=java.base", "-cp", appJar)
.addSuffix("-Xlog:class+load=info",
APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
! OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
! CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context");
! if (!CDSTestUtils.isUnableToMap(out)) {
! out.shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar");
! }
}
}
// Test #5: If a class on -Xbootclasspath/a is not from named modules,
// the class can be loaded at runtime. Verify the behavior is
*** 213,234 ****
// can be loaded at runtime when CDS is enabled.
public static void testBootAppendClass() throws Exception {
for (String mode : modes) {
CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false)
! .addPrefix("-Xbootclasspath/a:" + bootAppendJar,
"--limit-modules=java.base", "-cp", appJar)
.addSuffix("-Xlog:class+load=info",
APP_CLASS, BOOT_APPEND_CLASS_NAME);
! OutputAnalyzer out = CDSTestUtils.runWithArchive(opts)
! .shouldContain("[class,load] nonjdk.myPackage.MyClass");
// If CDS is enabled, the nonjdk.myPackage.MyClass should be loaded
// from the shared archive.
if (mode.equals("on")) {
! out.shouldContain(
"[class,load] nonjdk.myPackage.MyClass source: shared objects file");
}
}
}
}
--- 217,238 ----
// can be loaded at runtime when CDS is enabled.
public static void testBootAppendClass() throws Exception {
for (String mode : modes) {
CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false)
! .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
"--limit-modules=java.base", "-cp", appJar)
.addSuffix("-Xlog:class+load=info",
APP_CLASS, BOOT_APPEND_CLASS_NAME);
! OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
! CDSTestUtils.checkExec(out, opts, "[class,load] nonjdk.myPackage.MyClass");
// If CDS is enabled, the nonjdk.myPackage.MyClass should be loaded
// from the shared archive.
if (mode.equals("on")) {
! CDSTestUtils.checkExec(out, opts,
"[class,load] nonjdk.myPackage.MyClass source: shared objects file");
}
}
}
}
test/runtime/SharedArchiveFile/BootAppendTests.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File