test/lib/jdk/test/lib/cds/CDSTestUtils.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
open Cdiff test/lib/jdk/test/lib/cds/CDSTestUtils.java
test/lib/jdk/test/lib/cds/CDSTestUtils.java
Print this page
rev 49650 : [mq]: module_path
*** 115,134 ****
private final OutputAnalyzer output;
private final CDSOptions options;
private final boolean hasMappingFailure;
private final boolean hasAbnormalExit;
private final boolean hasNormalExit;
public Result(CDSOptions opts, OutputAnalyzer out) throws Exception {
options = opts;
output = out;
hasMappingFailure = CDSTestUtils.checkCommonExecExceptions(output);
hasAbnormalExit = (!hasMappingFailure) && (output.getExitValue() != 0);
hasNormalExit = (!hasMappingFailure) && (output.getExitValue() == 0);
if (hasNormalExit) {
! if ("on".equals(options.xShareMode) && output.getStderr().contains("java version")) {
// "-showversion" is always passed in the command-line by the execXXX methods.
// During normal exit, we require that the VM to show that sharing was enabled.
output.shouldContain("sharing");
}
}
--- 115,137 ----
private final OutputAnalyzer output;
private final CDSOptions options;
private final boolean hasMappingFailure;
private final boolean hasAbnormalExit;
private final boolean hasNormalExit;
+ private final String CDS_DISABLED = "warning: CDS is disabled when the";
public Result(CDSOptions opts, OutputAnalyzer out) throws Exception {
options = opts;
output = out;
hasMappingFailure = CDSTestUtils.checkCommonExecExceptions(output);
hasAbnormalExit = (!hasMappingFailure) && (output.getExitValue() != 0);
hasNormalExit = (!hasMappingFailure) && (output.getExitValue() == 0);
if (hasNormalExit) {
! if ("on".equals(options.xShareMode) &&
! output.getStderr().contains("java version") &&
! !output.getStderr().contains(CDS_DISABLED)) {
// "-showversion" is always passed in the command-line by the execXXX methods.
// During normal exit, we require that the VM to show that sharing was enabled.
output.shouldContain("sharing");
}
}
*** 148,157 ****
--- 151,180 ----
output.shouldNotHaveExitValue(0);
}
return this;
}
+ // When {--limit-modules, --patch-module, and/or --upgrade-module-path}
+ // are specified, CDS is silently disabled for both -Xshare:auto and -Xshare:on.
+ public Result assertSilentlyDisabledCDS(Checker checker) throws Exception {
+ if (hasMappingFailure) {
+ throw new RuntimeException("Unexpected mapping failure");
+ }
+ // this comes from a JVM warning message.
+ output.shouldContain(CDS_DISABLED);
+
+ checker.check(output);
+ return this;
+ }
+
+ public Result assertSilentlyDisabledCDS(int exitCode, String... matches) throws Exception {
+ return assertSilentlyDisabledCDS((out) -> {
+ out.shouldHaveExitValue(exitCode);
+ checkMatches(out, matches);
+ });
+ }
+
public Result ifNormalExit(Checker checker) throws Exception {
if (hasNormalExit) {
checker.check(output);
}
return this;
test/lib/jdk/test/lib/cds/CDSTestUtils.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File