changeset 14486:b64581fa1b03

Merge
author vlivanov
date Tue, 10 May 2016 21:38:46 +0000
parents 1ea5529a8988 2053d6544876
children 3eea6819cc1f
files
diffstat 1 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/test/sun/tools/jhsdb/BasicLauncherTest.java	Wed May 11 00:30:33 2016 +0300
+++ b/test/sun/tools/jhsdb/BasicLauncherTest.java	Tue May 10 21:38:46 2016 +0000
@@ -31,9 +31,12 @@
  * @run main BasicLauncherTest
  */
 
+import static jdk.testlibrary.Asserts.assertTrue;
+
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Arrays;
@@ -99,7 +102,7 @@
 
         System.out.println("Starting LingeredApp");
         try {
-            theApp = LingeredApp.startApp();
+            theApp = LingeredApp.startApp(Arrays.asList("-Xmx256m"));
 
             System.out.println("Starting " + toolName + " " + toolArgs.get(0) + " against " + theApp.getPid());
             JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
@@ -129,6 +132,21 @@
         launch(expectedMessage, Arrays.asList(toolArgs));
     }
 
+    public static void testHeapDump() throws IOException {
+        File dump = new File("jhsdb.jmap.dump." +
+                             System.currentTimeMillis() + ".hprof");
+        if (dump.exists()) {
+            dump.delete();
+        }
+        dump.deleteOnExit();
+
+        launch("heap written to", "jmap",
+               "--binaryheap", "--dumpfile=" + dump.getAbsolutePath());
+
+        assertTrue(dump.exists() && dump.isFile(),
+                   "Could not create dump file " + dump.getAbsolutePath());
+    }
+
     public static void main(String[] args)
         throws IOException {
 
@@ -145,6 +163,8 @@
         launch("Java System Properties", "jinfo");
         launch("java.threads", "jsnap");
 
+        testHeapDump();
+
         // The test throws RuntimeException on error.
         // IOException is thrown if LingeredApp can't start because of some bad
         // environment condition