8225219: [TESTBUG] AppCDS tests timed out with -Xcomp and --limit-modules option won't work with Graal

Reviewed-by: kvn, iklam, iignatyev
This commit is contained in:
Calvin Cheung 2019-12-06 09:09:33 -08:00
parent b96610d017
commit 4abba17c10
3 changed files with 58 additions and 28 deletions

View File

@ -27,7 +27,9 @@
* @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
* @modules jdk.jartool/sun.tools.jar
* @run driver MainModuleOnly
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MainModuleOnly
* @summary Test some scenarios with a main modular jar specified in the --module-path and -cp options in the command line.
*/
@ -40,6 +42,9 @@ import java.util.Arrays;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jtreg.SkippedException;
import sun.hotspot.code.Compiler;
public class MainModuleOnly extends DynamicArchiveTestBase {
private static final Path USER_DIR = Paths.get(System.getProperty("user.dir"));
@ -155,20 +160,26 @@ public class MainModuleOnly extends DynamicArchiveTestBase {
.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.
run2(null, topArchiveName,
"-Xlog:cds+dynamic=debug,cds=debug,class+load=trace",
"-cp", destJar.toString(),
"--limit-modules", "java.base," + TEST_MODULE1,
"--module-path", moduleDir.toString(),
"-m", TEST_MODULE1)
.assertSilentlyDisabledCDS(out -> {
out.shouldHaveExitValue(0)
.shouldMatch("CDS is disabled when the.*option is specified")
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
boolean skippedTest = false;
if (!Compiler.isGraalEnabled()) {
// 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.
run2(null, topArchiveName,
"-Xlog:cds+dynamic=debug,cds=debug,class+load=trace",
"-cp", destJar.toString(),
"--limit-modules", "java.base," + TEST_MODULE1,
"--module-path", moduleDir.toString(),
"-m", TEST_MODULE1)
.assertSilentlyDisabledCDS(out -> {
out.shouldHaveExitValue(0)
.shouldMatch("CDS is disabled when the.*option is specified")
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
});
} else {
skippedTest = true;
}
// 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.
@ -253,5 +264,9 @@ public class MainModuleOnly extends DynamicArchiveTestBase {
.ifAbnormalExit(output -> {
output.shouldMatch("os::stat error.*CDS dump aborted");
});
if (skippedTest) {
throw new SkippedException("Skipped --limit-modules test; it can't be run with Graal enabled");
}
}
}

View File

@ -27,7 +27,9 @@
* @requires vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
* @modules jdk.jartool/sun.tools.jar
* @run main/othervm MainModuleOnly
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=480 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MainModuleOnly
* @summary Test some scenarios with a main modular jar specified in the --module-path and -cp options in the command line.
*/
@ -41,6 +43,9 @@ import jdk.test.lib.cds.CDSTestUtils.Result;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jtreg.SkippedException;
import sun.hotspot.code.Compiler;
public class MainModuleOnly {
private static final Path USER_DIR = Paths.get(System.getProperty("user.dir"));
@ -137,19 +142,25 @@ public class MainModuleOnly {
.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.
TestCommon.run("-Xlog:class+load=trace",
"-cp", destJar.toString(),
"--limit-modules", "java.base," + TEST_MODULE1,
"--module-path", moduleDir.toString(),
"-m", TEST_MODULE1)
.assertSilentlyDisabledCDS(out -> {
out.shouldHaveExitValue(0)
.shouldMatch("CDS is disabled when the.*option is specified")
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
boolean skippedTest = false;
if (!Compiler.isGraalEnabled()) {
// 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.
TestCommon.run("-Xlog:class+load=trace",
"-cp", destJar.toString(),
"--limit-modules", "java.base," + TEST_MODULE1,
"--module-path", moduleDir.toString(),
"-m", TEST_MODULE1)
.assertSilentlyDisabledCDS(out -> {
out.shouldHaveExitValue(0)
.shouldMatch("CDS is disabled when the.*option is specified")
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
});
} else {
skippedTest = true;
}
// 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.
@ -230,5 +241,9 @@ public class MainModuleOnly {
if (output.getExitValue() != 0) {
output.shouldMatch("os::stat error.*CDS dump aborted");
}
if (skippedTest) {
throw new SkippedException("Skipped --limit-modules test; it can't be run with Graal enabled");
}
}
}

View File

@ -27,7 +27,7 @@
* @requires vm.hasJFR & vm.cds
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
* @modules jdk.jartool/sun.tools.jar
* @run driver ModulePathAndCP_JFR
* @run driver/timeout=480 ModulePathAndCP_JFR
* @summary Same as ModulePathAndCP, but add -XX:StartFlightRecording=dumponexit=true to the runtime
* options. This makes sure that the shared classes are compatible with both
* JFR and JVMTI ClassFileLoadHook.