8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test

Added the java.corba to the set of root modules by using the --add-modules option. Used the CDSTestUtils.checkExec() for checking test results.

Reviewed-by: sspitsyn, jiangli, mseledtsov, iklam
This commit is contained in:
Calvin Cheung 2017-04-25 11:06:42 -07:00
parent 30b6aebe6a
commit bed1dfb050
2 changed files with 24 additions and 21 deletions

View file

@ -122,7 +122,6 @@ gc/g1/humongousObjects/TestHeapCounters.java 8178918 generic-all
runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all
# This test is disabled since it will stress NMT and timeout during normal testing # This test is disabled since it will stress NMT and timeout during normal testing
runtime/NMT/MallocStressTest.java 8166548 generic-all runtime/NMT/MallocStressTest.java 8166548 generic-all
runtime/SharedArchiveFile/BootAppendTests.java 8150683 generic-all
runtime/SharedArchiveFile/DefaultUseWithClient.java 8154204 generic-all runtime/SharedArchiveFile/DefaultUseWithClient.java 8154204 generic-all
############################################################################# #############################################################################

View file

@ -73,7 +73,7 @@ public class BootAppendTests {
logTestCase("1"); logTestCase("1");
testBootAppendModuleClass(); testBootAppendModuleClass();
log("TESTCASE: 2"); logTestCase("2");
testBootAppendDuplicateModuleClass(); testBootAppendDuplicateModuleClass();
logTestCase("3"); logTestCase("3");
@ -123,11 +123,11 @@ public class BootAppendTests {
for (String mode : modes) { for (String mode : modes) {
CDSOptions opts = (new CDSOptions()) CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false) .setXShareMode(mode).setUseVersion(false)
.addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar) .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar, "-showversion")
.addSuffix(APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME); .addSuffix(APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
CDSTestUtils.runWithArchive(opts) OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
.shouldContain("java.lang.ClassNotFoundException: javax.sound.sampled.MyClass"); CDSTestUtils.checkExec(out, opts, "java.lang.ClassNotFoundException: javax.sound.sampled.MyClass");
} }
} }
@ -144,11 +144,13 @@ public class BootAppendTests {
for (String mode : modes) { for (String mode : modes) {
CDSOptions opts = (new CDSOptions()) CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false) .setXShareMode(mode).setUseVersion(false)
.addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar) .addPrefix("--add-modules", "java.corba", "-showversion",
.addSuffix(APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME); "-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar)
.addSuffix("-Xlog:class+load=info",
APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
CDSTestUtils.runWithArchive(opts) OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
.shouldContain("[class,load] org.omg.CORBA.Context source: jrt:/java.corba"); CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context source: jrt:/java.corba");
} }
} }
@ -164,17 +166,17 @@ public class BootAppendTests {
for (String mode : modes) { for (String mode : modes) {
CDSOptions opts = (new CDSOptions()) CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false) .setXShareMode(mode).setUseVersion(false)
.addPrefix("-Xbootclasspath/a:" + bootAppendJar, .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
"--limit-modules=java.base", "-cp", appJar) "--limit-modules=java.base", "-cp", appJar)
.addSuffix("-Xlog:class+load=info", .addSuffix("-Xlog:class+load=info",
APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME); APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
OutputAnalyzer out = CDSTestUtils.runWithArchive(opts) OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
.shouldContain("[class,load] javax.sound.sampled.MyClass"); CDSTestUtils.checkExec(out, opts, "[class,load] javax.sound.sampled.MyClass");
// When CDS is enabled, the shared class should be loaded from the archive. // When CDS is enabled, the shared class should be loaded from the archive.
if (mode.equals("on")) { if (mode.equals("on")) {
out.shouldContain("[class,load] javax.sound.sampled.MyClass source: shared objects file"); CDSTestUtils.checkExec(out, opts, "[class,load] javax.sound.sampled.MyClass source: shared objects file");
} }
} }
} }
@ -193,14 +195,16 @@ public class BootAppendTests {
for (String mode : modes) { for (String mode : modes) {
CDSOptions opts = (new CDSOptions()) CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false) .setXShareMode(mode).setUseVersion(false)
.addPrefix("-Xbootclasspath/a:" + bootAppendJar, .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
"--limit-modules=java.base", "-cp", appJar) "--limit-modules=java.base", "-cp", appJar)
.addSuffix("-Xlog:class+load=info", .addSuffix("-Xlog:class+load=info",
APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME); APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
CDSTestUtils.runWithArchive(opts) OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
.shouldContain("[class,load] org.omg.CORBA.Context") CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context");
.shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar"); if (!CDSTestUtils.isUnableToMap(out)) {
out.shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar");
}
} }
} }
@ -215,18 +219,18 @@ public class BootAppendTests {
for (String mode : modes) { for (String mode : modes) {
CDSOptions opts = (new CDSOptions()) CDSOptions opts = (new CDSOptions())
.setXShareMode(mode).setUseVersion(false) .setXShareMode(mode).setUseVersion(false)
.addPrefix("-Xbootclasspath/a:" + bootAppendJar, .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
"--limit-modules=java.base", "-cp", appJar) "--limit-modules=java.base", "-cp", appJar)
.addSuffix("-Xlog:class+load=info", .addSuffix("-Xlog:class+load=info",
APP_CLASS, BOOT_APPEND_CLASS_NAME); APP_CLASS, BOOT_APPEND_CLASS_NAME);
OutputAnalyzer out = CDSTestUtils.runWithArchive(opts) OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
.shouldContain("[class,load] nonjdk.myPackage.MyClass"); CDSTestUtils.checkExec(out, opts, "[class,load] nonjdk.myPackage.MyClass");
// If CDS is enabled, the nonjdk.myPackage.MyClass should be loaded // If CDS is enabled, the nonjdk.myPackage.MyClass should be loaded
// from the shared archive. // from the shared archive.
if (mode.equals("on")) { if (mode.equals("on")) {
out.shouldContain( CDSTestUtils.checkExec(out, opts,
"[class,load] nonjdk.myPackage.MyClass source: shared objects file"); "[class,load] nonjdk.myPackage.MyClass source: shared objects file");
} }
} }