changeset 14411:205520491a85

8190679: java/util/Arrays/TimSortStackSize2.java fails with "Initial heap size set to a larger value than the maximum heap size" Reviewed-by: dholmes
author iignatyev
date Tue, 27 Feb 2018 21:29:08 -0800
parents e28d44c42d62
children 11268469d375
files test/java/util/Arrays/TimSortStackSize2.java
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/util/Arrays/TimSortStackSize2.java	Tue Mar 24 03:46:57 2015 -0400
+++ b/test/java/util/Arrays/TimSortStackSize2.java	Tue Feb 27 21:29:08 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,8 @@
  * @library /lib/testlibrary /lib
  * @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
@@ -61,13 +62,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"
                 )
             );