< prev index next >

test/jdk/sun/tools/jmap/BasicJMapTest.java

Print this page
rev 59026 : jmap baseline

@@ -76,10 +76,25 @@
     private static void testHistoAll() throws Exception {
         OutputAnalyzer output = jmap("-histo:all");
         output.shouldHaveExitValue(0);
     }
 
+    private static void testHistoParallelZero() throws Exception {
+        OutputAnalyzer output = jmap("-histo:parallel=0");
+        output.shouldHaveExitValue(0);
+    }
+
+    private static void testHistoParallel() throws Exception {
+        OutputAnalyzer output = jmap("-histo:parallel=2");
+        output.shouldHaveExitValue(0);
+    }
+
+    private static void testHistoNonParallel() throws Exception {
+        OutputAnalyzer output = jmap("-histo:parallel=1");
+        output.shouldHaveExitValue(0);
+    }
+
     private static void testHistoToFile() throws Exception {
         histoToFile(false);
     }
 
     private static void testHistoLiveToFile() throws Exception {

@@ -89,10 +104,22 @@
     private static void testHistoAllToFile() throws Exception {
         boolean explicitAll = true;
         histoToFile(false, explicitAll);
     }
 
+    private static void testHistoFileParallelZero() throws Exception {
+        histoToFile(false, false, 0);
+    }
+
+    private static void testHistoFileParallel() throws Exception {
+        histoToFile(false, false, 2);
+    }
+
+    private static void testHistoFileNonParallel() throws Exception {
+        histoToFile(false, false, 1);
+    }
+
     private static void histoToFile(boolean live) throws Exception {
         boolean explicitAll = false;
         histoToFile(live, explicitAll);
     }
 

@@ -114,10 +141,47 @@
         }
         output.shouldHaveExitValue(0);
         output.shouldContain("Heap inspection file created");
         file.delete();
     }
+
+    private static void histoToFile(boolean live,
+                                    boolean explicitAll,
+                                    int parallelThreadNum) throws Exception {
+        String liveArg = "";
+        String fileArg = "";
+        String parArg = "parallel=" + parallelThreadNum;
+        String allArgs = "-histo:";
+
+        if (live == true && explicitAll == true) {
+            fail("Illegal argument setting for jmap -histo");
+        }
+        if (live == true ) {
+            liveArg = "live,";
+        } else if(explicitAll) {
+            liveArg = "all,";
+        }
+
+        File file = new File("jmap.histo.file" + System.currentTimeMillis() + ".histo");
+        if (file.exists()) {
+            file.delete();
+        }
+        fileArg = "file=" + file.getName();
+
+        OutputAnalyzer output;
+        allArgs = allArgs + liveArg + fileArg + "," + parArg + "";
+        if (live) {
+            output = jmap(allArgs);
+        } else if (explicitAll == true) {
+            output = jmap(allArgs);
+        } else {
+            output = jmap(allArgs);
+        }
+        output.shouldHaveExitValue(0);
+        output.shouldContain("Heap inspection file created");
+        file.delete();
+    }
 
     private static void testFinalizerInfo() throws Exception {
         OutputAnalyzer output = jmap("-finalizerinfo");
         output.shouldHaveExitValue(0);
     }
< prev index next >