test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/MainModuleOnly.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/MainModuleOnly.java Fri Apr 6 15:40:45 2018
--- new/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/MainModuleOnly.java Fri Apr 6 15:40:45 2018
*** 89,171 ****
--- 89,177 ----
OutputAnalyzer output = TestCommon.createArchive(
destJar.toString(), appClasses,
"-Xlog:class+load=trace", "-XX:+PrintSystemDictionaryAtExit",
"--module-path", moduleDir.toString(),
"-m", TEST_MODULE1);
! TestCommon.checkExecReturn(output, 0, true, "Loading classes to share");
! TestCommon.checkDump(output);
// run with the archive using the same command line as in dump time.
// The main class should be loaded from the archive.
! output = TestCommon.execCommon( "-Xlog:class+load=trace",
! TestCommon.run("-Xlog:class+load=trace",
"-cp", destJar.toString(),
"--module-path", moduleDir.toString(),
! "-m", TEST_MODULE1);
TestCommon.checkExecReturn(output, 0, true,
"[class,load] com.simple.Main source: shared objects file");
+ .assertNormalExit("[class,load] com.simple.Main source: shared objects file");
// run with the archive with the main class name inserted before the -m.
// The main class name will be picked up before the module name. So the
// main class should be loaded from the jar in the -cp.
! output = TestCommon.execCommon( "-Xlog:class+load=trace",
! TestCommon.run("-Xlog:class+load=trace",
"-cp", destJar.toString(),
"--module-path", moduleDir.toString(),
! MAIN_CLASS, "-m", TEST_MODULE1);
output.shouldHaveExitValue(0)
! .shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
+ .assertNormalExit(out ->
! out.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar"));
// run with the archive with exploded module. Since during dump time, we
// only archive classes from the modular jar in the --module-path, the
// main class should be loaded from the exploded module directory.
! output = TestCommon.execCommon( "-Xlog:class+load=trace",
! TestCommon.run("-Xlog:class+load=trace",
"-cp", destJar.toString(),
"--module-path", MODS_DIR.toString(),
! "-m", TEST_MODULE1 + "/" + MAIN_CLASS);
output.shouldHaveExitValue(0)
! .shouldMatch(".class.load. com.simple.Main source:.*com.simple")
+ .assertNormalExit(out -> {
! out.shouldMatch(".class.load. com.simple.Main source:.*com.simple")
.shouldContain(MODS_DIR.toString());
+ });
// run with the archive with the --upgrade-module-path option.
// CDS will be disabled with this options and the main class will be
// loaded from the modular jar.
! output = TestCommon.execCommon( "-Xlog:class+load=trace",
! TestCommon.run("-Xlog:class+load=trace",
"-cp", destJar.toString(),
"--upgrade-module-path", moduleDir.toString(),
"--module-path", moduleDir.toString(),
! "-m", TEST_MODULE1);
output.shouldHaveExitValue(0)
+ .assertSilentlyDisabledCDS(out -> {
+ out.shouldHaveExitValue(0)
.shouldMatch("CDS is disabled when the.*option is specified")
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
+ });
// run with the archive with the --limit-modules option.
// CDS will be disabled with this options and the main class will be
// loaded from the modular jar.
! output = TestCommon.execCommon( "-Xlog:class+load=trace",
! TestCommon.run("-Xlog:class+load=trace",
"-cp", destJar.toString(),
"--limit-modules", "java.base," + TEST_MODULE1,
"--module-path", moduleDir.toString(),
! "-m", TEST_MODULE1);
output.shouldHaveExitValue(0)
+ .assertSilentlyDisabledCDS(out -> {
+ out.shouldHaveExitValue(0)
.shouldMatch("CDS is disabled when the.*option is specified")
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
+ });
// run with the archive with the --patch-module option.
// CDS will be disabled with this options and the main class will be
// loaded from the modular jar.
! output = TestCommon.execCommon( "-Xlog:class+load=trace",
! TestCommon.run("-Xlog:class+load=trace",
"-cp", destJar.toString(),
"--patch-module", TEST_MODULE1 + "=" + MODS_DIR.toString(),
"--module-path", moduleDir.toString(),
! "-m", TEST_MODULE1);
output.shouldHaveExitValue(0)
+ .assertSilentlyDisabledCDS(out -> {
+ out.shouldHaveExitValue(0)
.shouldMatch("CDS is disabled when the.*option is specified")
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
+ });
// modify the timestamp of the jar file
(new File(destJar.toString())).setLastModified(System.currentTimeMillis() + 2000);
// run with the archive and the jar with modified timestamp.
// It should fail due to timestamp of the jar doesn't match the one
// used during dump time.
! output = TestCommon.execCommon( "-Xlog:class+load=trace",
! TestCommon.run("-Xlog:class+load=trace",
"-cp", destJar.toString(),
"--module-path", moduleDir.toString(),
! "-m", TEST_MODULE1);
TestCommon.checkExecReturn(output, 1, true,
+ .assertAbnormalExit(
"A jar/jimage file is not the one used while building the shared archive file:");
}
}
test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/MainModuleOnly.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File