< prev index next > test/hotspot/jtreg/runtime/cds/appcds/jigsaw/module/ModuleOption.java
Print this page
// Pattern of a module version string.
// e.g. JDK 22: "java 22"
// JDK 22.0.1: "java 22.0.1"
final String versionPattern = "java.[0-9][0-9].*";
final String subgraphCannotBeUsed = "subgraph jdk.internal.module.ArchivedBootLayer cannot be used because full module graph is disabled";
+ final String noOptimizedModuleHandling = "optimized module handling: disabled because archive was created without optimized module handling";
String archiveName = TestCommon.getNewArchiveName("module-option");
TestCommon.setCurrentArchiveName(archiveName);
// dump a base archive with -m jdk.httpserver
OutputAnalyzer oa = TestCommon.dumpBaseArchive(
loggingOption,
"-m", moduleOption,
"-version");
oa.shouldHaveExitValue(0)
// version of the jdk.httpserver module, e.g. java 22-ea
! .shouldMatch(versionPattern)
! .shouldMatch("cds,module.*Restored from archive: entry.0x.*name jdk.httpserver");
// different module specified during runtime
oa = TestCommon.execCommon(
loggingOption,
"-m", "jdk.compiler/com.sun.tools.javac.Main",
"-version");
oa.shouldHaveExitValue(0)
! .shouldContain("Mismatched modules: runtime jdk.compiler dump time jdk.httpserver")
! .shouldContain(subgraphCannotBeUsed);
// no module specified during runtime
oa = TestCommon.execCommon(
loggingOption,
"-version");
oa.shouldHaveExitValue(0)
! .shouldContain("Module jdk.httpserver specified during dump time but not during runtime")
! .shouldContain(subgraphCannotBeUsed);
// dump an archive without the module option
archiveName = TestCommon.getNewArchiveName("no-module-option");
TestCommon.setCurrentArchiveName(archiveName);
oa = TestCommon.dumpBaseArchive(
loggingOption,
"-m", moduleOption,
"-version");
oa.shouldHaveExitValue(0)
// version of the jdk.httpserver module, e.g. java 22-ea
! .shouldMatch(versionPattern);
! if (!oa.contains(noOptimizedModuleHandling)) {
+ oa.shouldMatch("cds,module.*Restored from archive: entry.0x.*name jdk.httpserver");
+ }
// different module specified during runtime
oa = TestCommon.execCommon(
loggingOption,
"-m", "jdk.compiler/com.sun.tools.javac.Main",
"-version");
oa.shouldHaveExitValue(0)
! .shouldContain("Mismatched modules: runtime jdk.compiler dump time jdk.httpserver");
! if (!oa.contains(noOptimizedModuleHandling)) {
+ oa.shouldContain(subgraphCannotBeUsed);
+ }
// no module specified during runtime
oa = TestCommon.execCommon(
loggingOption,
"-version");
oa.shouldHaveExitValue(0)
! .shouldContain("Module jdk.httpserver specified during dump time but not during runtime");
! if (!oa.contains(noOptimizedModuleHandling)) {
+ oa.shouldContain(subgraphCannotBeUsed);
+ }
// dump an archive without the module option
archiveName = TestCommon.getNewArchiveName("no-module-option");
TestCommon.setCurrentArchiveName(archiveName);
oa = TestCommon.dumpBaseArchive(
"-m", moduleOption,
"-version");
oa.shouldHaveExitValue(0)
.shouldContain("Module jdk.httpserver specified during runtime but not during dump time")
// version of the jdk.httpserver module, e.g. java 22-ea
! .shouldMatch(versionPattern)
! .shouldContain(subgraphCannotBeUsed);
// dump an archive with an incubator module, -m jdk.incubator.vector
archiveName = TestCommon.getNewArchiveName("incubator-module");
TestCommon.setCurrentArchiveName(archiveName);
oa = TestCommon.dumpBaseArchive(
"-m", moduleOption,
"-version");
oa.shouldHaveExitValue(0)
.shouldContain("Module jdk.httpserver specified during runtime but not during dump time")
// version of the jdk.httpserver module, e.g. java 22-ea
! .shouldMatch(versionPattern);
! if (!oa.contains(noOptimizedModuleHandling)) {
+ oa.shouldContain(subgraphCannotBeUsed);
+ }
// dump an archive with an incubator module, -m jdk.incubator.vector
archiveName = TestCommon.getNewArchiveName("incubator-module");
TestCommon.setCurrentArchiveName(archiveName);
oa = TestCommon.dumpBaseArchive(
< prev index next >