< prev index next >
test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP.java
Print this page
*** 102,134 ****
OutputAnalyzer output = TestCommon.createArchive(
null, appClasses,
"--module-path", moduleDir.toString(),
"-m", MAIN_MODULE);
TestCommon.checkDump(output);
! String prefix[] = {"-Djava.class.path=", "-Xlog:class+load=trace"};
prefix = TestCommon.concat(prefix, extra_runtime_args);
// 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();
--- 102,136 ----
OutputAnalyzer output = TestCommon.createArchive(
null, appClasses,
"--module-path", moduleDir.toString(),
"-m", MAIN_MODULE);
TestCommon.checkDump(output);
! String prefix[] = {"-Djava.class.path=", "-Xlog:cds,class+load=trace"};
prefix = TestCommon.concat(prefix, extra_runtime_args);
// 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")
! .shouldContain("--module-path = " + moduleDir.toString());
});
// 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")
! .shouldContain("--module-path = " + moduleDir2.toString());
});
// create an archive with modular jar files in both -cp and --module-path
String jars = subJar.toString() + System.getProperty("path.separator") +
mainJar.toString();
*** 141,168 ****
// 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,
--- 143,172 ----
// 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:cds,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")
! .shouldContain("--module-path = " + moduleDir.toString());
});
// similar to the above case but without the main class name. The classes
// should be loaded from the archive.
! TestCommon.run("-Xlog:cds,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",
! "--module-path = " + moduleDir.toString());
// create an archive with two modular jars in the --module-path
output = TestCommon.createArchive(
null, appClasses,
"--module-path", jars,
*** 171,187 ****
// 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");
});
}
}
--- 175,204 ----
// 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.
! final String mjars = destJar.toString() + System.getProperty("path.separator") +
mainJar.toString();
TestCommon.runWithModules(prefix,
null, // --upgrade-module-path
! mjars, // --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")
! .shouldContain("--module-path = " + mjars);
});
+ // run with CDS off, '--module-path = <path>' should not be printed out on output
+ output = TestCommon.exec(mjars,
+ "-Xshare:off",
+ "-Xlog:cds,class+load=trace",
+ "--module-path",
+ mjars,
+ "-m",
+ MAIN_MODULE);
+ output.shouldNotContain("sharing");
+ output.shouldNotContain("--module-path = " + mjars);
+ output.shouldMatch(".class,load. com.greetings.Main source: .*com.greetings.jar");
+ output.shouldMatch(".class.load. org.astro.World source:.*org.astro.jar");
}
}
< prev index next >