--- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java 2018-10-29 14:02:50.565428168 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/ExerciseGC.java 2018-10-29 14:02:50.201413764 -0700 @@ -27,17 +27,17 @@ * @summary Exercise GC with shared strings * @requires vm.cds.archived.java.heap * @library /test/hotspot/jtreg/runtime/appcds /test/lib - * @modules java.base/jdk.internal.misc - * @modules java.management - * jdk.jartool/sun.tools.jar + * @modules jdk.jartool/sun.tools.jar * @build HelloStringGC sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * @run driver ExerciseGC - * @run main/othervm -XX:+UseStringDeduplication ExerciseGC - * @run main/othervm -XX:-CompactStrings ExerciseGC + * @run driver ExerciseGC -XX:+UseStringDeduplication + * @run driver ExerciseGC -XX:-CompactStrings */ public class ExerciseGC { public static void main(String[] args) throws Exception { + SharedStringsUtils.setVMOptionsPrefix(args); + SharedStringsUtils.buildJarAndWhiteBox("HelloStringGC"); SharedStringsUtils.dumpWithWhiteBox(TestCommon.list("HelloStringGC"), --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java 2018-10-29 14:02:51.557467424 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java 2018-10-29 14:02:51.197453177 -0700 @@ -59,10 +59,10 @@ "The shared archive file's CompactStrings setting .* does not equal the current CompactStrings setting"; static String appJar; - static String[] globalVmOptions; + static String[] vmOptionsPrefix = {}; public static void main(String[] args) throws Exception { - globalVmOptions = args; // specified by "@run main" in IncompatibleOptions_*.java + vmOptionsPrefix = args; // specified by "@run main" in IncompatibleOptions_*.java appJar = JarBuilder.build("IncompatibleOptions", "HelloString"); // Uncompressed OOPs @@ -118,7 +118,7 @@ System.out.println("Testcase: " + testCaseNr); OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list("Hello"), - TestCommon.concat(globalVmOptions, + TestCommon.concat(vmOptionsPrefix, "-XX:+UseCompressedOops", collectorOption, "-XX:SharedArchiveConfigFile=" + TestCommon.getSourceFile("SharedStringsBasic.txt"), @@ -145,12 +145,12 @@ // main class param, and fails with "Could not find or load main class" if (!extraOption.isEmpty()) { output = TestCommon.exec(appJar, - TestCommon.concat(globalVmOptions, + TestCommon.concat(vmOptionsPrefix, "-XX:+UseCompressedOops", collectorOption, "-Xlog:cds", extraOption, "HelloString")); } else { output = TestCommon.exec(appJar, - TestCommon.concat(globalVmOptions, + TestCommon.concat(vmOptionsPrefix, "-XX:+UseCompressedOops", collectorOption, "-Xlog:cds", "HelloString")); } --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java 2018-10-29 14:02:52.545506521 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/InternSharedString.java 2018-10-29 14:02:52.181492116 -0700 @@ -27,19 +27,18 @@ * @summary Test shared strings together with string intern operation * @requires vm.cds.archived.java.heap * @library /test/hotspot/jtreg/runtime/appcds /test/lib - * @modules java.base/jdk.internal.misc - * @modules java.management - * jdk.jartool/sun.tools.jar + * @modules jdk.jartool/sun.tools.jar * @compile InternStringTest.java * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * @run driver InternSharedString - * @run main/othervm -XX:+UseStringDeduplication InternSharedString - * @run main/othervm -XX:-CompactStrings InternSharedString + * @run driver InternSharedString -XX:+UseStringDeduplication + * @run driver InternSharedString -XX:-CompactStrings */ public class InternSharedString { public static void main(String[] args) throws Exception { + SharedStringsUtils.setVMOptionsPrefix(args); SharedStringsUtils.buildJarAndWhiteBox("InternStringTest"); SharedStringsUtils.dumpWithWhiteBox(TestCommon.list("InternStringTest"), --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java 2018-10-29 14:02:53.525545301 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java 2018-10-29 14:02:53.169531214 -0700 @@ -27,13 +27,11 @@ * @summary Check most common errors in file format * @requires vm.cds.archived.java.heap * @library /test/lib /test/hotspot/jtreg/runtime/appcds - * @modules java.base/jdk.internal.misc - * @modules java.management - * jdk.jartool/sun.tools.jar + * @modules jdk.jartool/sun.tools.jar * @build HelloString * @run driver InvalidFileFormat - * @run main/othervm -XX:+UseStringDeduplication InvalidFileFormat - * @run main/othervm -XX:-CompactStrings InvalidFileFormat + * @run driver InvalidFileFormat -XX:+UseStringDeduplication + * @run driver InvalidFileFormat -XX:-CompactStrings */ import java.io.File; @@ -46,6 +44,7 @@ // the previledge person in the server environment. public class InvalidFileFormat { public static void main(String[] args) throws Exception { + SharedStringsUtils.setVMOptionsPrefix(args); SharedStringsUtils.buildJar("HelloString"); test("NonExistentFile.txt", "Unable to get hashtable dump file size"); --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java 2018-10-29 14:02:54.469582656 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/LargePages.java 2018-10-29 14:02:54.105568253 -0700 @@ -27,17 +27,16 @@ * @summary Basic shared string test with large pages * @requires vm.cds.archived.java.heap * @library /test/lib /test/hotspot/jtreg/runtime/appcds - * @modules java.base/jdk.internal.misc - * @modules java.management - * jdk.jartool/sun.tools.jar + * @modules jdk.jartool/sun.tools.jar * @build HelloString * @run driver LargePages - * @run main/othervm -XX:+UseStringDeduplication LargePages - * @run main/othervm -XX:-CompactStrings LargePages + * @run driver LargePages -XX:+UseStringDeduplication + * @run driver LargePages -XX:-CompactStrings */ public class LargePages { static final String CDS_LOGGING = "-Xlog:cds,cds+hashtables"; public static void main(String[] args) throws Exception { + SharedStringsUtils.setVMOptionsPrefix(args); SharedStringsUtils.buildJar("HelloString"); SharedStringsUtils.dump(TestCommon.list("HelloString"), --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java 2018-10-29 14:02:55.453621595 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/LockSharedStrings.java 2018-10-29 14:02:55.089607191 -0700 @@ -27,19 +27,18 @@ * @summary Test locking on shared strings * @requires vm.cds.archived.java.heap * @library /test/hotspot/jtreg/runtime/appcds /test/lib - * @modules java.base/jdk.internal.misc - * @modules java.management - * jdk.jartool/sun.tools.jar + * @modules jdk.jartool/sun.tools.jar * @compile LockStringTest.java LockStringValueTest.java * @build sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * @run driver LockSharedStrings - * @run main/othervm -XX:+UseStringDeduplication LockSharedStrings - * @run main/othervm -XX:-CompactStrings LockSharedStrings + * @run driver LockSharedStrings -XX:+UseStringDeduplication + * @run driver LockSharedStrings -XX:-CompactStrings */ public class LockSharedStrings { public static void main(String[] args) throws Exception { + SharedStringsUtils.setVMOptionsPrefix(args); SharedStringsUtils.buildJarAndWhiteBox("LockStringTest", "LockStringValueTest"); SharedStringsUtils.dumpWithWhiteBox( --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java 2018-10-29 14:02:56.453661166 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasic.java 2018-10-29 14:02:56.097647079 -0700 @@ -27,13 +27,11 @@ * @summary Basic test for shared strings * @requires vm.cds.archived.java.heap * @library /test/hotspot/jtreg/runtime/appcds /test/lib - * @modules java.base/jdk.internal.misc - * @modules java.management - * jdk.jartool/sun.tools.jar + * @modules jdk.jartool/sun.tools.jar * @build HelloString * @run driver SharedStringsBasic - * @run main/othervm -XX:+UseStringDeduplication SharedStringsBasic - * @run main/othervm -XX:-CompactStrings SharedStringsBasic + * @run driver SharedStringsBasic -XX:+UseStringDeduplication + * @run driver SharedStringsBasic -XX:-CompactStrings */ import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; @@ -43,28 +41,32 @@ // - to provide sanity check and catch potential problems in the utils public class SharedStringsBasic { public static void main(String[] args) throws Exception { + String vmOptionsPrefix[] = args; + String appJar = JarBuilder.build("SharedStringsBasic", "HelloString"); String sharedArchiveConfigFile = TestCommon.getSourceFile("SharedStringsBasic.txt").toString(); ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true, + TestCommon.concat(vmOptionsPrefix, "-cp", appJar, "-XX:SharedArchiveConfigFile=" + sharedArchiveConfigFile, "-XX:SharedArchiveFile=./SharedStringsBasic.jsa", "-Xshare:dump", - "-Xlog:cds,cds+hashtables"); + "-Xlog:cds,cds+hashtables")); TestCommon.executeAndLog(dumpPb, "dump") .shouldContain("Shared string table stats") .shouldHaveExitValue(0); ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true, + TestCommon.concat(vmOptionsPrefix, "-cp", appJar, "-XX:SharedArchiveFile=./SharedStringsBasic.jsa", "-Xshare:auto", "-showversion", - "HelloString"); + "HelloString")); TestCommon.executeAndLog(runPb, "run").shouldHaveExitValue(0); } --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java 2018-10-29 14:02:57.441700263 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsBasicPlus.java 2018-10-29 14:02:57.085686176 -0700 @@ -27,20 +27,20 @@ * @summary Basic plus test for shared strings * @requires vm.cds.archived.java.heap * @library /test/hotspot/jtreg/runtime/appcds /test/lib - * @modules java.base/jdk.internal.misc - * @modules java.management - * jdk.jartool/sun.tools.jar + * @modules jdk.jartool/sun.tools.jar * @build HelloStringPlus sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox * @run driver SharedStringsBasicPlus - * @run main/othervm -XX:+UseStringDeduplication SharedStringsBasicPlus - * @run main/othervm -XX:-CompactStrings SharedStringsBasicPlus + * @run driver SharedStringsBasicPlus -XX:+UseStringDeduplication + * @run driver SharedStringsBasicPlus -XX:-CompactStrings */ public class SharedStringsBasicPlus { public static void main(String[] args) throws Exception { - SharedStringsUtils.buildJarAndWhiteBox("HelloStringPlus"); + SharedStringsUtils.setVMOptionsPrefix(args); + SharedStringsUtils.buildJarAndWhiteBox("HelloStringPlus"); + SharedStringsUtils.dumpWithWhiteBox( TestCommon.list("HelloStringPlus"), "SharedStringsBasic.txt", "-Xlog:cds,cds+hashtables"); --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java 2018-10-29 14:02:58.433739517 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsStress.java 2018-10-29 14:02:58.073725271 -0700 @@ -30,8 +30,8 @@ * @modules jdk.jartool/sun.tools.jar * @build HelloString * @run driver SharedStringsStress - * @run main/othervm -XX:+UseStringDeduplication SharedStringsStress - * @run main/othervm -XX:-CompactStrings SharedStringsStress + * @run driver SharedStringsStress -XX:+UseStringDeduplication + * @run driver SharedStringsStress -XX:-CompactStrings */ import java.io.File; import java.io.FileOutputStream; @@ -42,6 +42,7 @@ public class SharedStringsStress { public static void main(String[] args) throws Exception { + String vmOptionsPrefix[] = args; String appJar = JarBuilder.build("SharedStringsStress", "HelloString"); String sharedArchiveConfigFile = System.getProperty("user.dir") + File.separator + "SharedStringsStress_gen.txt"; @@ -58,9 +59,11 @@ } OutputAnalyzer dumpOutput = TestCommon.dump(appJar, TestCommon.list("HelloString"), - "-XX:SharedArchiveConfigFile=" + sharedArchiveConfigFile); + TestCommon.concat(vmOptionsPrefix, + "-XX:SharedArchiveConfigFile=" + sharedArchiveConfigFile)); TestCommon.checkDump(dumpOutput); - OutputAnalyzer execOutput = TestCommon.exec(appJar, "HelloString"); + OutputAnalyzer execOutput = TestCommon.exec(appJar, + TestCommon.concat(vmOptionsPrefix, "HelloString")); TestCommon.checkExec(execOutput); } } --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsUtils.java 2018-10-29 14:02:59.421778612 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsUtils.java 2018-10-29 14:02:59.057764208 -0700 @@ -30,6 +30,11 @@ public static final String TEST_JAR_NAME = "test"; public static final String TEST_JAR_NAME_FULL = "test.jar"; public static final String WHITEBOX_JAR_NAME = "whitebox"; + private static String vmOptionsPrefix[] = {}; + + static void setVMOptionsPrefix(String[] opts) { + vmOptionsPrefix = opts; + } public static String getWbParam() { return "-Xbootclasspath/a:" + TestCommon.getTestJar(WHITEBOX_JAR_NAME + ".jar"); @@ -55,6 +60,7 @@ TestCommon.concat(extraOptions, "-XX:+UseCompressedOops", "-XX:+UseG1GC", "-XX:SharedArchiveConfigFile=" + TestCommon.getSourceFile(sharedDataFile)); + args = TestCommon.concat(vmOptionsPrefix, args); return TestCommon.dump(appJar, appClasses, args); } @@ -80,6 +86,7 @@ String appJar = TestCommon.getTestJar(TEST_JAR_NAME_FULL); String[] args = TestCommon.concat(extraOptions, "-cp", appJar, "-XX:+UseCompressedOops", "-XX:+UseG1GC", className); + args = TestCommon.concat(vmOptionsPrefix, args); OutputAnalyzer output = TestCommon.execAuto(args); checkExecAuto(output); @@ -98,6 +105,7 @@ String appJar = TestCommon.getTestJar(TEST_JAR_NAME_FULL); String[] args = TestCommon.concat(extraOptions, "-XX:+UseCompressedOops", "-XX:+UseG1GC", className); + args = TestCommon.concat(vmOptionsPrefix, args); OutputAnalyzer output = TestCommon.exec(appJar, args); checkExec(output, extraMatches); --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java 2018-10-29 14:03:00.381816600 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/SharedStringsWbTest.java 2018-10-29 14:03:00.049803462 -0700 @@ -27,14 +27,12 @@ * @summary White box test for shared strings * @requires vm.cds.archived.java.heap * @library /test/lib /test/hotspot/jtreg/runtime/appcds - * @modules java.base/jdk.internal.misc - * @modules java.management - * jdk.jartool/sun.tools.jar + * @modules jdk.jartool/sun.tools.jar * @build sun.hotspot.WhiteBox SharedStringsWb * @run driver ClassFileInstaller sun.hotspot.WhiteBox * @run driver SharedStringsWbTest - * @run main/othervm -XX:+UseStringDeduplication SharedStringsWbTest - * @run main/othervm -XX:-CompactStrings SharedStringsWbTest + * @run driver SharedStringsWbTest -XX:+UseStringDeduplication + * @run driver SharedStringsWbTest -XX:-CompactStrings */ import java.io.*; @@ -42,6 +40,7 @@ public class SharedStringsWbTest { public static void main(String[] args) throws Exception { + SharedStringsUtils.setVMOptionsPrefix(args); SharedStringsUtils.buildJarAndWhiteBox("SharedStringsWb"); SharedStringsUtils.dumpWithWhiteBox(TestCommon.list("SharedStringsWb"), --- old/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java 2018-10-29 14:03:01.329854112 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java 2018-10-29 14:03:00.973840025 -0700 @@ -28,11 +28,9 @@ * @bug 8098821 * @requires vm.cds.archived.java.heap * @library /test/lib /test/hotspot/jtreg/runtime/appcds - * @modules java.base/jdk.internal.misc - * @modules java.management * @run driver SysDictCrash - * @run main/othervm -XX:+UseStringDeduplication SysDictCrash - * @run main/othervm -XX:-CompactStrings SysDictCrash + * @run driver SysDictCrash -XX:+UseStringDeduplication + * @run driver SysDictCrash -XX:-CompactStrings */ import jdk.test.lib.process.OutputAnalyzer; @@ -40,22 +38,26 @@ public class SysDictCrash { public static void main(String[] args) throws Exception { + String vmOptionsPrefix[] = args; + // SharedBaseAddress=0 puts the archive at a very high address on solaris, // which provokes the crash. ProcessBuilder dumpPb = ProcessTools.createJavaProcessBuilder(true, + TestCommon.concat(vmOptionsPrefix, "-XX:+UseG1GC", "-XX:MaxRAMPercentage=12.5", "-cp", ".", "-XX:SharedBaseAddress=0", "-XX:SharedArchiveFile=./SysDictCrash.jsa", "-Xshare:dump", - "-showversion", "-Xlog:cds,cds+hashtables"); + "-showversion", "-Xlog:cds,cds+hashtables")); TestCommon.checkDump(TestCommon.executeAndLog(dumpPb, "dump")); ProcessBuilder runPb = ProcessTools.createJavaProcessBuilder(true, + TestCommon.concat(vmOptionsPrefix, "-XX:+UseG1GC", "-XX:MaxRAMPercentage=12.5", "-XX:SharedArchiveFile=./SysDictCrash.jsa", "-Xshare:on", - "-version"); + "-version")); TestCommon.checkExec(TestCommon.executeAndLog(runPb, "exec")); }