8231367: [TESTBUG] ParallelLoadTest.java fails with "test.dynamic.dump not supported"
authoriklam
Tue, 24 Sep 2019 10:36:35 -0700
changeset 58300 c3b93d6603f5
parent 58299 6df94ce3ab2f
child 58307 aebc7040a250
child 58308 b7192797f434
8231367: [TESTBUG] ParallelLoadTest.java fails with "test.dynamic.dump not supported" Reviewed-by: ccheung
test/hotspot/jtreg/runtime/cds/appcds/ParallelLoadTest.java
test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java
--- a/test/hotspot/jtreg/runtime/cds/appcds/ParallelLoadTest.java	Tue Sep 24 12:47:15 2019 -0400
+++ b/test/hotspot/jtreg/runtime/cds/appcds/ParallelLoadTest.java	Tue Sep 24 10:36:35 2019 -0700
@@ -33,6 +33,8 @@
  * @run driver ParallelLoadTest
  */
 
+import java.io.File;
+
 public class ParallelLoadTest {
     public static final int MAX_CLASSES = 40;
 
@@ -47,39 +49,36 @@
     private static final int BOOT_LOOPS = Integer.parseInt(System.getProperty("ParallelLoadTest.boot.loops", "1"));
 
     public static void main(String[] args) throws Exception {
-        JarBuilder.build("parallel_load", getClassList(true));
-        String testJar = TestCommon.getTestJar("parallel_load.jar");
+        JarBuilder.build("parallel_load_app", "ParallelLoad", "ParallelLoadThread", "ParallelLoadWatchdog");
+        JarBuilder.build("parallel_load_classes", getClassList());
+        String appJar     = TestCommon.getTestJar("parallel_load_app.jar");
+        String classesJar = TestCommon.getTestJar("parallel_load_classes.jar");
 
         // (1) Load the classes from app class loader
-        TestCommon.testDump(testJar, getClassList(false));
+        String CP = appJar + File.pathSeparator + classesJar;
+        TestCommon.testDump(CP, getClassList());
         for (int i = 0; i < APP_LOOPS; i++) {
-            TestCommon.run("-cp", testJar,  "ParallelLoad").assertNormalExit();
+            TestCommon.run("-cp", CP,  "ParallelLoad").assertNormalExit();
         }
 
         // (2) Load the classes from boot class loader
-        String bootcp = "-Xbootclasspath/a:" + testJar;
-        TestCommon.testDump(null, getClassList(false), bootcp);
+        String bootcp = "-Xbootclasspath/a:" + classesJar;
+        TestCommon.testDump(appJar, getClassList(), bootcp);
         for (int i = 0; i < BOOT_LOOPS; i++) {
-            TestCommon.run(bootcp,
+            TestCommon.run(bootcp, "-cp", appJar,
                            // "-Xlog:class+load=debug",
                            "ParallelLoad").assertNormalExit();
         }
     }
 
-    private static String[] getClassList(boolean includeWatchdog) {
-        int extra = includeWatchdog ? 3 : 2;
-        String[] classList = new String[MAX_CLASSES + extra];
+    private static String[] getClassList() {
+        String[] classList = new String[MAX_CLASSES];
 
         int i;
         for (i = 0; i < MAX_CLASSES; i++) {
             classList[i] = "ParallelClass" + i;
         }
 
-        classList[i++] = "ParallelLoad";
-        classList[i++] = "ParallelLoadThread";
-        if (includeWatchdog)
-            classList[i++] = "ParallelLoadWatchdog";
-
         return classList;
     }
 }
--- a/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java	Tue Sep 24 12:47:15 2019 -0400
+++ b/test/hotspot/jtreg/runtime/cds/appcds/TestCommon.java	Tue Sep 24 10:36:35 2019 -0700
@@ -218,7 +218,7 @@
                 if (!mainModuleSpecified && !patchModuleSpecified) {
                     // If you have an empty classpath, you cannot specify a classlist!
                     if (opts.classList != null && opts.classList.length > 0) {
-                        throw new RuntimeException("test.dynamic.dump not supported empty classpath with non-empty classlist");
+                        throw new RuntimeException("test.dynamic.dump is not supported with an empty classpath while the classlist is not empty");
                     }
                     cmd.add("-version");
                 }