8234304: runtime/cds/appcds/javaldr tests should use driver mode
authoriignatyev
Mon, 18 Nov 2019 14:13:11 -0800
changeset 59129 d8eddc0ba770
parent 59128 ac11b83e0f38
child 59130 601b3fe3786d
8234304: runtime/cds/appcds/javaldr tests should use driver mode Reviewed-by: iklam, mseledtsov
test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDump.java
test/hotspot/jtreg/runtime/cds/appcds/javaldr/ArrayTest.java
test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCDuringDump.java
test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java
test/hotspot/jtreg/runtime/cds/appcds/javaldr/HumongousDuringDump.java
--- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDump.java	Mon Nov 18 13:22:27 2019 +0100
+++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDump.java	Mon Nov 18 14:13:11 2019 -0800
@@ -32,16 +32,15 @@
  * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds /test/hotspot/jtreg/runtime/cds/appcds/test-classes
  * @requires vm.cds
  * @requires vm.flavor != "minimal"
- * @build AnonVmClassesDuringDumpTransformer Hello
- * @run main/othervm AnonVmClassesDuringDump
+ * @run driver AnonVmClassesDuringDump
  */
 
 public class AnonVmClassesDuringDump {
     public static String appClasses[] = {
-        "Hello",
+        Hello.class.getName(),
     };
     public static String agentClasses[] = {
-        "AnonVmClassesDuringDumpTransformer",
+        AnonVmClassesDuringDumpTransformer.class.getName(),
     };
 
     public static String cdsDiagnosticOption = "-XX:+AllowArchivingWithJavaAgent";
@@ -55,7 +54,7 @@
         String appJar =
             ClassFileInstaller.writeJar("AnonVmClassesDuringDumpApp.jar", appClasses);
 
-        TestCommon.testDump(appJar, TestCommon.list("Hello"),
+        TestCommon.testDump(appJar, TestCommon.list(Hello.class.getName()),
                             "-javaagent:" + agentJar,
                             "-XX:+UnlockDiagnosticVMOptions", cdsDiagnosticOption,
                             // Set the following property to see logs for dynamically generated classes
@@ -71,13 +70,13 @@
         String pattern = prefix + class_pattern + suffix;
         // during run time, anonymous classes shouldn't be loaded from the archive
         TestCommon.run("-cp", appJar,
-            "-XX:+UnlockDiagnosticVMOptions", cdsDiagnosticOption, "Hello")
+            "-XX:+UnlockDiagnosticVMOptions", cdsDiagnosticOption, Hello.class.getName())
             .assertNormalExit(output -> output.shouldNotMatch(pattern));
 
         // inspect the archive and make sure no anonymous class is in there
         TestCommon.run("-cp", appJar,
             "-XX:+UnlockDiagnosticVMOptions", cdsDiagnosticOption,
-            "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary", "Hello")
+            "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary", Hello.class.getName())
             .assertNormalExit(output -> output.shouldNotMatch(class_pattern));
     }
 }
--- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/ArrayTest.java	Mon Nov 18 13:22:27 2019 +0100
+++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/ArrayTest.java	Mon Nov 18 14:13:11 2019 -0800
@@ -28,7 +28,6 @@
  * @requires vm.cds
  * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
  * @modules jdk.jartool/sun.tools.jar
- * @compile ArrayTestHelper.java
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  * @run driver ArrayTest
@@ -41,7 +40,7 @@
 public class ArrayTest {
 
     static String arrayClasses[] = {
-        "ArrayTestHelper",
+        ArrayTestHelper.class.getName(),
         "[Ljava/lang/Comparable;",
         "[I",
         "[[[Ljava/lang/Object;",
@@ -70,7 +69,7 @@
         argsList.add("-cp");
         argsList.add(appJar);
         argsList.add(bootClassPath);
-        argsList.add("ArrayTestHelper");
+        argsList.add(ArrayTestHelper.class.getName());
         // the following are input args to the ArrayTestHelper.
         // skip checking array classes during run time
         for (int i = 0; i < 1; i++) {
--- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCDuringDump.java	Mon Nov 18 13:22:27 2019 +0100
+++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCDuringDump.java	Mon Nov 18 14:13:11 2019 -0800
@@ -28,8 +28,7 @@
  * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds /test/hotspot/jtreg/runtime/cds/appcds/test-classes
  * @requires vm.cds
  * @requires vm.flavor != "minimal"
- * @build GCDuringDumpTransformer Hello
- * @run main/othervm GCDuringDump
+ * @run driver GCDuringDump
  */
 
 import jdk.test.lib.cds.CDSOptions;
@@ -38,10 +37,10 @@
 
 public class GCDuringDump {
     public static String appClasses[] = {
-        "Hello",
+        Hello.class.getName(),
     };
     public static String agentClasses[] = {
-        "GCDuringDumpTransformer",
+        GCDuringDumpTransformer.class.getName(),
     };
 
     public static void main(String[] args) throws Throwable {
@@ -63,7 +62,7 @@
             String extraArg = (i == 0) ? "-showversion" : "-javaagent:" + agentJar;
             String extraOption = (i == 0) ? "-showversion" : "-XX:+AllowArchivingWithJavaAgent";
 
-            TestCommon.testDump(appJar, TestCommon.list("Hello"),
+            TestCommon.testDump(appJar, TestCommon.list(Hello.class.getName()),
                                 "-XX:+UnlockDiagnosticVMOptions", extraOption,
                                 extraArg, "-Xmx32m", gcLog);
 
@@ -73,7 +72,7 @@
                 "-XX:+PrintSharedSpaces",
                 "-XX:+UnlockDiagnosticVMOptions", extraOption,
                 gcLog,
-                "Hello")
+                Hello.class.getName())
               .assertNormalExit();
         }
     }
--- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java	Mon Nov 18 13:22:27 2019 +0100
+++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCSharedStringsDuringDump.java	Mon Nov 18 14:13:11 2019 -0800
@@ -29,9 +29,9 @@
  * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds /test/hotspot/jtreg/runtime/cds/appcds/test-classes
  * @requires vm.cds.archived.java.heap
  * @modules jdk.jartool/sun.tools.jar
- * @build sun.hotspot.WhiteBox GCDuringDumpTransformer GCSharedStringsDuringDumpWb
+ * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm/timeout=480 GCSharedStringsDuringDump
+ * @run driver/timeout=480 GCSharedStringsDuringDump
  */
 
 import java.io.File;
@@ -41,14 +41,13 @@
 import jdk.test.lib.cds.CDSOptions;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import sun.hotspot.WhiteBox;
 
 public class GCSharedStringsDuringDump {
     public static String appClasses[] = {
-        "GCSharedStringsDuringDumpWb",
+        GCSharedStringsDuringDumpWb.class.getName(),
     };
     public static String agentClasses[] = {
-        "GCDuringDumpTransformer",
+        GCDuringDumpTransformer.class.getName(),
     };
 
     public static void main(String[] args) throws Throwable {
@@ -88,7 +87,7 @@
             String extraArg = (i == 0) ? "-showversion" : "-javaagent:" + agentJar;
             String extraOption = (i == 0) ? "-showversion" : "-XX:+AllowArchivingWithJavaAgent";
             OutputAnalyzer output = TestCommon.dump(
-                                appJar, TestCommon.list("GCSharedStringsDuringDumpWb"),
+                                appJar, TestCommon.list(GCSharedStringsDuringDumpWb.class.getName()),
                                 bootClassPath, extraArg, "-Xmx32m", gcLog,
                                 "-XX:SharedArchiveConfigFile=" + sharedArchiveCfgFile,
                                 "-XX:+UnlockDiagnosticVMOptions", extraOption);
@@ -101,7 +100,7 @@
                 // Try again with larger heap and NewSize, this should increase the
                 // G1 heap region size to 2M
                 TestCommon.testDump(
-                    appJar, TestCommon.list("GCSharedStringsDuringDumpWb"),
+                    appJar, TestCommon.list(GCSharedStringsDuringDumpWb.class.getName()),
                     bootClassPath, extraArg, "-Xmx8g", "-XX:NewSize=8m", gcLog,
                     "-XX:SharedArchiveConfigFile=" + sharedArchiveCfgFile,
                     "-XX:+UnlockDiagnosticVMOptions", extraOption);
@@ -119,7 +118,7 @@
                 "-XX:+WhiteBoxAPI",
                 "-XX:SharedReadOnlySize=30m",
                 gcLog,
-                "GCSharedStringsDuringDumpWb")
+                GCSharedStringsDuringDumpWb.class.getName())
               .assertNormalExit();
         }
     }
--- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/HumongousDuringDump.java	Mon Nov 18 13:22:27 2019 +0100
+++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/HumongousDuringDump.java	Mon Nov 18 14:13:11 2019 -0800
@@ -28,8 +28,7 @@
  * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds /test/hotspot/jtreg/runtime/cds/appcds/test-classes
  * @requires vm.cds.archived.java.heap
  * @requires vm.flavor != "minimal"
- * @build HumongousDuringDumpTransformer Hello
- * @run main/othervm/timeout=240 HumongousDuringDump
+ * @run driver/timeout=240 HumongousDuringDump
  */
 
 import jdk.test.lib.cds.CDSOptions;
@@ -38,10 +37,10 @@
 
 public class HumongousDuringDump {
     public static String appClasses[] = {
-        "Hello",
+        Hello.class.getName(),
     };
     public static String agentClasses[] = {
-        "HumongousDuringDumpTransformer",
+        HumongousDuringDumpTransformer.class.getName(),
     };
 
     public static void main(String[] args) throws Throwable {
@@ -60,7 +59,7 @@
         String extraOption = "-XX:+AllowArchivingWithJavaAgent";
 
         OutputAnalyzer out =
-          TestCommon.testDump(appJar, TestCommon.list("Hello"),
+          TestCommon.testDump(appJar, TestCommon.list(Hello.class.getName()),
                               "-XX:+UnlockDiagnosticVMOptions", extraOption,
                               "-Xlog:gc+region+cds",
                               "-Xlog:gc+region=trace",
@@ -79,7 +78,7 @@
                 "-XX:+PrintSharedSpaces",
                 "-XX:+UnlockDiagnosticVMOptions", extraOption,
                 gcLog,
-                "Hello")
+                Hello.class.getName())
               .assertNormalExit();
     }
 }