test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
open Cdiff test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java
test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java
Print this page
*** 101,181 ****
// previous step
OutputAnalyzer output = TestCommon.createArchive(
null, appClasses,
"--module-path", moduleDir.toString(),
"-m", MAIN_MODULE);
! TestCommon.checkExecReturn(output, 0, true, "Loading classes to share");
String prefix[] = {"-cp", "\"\"", "-Xlog:class+load=trace"};
// run with the archive with the --module-path the same as the one during
// dump time. The classes should be loaded from the archive.
! output = TestCommon.execModule(prefix,
null, // --upgrade-module-path
moduleDir.toString(), // --module-path
! MAIN_MODULE); // -m
! TestCommon.checkExecReturn(output, 0, true,
! "[class,load] com.greetings.Main source: shared objects file",
! "[class,load] org.astro.World source: shared objects file");
// run with the archive with the --module-path different from the one during
// dump time. The classes should be loaded from the jar files.
! output = TestCommon.execModule(prefix,
null, // --upgrade-module-path
moduleDir2.toString(), // --module-path
! MAIN_MODULE); // -m
! output.shouldHaveExitValue(0)
! .shouldMatch(".class.load. com.greetings.Main source:.*com.greetings.jar")
.shouldMatch(".class.load. org.astro.World source:.*org.astro.jar");
// create an archive with modular jar files in both -cp and --module-path
String jars = subJar.toString() + System.getProperty("path.separator") +
mainJar.toString();
output = TestCommon.createArchive( jars, appClasses,
"-Xlog:class+load=trace", "-XX:+PrintSystemDictionaryAtExit",
"--module-path", moduleDir.toString(),
"-m", MAIN_MODULE);
! TestCommon.checkExecReturn(output, 0, true, "Loading classes to share");
// run with archive with the main class name specified before
// the module name with the -m option. Since the -m option was specified
// during dump time, the classes in the jar files after the -cp won't be
// archived. Therefore, the classes won't be loaded from the archive but
// will be loaded from the jar files.
! output = TestCommon.execCommon( "-Xlog:class+load=trace",
"-cp", jars,
"--module-path", moduleDir.toString(),
! MAIN_CLASS, "-m", MAIN_MODULE);
! output.shouldHaveExitValue(0)
! .shouldMatch(".class.load. com.greetings.Main source:.*com.greetings.jar")
.shouldMatch(".class.load. org.astro.World source:.*org.astro.jar");
// similar to the above case but without the main class name. The classes
// should be loaded from the archive.
! output = TestCommon.execCommon( "-Xlog:class+load=trace",
"-cp", jars,
"--module-path", moduleDir.toString(),
! "-m", MAIN_MODULE);
! TestCommon.checkExecReturn(output, 0, true,
"[class,load] com.greetings.Main source: shared objects file",
"[class,load] org.astro.World source: shared objects file");
// create an archive with two modular jars in the --module-path
output = TestCommon.createArchive(
null, appClasses,
"--module-path", jars,
"-m", MAIN_MODULE);
! TestCommon.checkExecReturn(output, 0, true, "Loading classes to share");
// run with the above archive but with the modular jar containing the
// org.astro module in a different location.
// The org.astro.World class should be loaded from the jar.
// The Main class should still be loaded from the archive.
jars = destJar.toString() + System.getProperty("path.separator") +
mainJar.toString();
! output = TestCommon.execModule(prefix,
null, // --upgrade-module-path
jars, // --module-path
! MAIN_MODULE); // -m
! output.shouldHaveExitValue(0)
! .shouldContain("[class,load] com.greetings.Main source: shared objects file")
.shouldMatch(".class.load. org.astro.World source:.*org.astro.jar");
}
}
--- 101,186 ----
// previous step
OutputAnalyzer output = TestCommon.createArchive(
null, appClasses,
"--module-path", moduleDir.toString(),
"-m", MAIN_MODULE);
! TestCommon.checkDump(output);
String prefix[] = {"-cp", "\"\"", "-Xlog:class+load=trace"};
// run with the archive with the --module-path the same as the one during
// dump time. The classes should be loaded from the archive.
! TestCommon.runWithModules(prefix,
null, // --upgrade-module-path
moduleDir.toString(), // --module-path
! MAIN_MODULE) // -m
! .assertNormalExit(out -> {
! out.shouldContain("[class,load] com.greetings.Main source: shared objects file")
! .shouldContain("[class,load] org.astro.World source: shared objects file");
! });
// run with the archive with the --module-path different from the one during
// dump time. The classes should be loaded from the jar files.
! TestCommon.runWithModules(prefix,
null, // --upgrade-module-path
moduleDir2.toString(), // --module-path
! MAIN_MODULE) // -m
! .assertNormalExit(out -> {
! out.shouldMatch(".class.load. com.greetings.Main source:.*com.greetings.jar")
.shouldMatch(".class.load. org.astro.World source:.*org.astro.jar");
+ });
// create an archive with modular jar files in both -cp and --module-path
String jars = subJar.toString() + System.getProperty("path.separator") +
mainJar.toString();
output = TestCommon.createArchive( jars, appClasses,
"-Xlog:class+load=trace", "-XX:+PrintSystemDictionaryAtExit",
"--module-path", moduleDir.toString(),
"-m", MAIN_MODULE);
! TestCommon.checkDump(output);
// run with archive with the main class name specified before
// the module name with the -m option. Since the -m option was specified
// during dump time, the classes in the jar files after the -cp won't be
// archived. Therefore, the classes won't be loaded from the archive but
// will be loaded from the jar files.
! TestCommon.run("-Xlog:class+load=trace",
"-cp", jars,
"--module-path", moduleDir.toString(),
! MAIN_CLASS, "-m", MAIN_MODULE)
! .assertNormalExit(out -> {
! out.shouldMatch(".class.load. com.greetings.Main source:.*com.greetings.jar")
.shouldMatch(".class.load. org.astro.World source:.*org.astro.jar");
+ });
+
// similar to the above case but without the main class name. The classes
// should be loaded from the archive.
! TestCommon.run("-Xlog:class+load=trace",
"-cp", jars,
"--module-path", moduleDir.toString(),
! "-m", MAIN_MODULE)
! .assertNormalExit(
"[class,load] com.greetings.Main source: shared objects file",
"[class,load] org.astro.World source: shared objects file");
// create an archive with two modular jars in the --module-path
output = TestCommon.createArchive(
null, appClasses,
"--module-path", jars,
"-m", MAIN_MODULE);
! TestCommon.checkDump(output);
// run with the above archive but with the modular jar containing the
// org.astro module in a different location.
// The org.astro.World class should be loaded from the jar.
// The Main class should still be loaded from the archive.
jars = destJar.toString() + System.getProperty("path.separator") +
mainJar.toString();
! TestCommon.runWithModules(prefix,
null, // --upgrade-module-path
jars, // --module-path
! MAIN_MODULE) // -m
! .assertNormalExit(out -> {
! out.shouldContain("[class,load] com.greetings.Main source: shared objects file")
.shouldMatch(".class.load. org.astro.World source:.*org.astro.jar");
+ });
}
}
test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File