changeset 29017:4d33318f0574

8072835: sun/tools/jmap/heapconfig/JMapHeapConfigTest.java Key MaxHeapSize doesnt match Summary: Make sure that maxheapsize is set explicitly in command line Reviewed-by: sla, ykantser
author dsamersoff
date Wed, 18 Feb 2015 03:16:48 -0800
parents f14b019bfdfa
children 7f7b6d9e9461
files jdk/test/sun/tools/jmap/heapconfig/JMapHeapConfigTest.java
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/sun/tools/jmap/heapconfig/JMapHeapConfigTest.java	Wed Feb 18 11:18:00 2015 +0100
+++ b/jdk/test/sun/tools/jmap/heapconfig/JMapHeapConfigTest.java	Wed Feb 18 03:16:48 2015 -0800
@@ -55,6 +55,8 @@
 
     // ignoring MaxMetaspaceSize
 
+    static final String desiredMaxHeapSize = "-Xmx128m";
+
     private static Map<String, String> parseJMapOutput(List<String> jmapOutput) {
         Map<String, String> heapConfigMap = new HashMap<String, String>();
         boolean shouldParse = false;
@@ -110,9 +112,23 @@
     public static void main(String[] args) {
         System.out.println("Starting JMapHeapConfigTest");
 
+        boolean mx_found = false;
+        List<String> jvmOptions = Utils.getVmOptions();
+        for (String option : jvmOptions) {
+            if (option.startsWith("-Xmx")) {
+               System.out.println("INFO: maximum heap size set by JTREG as " + option);
+               mx_found = true;
+               break;
+           }
+        }
+
         // Forward vm options to LingeredApp
         ArrayList<String> cmd = new ArrayList();
         cmd.addAll(Utils.getVmOptions());
+        if (!mx_found) {
+            cmd.add(desiredMaxHeapSize);
+            System.out.println("INFO: maximum heap size set explicitly as " + desiredMaxHeapSize);
+        }
         cmd.add("-XX:+PrintFlagsFinal");
 
         TmtoolTestScenario tmt = TmtoolTestScenario.create("jmap", "-heap");