Skip to content
Permalink
Browse files

8225219: [TESTBUG] AppCDS tests timed out with -Xcomp and --limit-mod…

…ules option won't work with Graal

Reviewed-by: kvn, iklam, iignatyev
  • Loading branch information
calvinccheung committed Dec 6, 2019
1 parent b96610d commit 4abba17c105ce5156be221fa652d9c6b5a9f728a
@@ -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 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 static void doTest(String topArchiveName) throws Exception {
.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 static void doTest(String topArchiveName) throws Exception {
.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");
}
}
}
@@ -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.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 static void main(String... args) throws Exception {
.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 static void main(String... args) throws Exception {
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");
}
}
}
@@ -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.

0 comments on commit 4abba17

Please sign in to comment.
You can’t perform that action at this time.