8190679: java/util/Arrays/TimSortStackSize2.java fails with "Initial heap size set to a larger value than the maximum heap size"
authoriignatyev
Tue, 27 Feb 2018 21:29:08 -0800
changeset 49178 1836bf0c820a
parent 49177 eebf559c9e0d
child 49179 4b273ed9a82d
8190679: java/util/Arrays/TimSortStackSize2.java fails with "Initial heap size set to a larger value than the maximum heap size" Reviewed-by: dholmes
test/jdk/java/util/Arrays/TimSortStackSize2.java
--- a/test/jdk/java/util/Arrays/TimSortStackSize2.java	Tue Feb 27 18:17:57 2018 -0500
+++ b/test/jdk/java/util/Arrays/TimSortStackSize2.java	Tue Feb 27 21:29:08 2018 -0800
@@ -29,7 +29,8 @@
  *          java.base/jdk.internal
  * @build jdk.testlibrary.*
  * @build TimSortStackSize2
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *     -XX:+WhiteBoxAPI TimSortStackSize2
  * @summary Test TimSort stack size on big arrays
@@ -63,13 +64,14 @@
         try {
             Boolean compressedOops = WhiteBox.getWhiteBox()
                 .getBooleanVMFlag("UseCompressedOops");
-            final String xmsValue = "-Xms" +
-                ((compressedOops == null || compressedOops) ? "385" : "770")
-                + "m";
-            System.out.println( "compressedOops: " + compressedOops
-                + "; Test will be started with \"" + xmsValue + "\"");
+            long memory = (compressedOops == null || compressedOops) ? 385 : 770;
+            final String xmsValue = "-Xms" + memory + "m";
+            final String xmxValue = "-Xmx" + memory + "m";
+
+            System.out.printf("compressedOops: %s; Test will be started with \"%s %s\"%n",
+                              compressedOops, xmsValue, xmxValue);
             ProcessBuilder processBuilder = ProcessTools
-                .createJavaProcessBuilder(Utils.addTestJavaOpts(xmsValue,
+                .createJavaProcessBuilder(Utils.addTestJavaOpts(xmsValue, xmxValue,
                     "TimSortStackSize2", "67108864"
                 )
             );