changeset 59202:948012822469

8225219: [TESTBUG] AppCDS tests timed out with -Xcomp and --limit-modules option won't work with Graal Reviewed-by: kvn, iklam, iignatyev
author ccheung
date Fri, 06 Dec 2019 09:09:33 -0800
parents ee448a1f33cc
children 31f9903f0838
files test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/MainModuleOnly.java test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/MainModuleOnly.java test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP_JFR.java
diffstat 3 files changed, 58 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/MainModuleOnly.java	Fri Dec 06 14:17:25 2019 +0000
+++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/MainModuleOnly.java	Fri Dec 06 09:09:33 2019 -0800
@@ -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 @@
                    .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 @@
             .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");
+        }
     }
 }
--- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/MainModuleOnly.java	Fri Dec 06 14:17:25 2019 +0000
+++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/MainModuleOnly.java	Fri Dec 06 09:09:33 2019 -0800
@@ -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 @@
                    .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 @@
         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");
+        }
     }
 }
--- a/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP_JFR.java	Fri Dec 06 14:17:25 2019 +0000
+++ b/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/ModulePathAndCP_JFR.java	Fri Dec 06 09:09:33 2019 -0800
@@ -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.